puklaus's picture

OGL3 and ARB/EXT

I writed ogl3 (Core Profile Forward-Compatible/Debug Context, so no deprecated methods used) support to my library and I use GL.Arb.* / GL.Ext.* methods.

Does OTK link these Arb/Ext methods to the right gl3 methods when using gl3?
Is it ok to use them (I have them because I have gl2 support too)?

My code seems to work but should I have to use right gl3 methods instead ie
GL.Ext.GenFramebuffers(1, out fboHandle); ---> GL.GenFramebuffers(1, out fboHandle);


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
tksuoran's picture

I hope this is right..: You can use feature from GL. in OpenTK if either

- the feature has been added to Core (for example, VBO was added to the Core in 1.5) and your driver can provide that GL version, or
- if the ARB extension in question is a pure subset of core functionality and your driver can provide that ARB extension. Only some ARB extensions are like this but ARB framebuffer object for example is.

Some important features:

- Vertex buffer object: Core in 1.5, extension GL_ARB_vertex_buffer_object
- Shaders: Core in 2.0, extension GL_ARB_shading_language_100
- Framebuffer object: Core in 3.0, strict subset extension GL_ARB_framebuffer_object
- Vertex array object: Core in 3.0, strict subset extension GL_ARB_vertex_array_object, in 3.1 and after forward compatible and core profile contexts require use of vertex array object
- Draw elements base vertex: Core in 3.2, strict subset extension GL_ARB_draw_elements_base_vertex
- Core geometry shaders: Core in 3.2
- Extension geometry shaders: extension GL_ARB_geometry_shader4 (different from core geometry shaders)
- Program binaries: Core in 4.1, strict subset? extension GL_ARB_get_program_binary

If you look at the list above, you will see that a nice feature set is in GL Core 2 + strict subset extensions. If I am correct then all these functions end up in GL.* instead of going to GL.ARB.*. Thus basically the same code should run in GL 2 and GL 3.

Note that the way to query extensions is different in GL before 3.0 and in GL 3.0 and after.
Also GL 3.0 introduced context flags (forward compatible) that you can query with GetInteger, and 3.3 introduced profile mask (Core profile, Compatibility profile).

Forward compatible / core profile contexts reject older GLSL versions. But again you should never release anything using the forward compatible context, it is meant only for development testing. Still, if you really want to be both forward and backwards compatible, you'd need to have at least two versions of your shaders. I have 120 and 330.

You may also find little use for supporting GL version less than 2 or EXT extensions, almost everything today supports ARB versions of the extensions.