Reputation: 2254
For instance, I'm using GL_LUMINANCE_ALPHA to transfer two component data to texture. Someone told me that some internal format constants like GL_LUMINACE_ALPHA are deprecated in OpenGL 3.0(maybe 4.0?) or higher, so use GL_RG or GL_RG8, etc.
However, my target OpenGL version is 2.0 or higher and the specification of OpenGL 2.0 does not contain GL_RG/GL_RG8. In this case, I think there are three possibilities:
What should I choose? I don't want to take 3. unless I have to because it makes things harder and complicated.
Upvotes: 0
Views: 238
Reputation: 43319
No, it is not safe to use OpenGL tokens that a driver knows nothing about. Fortunately, the vast majority of API calls will simply raise a GL_INVALID_ENUM
error and the operation will fail early on before it has a chance to really screw things up.
Solving your GL_LUMINANCE_ALPHA
dilemma is going to take much more than simply swapping in the token GL_RG8
. You will either have to use texture swizzling or swizzling in your shader to make it so that the color of your texture is (R, R, R, G).
Decide which version of OpenGL you are targeting early on, or write separate code paths. But it will never be as simple as switching enum values at run-time.
Upvotes: 3