Unsolved Creating Custom Widget Surfaces
-
I do not have much experience with the Qi graphical api and I did not like it much and I found it badly documented, I would like to create a widget of DirectX, OpenGL, Vulkan or any other graphic API. For example in vex of using QOpenGLWidget to create a widget using external libraries like glew, SDL or glut, all natively with C ++ instead of QML, I know this is possible as for example this person created their own "widget" of Vulkan.
-
Hi and welcome to devnet,
OpenGL has been supported by Qt way before QML existed.
Qt also has now support for Vulkan. You have an example here in the documentation. However you have some work to do as described here.
On that same page, you have the starting point of Qt's OpenGL support. You don't need glew, SDL nor glut.
There are some simple OpenGL related samples.So what is it exactly that you are trying to do ?
-
@SGaist One of my main reasons why I want to make an abstract rendering widget to facilitate the deployment of directx, vulkan and opengl, why in the future I intend to build a level editor with qt but with the rendering system that is independent of the libraries of qt. Another reason I want to build a custom widget is ANGLE, so I read OpenGl is rendered by ANGLE and sometimes it converts to directx (I did not understand what the documentation meant by that). I know there must be some way to even why the Cry Engine editor is done with Qt.
-
Are you aware of the Qt3D module ?
-
@SGaist As I have already said in the above comment I need the qt just for the level editor, the renderer I will do independent of the qt libraries but if it is not possible to create a similar widget I should just look for other ways to build an editor.
-
@Samuel-Ives If you make a QOpenGLWidget, you can draw into it however you want. It just sets up the surface and context, and calls a function that you implement to handle the drawing. So you can make your graphics engine that does OpenGL drawing into a library, and make it responsible for doing the drawing into that widget. Then you build a Qt GUI around it with all the buttons and knobs that you want. To make your game/app/whatever then you just need to make your own main() that sets up an OpenGL context without Qt and you can call the same Qt-free graphics engine code in your library. You can use a standalone QWindow instead of a QWidget if you don't want to make that view a widget in a layout.
For DirectX, it's more complicated. I am not a Windows guy, so I have never tried it. But you can get a native window handle and then setup contexts or whatever it uses as a normal Win32 window handle and basically do the same thing.
Vulkan support is pretty new, so it's not as mature as OpenGL, but there is a standard QVulkanWindow class you can use in your editor to give your engine code a place to draw.
If you can clarify what exactly you want to do, and what problems you are running into doing it, people can offer more specific advice.
-
@wrosecrans Probably derived from a QWindow would be better, I could make an abstract QWindow class to represent the rendering "widget", then implement a class that represents the renderer with the api chosen by the user, then (In the windows environment) I should probably get the GDI and its handlers from that QWindow and use it to create the context and somehow paint on the surface of QWindow