GLException lies?

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.

I believe glBlendFuncSeparate() was introduced in OpenGL 1.4, and is not part of GL_EXT_blend_func_separate! The Radeon Mobility 9000 supports OpenGL 1.3 only. Refer to http://www.opengl.org/registry/specs/EXT/blend_func_separate.txt for a detailed specification of the extension you are trying to use.

You are in luck because the GL interface does provide an entry point to glBlendFuncSeparateEXT() (which is what you want to use, according to the link above).

Hope this helps,
Matt.

So there’s a glBlendFuncSeparate() and a glBlendFuncSeparateEXT()… oh man. Here I was thinking that the JSR-231 spec removed the EXT versions of the methods and replaced them with non-EXT variants. Anyway, your advice on using glBlendFuncSeparateEXT() worked, which only leads me to one conclusion: OpenGL sure is messed-up. ::slight_smile:

Glad it works. :slight_smile:
I think that in JSR-231, EXT methods were removed pertaining to functionality that was merged into OpenGL up to version 1.3. Yours is in 1.4 hence the two functions still coexist.

Anyway you should be thankful that you’re not running a more decent gfx card :stuck_out_tongue: otherwise you might never have spotted the problem in your code!