3

I'm a bit confused about how to use OpenGL extensions (specifically VBOs and draw_texture). I know you can check for them in the GL_EXTENSIONS string, but then what? If the extensions are available can I just call the relevant functions as needed or do I have to load them eg using GLEW? And if they aren't available is it OK to have those functions in my code as long as I don't call them, or will that cause unresolved symbol errors in the run-time linker in case the extensions aren't available?

And is it the same across multiple platforms, ie Linux, Windows, Android (native), Mac and iOS?

genpfault
  • 51,148
  • 11
  • 85
  • 139
realh
  • 962
  • 2
  • 7
  • 22

1 Answers1

4

If the extensions are available can I just call the relevant functions as needed

No.

or do I have to load them eg using GLEW?

Yes. You can do it manually as well.

And if they aren't available is it OK to have those functions in my code as long as I don't call them,

Yes.

or will that cause unresolved symbol errors in the run-time linker in case the extensions aren't available?

Since extensions are loaded dynamically at runtime, the executable linker doesn't care about them. All it sees are some variables named __glew_gl… or similar, which are redefined in the header to gl… and the linker doesn't care what value they have.

The extension loader can set them either to a null pointer if not available, or to a stub function that emits a warning message, error condition or similar.

If the extension is available, then the extension loader sets those function pointer variables to point to the actual functions.

datenwolf
  • 159,371
  • 13
  • 185
  • 298