OpenGL extension vs OpenGL core

opengl

I was doubting: I'm writing a cross-platform engine OpenGL C++, I figured out Windows forces the developers to access OpenGL features above 1.1 through extensions.

Now the thing is, on Linux, I know that I can directly access functions if the version supports it through glext.h and opengl version. The problem is that if on Linux, the core doesn't support it, is it possible there is an extensions that supports the same functionality, in my case vertex buffer objects?

I'm doing something like this:

Windows:

#define glFunction functionpointer_to_the_extension

Linux:
Since glext already defined glFunction, I can write in client code glFunction, and compile it both on Windows AND Linux without changing a single line in my client code using the engine (my goal).

Now the thing is, I saw a tutorial use only the extension on Linux, and not checking for the opengl implementation version. If the functionality is available in the core, is it also available as extension (VBO's e.g.)? Or is an extension something you never know is available?

I want to write an engine that is capable of using all the hardware functionalities, so I need to check (on Linux) for extensions as well as core version for possible functionality implementation.

Best Answer

I was doubting: I'm writing a cross-platform engine OpenGL C++, I figured out windows forces the developers to access OpenGL features above 1.1 through extensions.

That sounds odd, because Windows have never forced me to use extensions, I always use core functions when possible, and while saying "when possible" I mean if my graphics card/driver supports the features. Because that plays the biggest part.

If the functionality is available in the core, is it also available as extension (VBO's e.g.)?

Not necessarily! But always favor the core functions when you can. Though when using extensions (EXT, ARB, etc) just always remember to check, if they are available.

If you're going to release a program using an NV Extension (Nvidia Extension), then again be sure to have something that checks whether the function is available, as if someone with a non-Nvidia graphics card uses your program it will most likely crash.

Or is an extension something you never know is available?

Yes, you never know for sure if an extension is available, it depends on various things such as.

  • The OpenGL version you're using
  • Your Graphics Card
  • Your Graphics Card version and model (GeForce, Cuda, Radeon, etc)
  • Your Graphics Card vendor (Nvidia, AMD, etc)

By using core functions the chances are that the majority of people will be able to run the program, as long as their graphics card can run the particular GL version.

  • EXT extensions usually only are supported by a few vendors.
  • ARB extensions are often supported by the majority but not necessarily all vendors.
  • Core functions are supported by every card which supports the particular GL version, which the program is using.

Remember

Always remember you can't mix-match and use GL_TEXTURE1 with glActiveTextureARB and you can't use GL_TEXTURE1_EXT with glActiveTexture. Even though mixing them sometimes produces the desired result, there is no guarantee for that.

Related Topic