Ran into a little GLException woes lately. The exception is being thrown whenever I try to use the glBlendFuncSeparate() method. I check for it before using it:
// Texture blending and blending function
gl.glEnable(GL_BLEND);
if (gl.isExtensionAvailable("GL_EXT_blend_func_separate")) {
gl.glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
}
It passes the test, goes into the next line, but then throws the exception.
I also looked through the list of extensions to make sure it is supported by the videocard, a Radeon Mobility 9000:
...
- GL_EXT_blend_color
- GL_EXT_blend_func_separate
- GL_EXT_blend_minmax
- GL_EXT_blend_subtract
...
Here’s the part of the trace related to the exception:
Caused by: javax.media.opengl.GLException: Method "glBlendFuncSeparate" not available
at com.sun.opengl.impl.GLImpl.glBlendFuncSeparate(GLImpl.java:604)
at redhorizon.engine.GraphicsEngine.enableGL(GraphicsEngine.java:124)
at redhorizon.engine.GraphicsEngine.run(GraphicsEngine.java:154)
at java.lang.Thread.run(Thread.java:595)
While this function isn’t all that crucial to me (I was just trying it out, but use the standard glBlendFunc() for my program anyway), I just thought it a bit strange that an extension that is advertised as available by the videocard isn’t working when I try to use it.