Question

I am in the process of migrating my old openGL code (immediate mode) to Vertext-Buffer-Objects. I realized that I need to use OpenGL3 API calls (GL_ARB_vertex_buffer_object) for this. So I was going to use GLEW as extension loading library.

My question is , is there a special way to initialize QGLWidget for OpenGL3 contexT?

Was it helpful?

Solution

What do you mean by an "OpenGL 3 context"?

You can get OpenGL support for version 3.1 or greater by normal context creation. Now, if you want a core OpenGL context, which implements the core specification, then you have to do a bit of work.

Note that a compatibility context is perfectly fine. It still does everything a core context does; you don't have to do any of the following to use buffer objects.

Oh, and buffer objects are not an extension anymore. Use the core functions, not the extension functions you see in GL_ARB_vertex_buffer_object.

Note: the following is for QT 4.7 or above:

You must be at least semi familiar with QGLFormat; you need one in order to create a QGLWidget. Just call QGLFormat::setProfile on that object with QGLFormat::CoreProfile.

Sadly, QT does not allow you to specify a specific version. But that should be enough to get a core OpenGL profile, assuming your hardware implements OpenGL 3.2 or better.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top