help with legacy opengl
-
I have an existing Fortran program which uses freeglut and f03gl bindings to render a scene. That code uses legacy opengl draw calls like so
! loop over all triangles to render call glBegin( GL_TRIANGLES ); call glVertex3fv( node(:,1) ); call glVertex3fv( node(:,2) ); call glVertex3fv( node(:,3) ); call glEnd();
I know that this is a deprecated method, but it works great for the application. I would like to use Qt to add a simple user interface for this program (probably buttons and a top bar menu). I have not had much luck finding examples of Qt using legacy openGL. What I would like to do is have Qt C++ start my Fortran program, but replace the Fortran openGL calls to instead send the data to be rendered back to Qt. I have already got that working, but the last step of actually rendering in Qt is giving me trouble.
In examples I have looked at, render data is hard coded in a function of some type of Q object. For example, the builtin example openglwindow has vertices data defined in a render() function of a openGLwindow class object. So I am having conceptual trouble with how to render my data that is being "streamed" in. I was trying to adapt that example to use legacy opengl calls but haven't got it to work.
Is what I want to do even possible? Any advice would be helpful. Thanks
-
-
Hi,
From the looks of it, the QOpenGLFunctions class is likely what you are looking for in combination with QOpenGLWidget. With both together, you should be able to reuse what you already have.