What is the best way to create a nested opengl canvas - windows

I would like to write a library that draws some opengl on a given window handle.
How can I initialize an opengl-context inside a given window?
Is it possible to do that platform independent using SDL or some other library?

Qt provides a very good, cross platform mechanism for opening an OpenGL context and drawing into it. For details, see QtOpenGL.

You could use Open Producer or the OpenSceneGraph to do it as well.

Related

How can I create a desktop GUI application similar to Blender or Maya?

I would like to create a customized Graphical User Interface Window similar to Blender or Maya GUI window. Please refer this below image:
How and where to begin with to design and create a customized GUI window similar to Maya / Blender UI window. Please refer the below image which has video / image preview option and floating buttons and menus:
Being a student, instead of using other desktop GUI applications for 3D purposes, can I able to create a Graphical User Interface window similar to Blender / Maya.
Is it possible to create a Desktop Graphical User Interface application? If it is possible then how to begin with to achieve this?
Blender has custom GUI tooling that uses OpenGL. You could try learning OpenGL (or Vulkan) and start rendering things, but you should know that creating a GUI library will be a huge challenge. You'll need to think about things like dealing with keyboard input, font rendering, text selection...
You'll likely save a lot of time by using an existing GUI library that has solved these problems already, like Qt, Flutter, GTK+. Or you could use the code in Blender, but I'm guessing that it will be harder to find good documentation and community support since it's an internal library.
Desktop applications are usually developed in languages like C# and C++, mostly in any software like Visual studio. Since you need a graphics software, you need a render engine somewhat similar to Blender. Try using OpenGL, or any other render engine of your choice, with these former methods, I mean to combine both the idea of "rendering" and "programming"....It's all about inspirations and ideas!
Imho, it won't be an easy task. If you are ready to take up the challenge.
Dear Imgui will be good starting point.

Corona SDK get OpenGL context from native code

Is there a way to get OpenGL context from native code? Lets say, I need to draw something from my obj-c code. Anything, some object, complex bezier curve etc. I know that I need enterprise account. So I'm asking just about the OpenGL context. How it will look like and how to do it?
Corona Enterprise has APIs that allow you to interact with the Corona "Environment" from the native code. But I don't think it is possible to add something inside the Corona OpenGL (i.e, possible may even be, but Corona doesn't make that easy for you).
Usually when you draw or add something from the native code, like an image, you add that image to overlay view that is above the Corona OpenGL view. (In fact, that is why when using Corona Pro, all native objects always appear above of your corona elements)

Drawing an IplImage within an MFC Dialog Application

I have an MFC dialog application that I am using as the front end for some image processing with OpenCV 2.1. I would like to move away from using the cvShowImage and place my image directly on the dialog box or a suitable container. I've found examples that with a technique using an MFC SDI application with a View/Doc model, but I can't figure out how to convert that.
I'm curious if anyone has done this and/or knows where an example may live that does this?
Also, this is my first MFC application.
Thanks all.
There is a CvvImage type in highgui with a drawtoHDC(or simialr) function that will draw into a bitmap

Qt keyboard events with DirectX fullscreen

I need to display a full screen DirectX window from a Qt app.
Although directX isn't supported directly anymore by Qt this should be easy enough - just override QWidget, provide your own paintEvent() and set a WA_PaintOnScreen attribute.
But when the app is full screen DirectX is grabbing all the mouse and keyboard inputs - so the only way out of the app is ctrl-alt-del.
ps. Even if I wrote DirectX keyboard handlers I would still have to find a way of creating the correct Qkeypress event to pass to Qt.
Has anyone done this? Or is there a simple way to tell DirectX not to grab the keyboard?
To my knowledge Direct3D does not get the keyboard. Your problem more likely arises from the fact that Direct3D in full-screen is quite a different beast. Things like GDI (which Qt may well use to do rendering) do not work by default, the run-time hooks lots of bits of information. That info then, presumably, never manages to get to Qt. The options you have are to re-implement Qt to render using Direct3D (Lighthouse project?) or to use a pseudo full screen. This is usually done by creating a window that has a client area the same size as the screen and then positioning it correctly.
The latter would probably be the simplest solution ...
There was an attempt to get a D3DWidget kind of thing in Qt 4.3-4.5 or something like that, but it never was stabilized or approved and later even removed.
Perhaps indeed lighthouse is an option (with a medium sized amount of work, basically links OS/DX stuff to Qt stuff) or you can take a look at the old direct3D code in older Qt branches. I never used it, and it probably isn't intended to use with recent versions of Qt, but it's better than nothing.

Render a Win32 widget in the OpenGL context

Is it possible to intercept a control's paint event and make it draw in the opengl context?
I dont know if this is possible, but this tends to writing your own gui.
It whould be simpler to use a complete openGl Gui library.
http://libufo.sourceforge.net/
If you're using Qt there's a fun demo showing (working) Qt widgets rendering 3D in an OpenGL context. How useful that is to you depends how how hooked you are on the native win32 controls specifically.

Resources