OpenGL and Qt

I have been learning Qt (http://www.qt.io) a cross platform gui library and OpenGL (https://www.opengl.org) a graphics API the past two weeks. Its kind of an aside as I am still thinking/procrastinating on how to proceed with the ray tracer and i need to spend time revising for exams.

I am trying to implement a simple viewer application to manipulate the scene, currently, I have four views; the front, left, top, which are orthographic views and a perspective view at the bottom right. Each view has the ability to rotate, pan and zoom in.

Some technicalities, each viewport is a QOpenGLWidget (http://doc.qt.io/qt-5/qopenglwidget.html) each sharing a main context, which allows the shader programs, textures, and vertex buffer objects to be shared, one problem however is that the vertex array objects are not shared, as seen below the teapot’s colours have made it into the grid since there is only one VAO used at the moment so the attribute is still active and bound to its teapot’s colour VBO. Another problem is that each context of each view is intialized only when it is needed to be drawn and therefore you cannot create/bind any VBOs outside of the class.

The next step is to implement a scene graph to organize the objects within the scene to apply transformations, and render more easily. I still need a way to use VAOs across the different contexts and then I can think about abstracting things into classes since I am just experimenting and learning things are just written so that they work.

viewport.png
Many Viewports

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s