سؤال

I am trying to use this tutorial to perform shadow mapping in LWJGL. What I notice is that LWJGL has three classes with all of the framebuffer functions that this tutorial uses: ARBFramebufferObject, EXTFramebufferObject, and GL30.

I don't know which one to use. Can somebody explain the differences of these classes to me, and which one I should be using? I've tried porting the code once and had no luck, so I'd just like this cleared up before I try again.

هل كانت مفيدة؟

المحلول

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.

So bottom line, go for the Core functions, then the ARB functions and last the EXT functions. Though when you use Extensions remember to check at runtime if the graphics card supports them. Because the Extensions aren't guaranteed to work on all graphics cards like the Core functions. (Since again the Core functions only require that the graphics card supports a certain version of OpenGL).

Also remember that EXT and ARB extensions aren't the only extensions available, Nvidia, AMD, Apple, etc. also makes their own extensions for OpenGL.

Remember

Something you always need to keep in mind is, if you build it into a program which "selects" the available functions, then always remember you can't use GL_TEXTURE1 with glActiveTextureARB and you can't use GL_TEXTURE1_EXT with glActiveTexture. Even though that mixing them sometimes still gives the desired result, though there is no guarantee for that.

Extra

Try reading my answer here the question is basically asking the same as yours, though the OP asks about the difference between Core functions and Extensions.

Update

If the C++ code uses the EXT functions or ARB functions, should I use those too in OpenGL, or can I just use the core ones?

Some ARB, EXT, etc. functions might not be Core functions yet. You can sort of say extensions are for testing new functions. Then when they've been tested, and seem useful and stable then they will be made into Core functions (This is really abstract said).

Though if the ARB, EXT, etc. functions already exist as Core functions. Then use the Core functions, as already said the Core functions only require a certain OpenGL version to be able to run, the same guarantee don't go for the extensions.

If the Graphics Card don't supports OpenGL 3.0 or above, then you of course can't use those Core functions. Then you might get lucky that you can use either the ARB or EXT, etc. functions instead to accomplish the same thing.

Then when we take all the above in count, I would go for using GL30 to create the Framebuffer instead of using ARBFramebufferObject and EXTFramebufferObject. Though if you can't use GL30, I would go for using/trying ARBFramebufferObjectand then EXTFramebufferObject after.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top