Unable to use OpenGL 3 - glGenerateMipmapEXT missing

Hi!

I’m just started developing a new game, but I have ran into some trouble.

As my shaders requires some features only available in OpenGL 3, I tried to force this version by using settings.setRenderer(AppSettings.LWJGL_OPENGL3);

But now when I start the game, it fails with the exception:

java.lang.IllegalStateException: Function is not supported
at org.lwjgl.BufferChecks.checkFunctionAddress(BufferChecks.java:58)
at org.lwjgl.opengl.EXTFramebufferObject.glGenerateMipmapEXT(EXTFramebufferObject.java:323)
at com.jme3.renderer.lwjgl.LwjglRenderer.updateTexImageData(LwjglRenderer.java:1924)
at com.jme3.renderer.lwjgl.LwjglRenderer.setTexture(LwjglRenderer.java:1936)
at com.jme3.material.MatParamTexture.apply(MatParamTexture.java:86)

It seems like the code tries to generate some Mipmaps using the glGenerateMipmapEXT which LWJGL does not have.

I am running Arch Linux with Mesa 10.2.5 on a Intel Iris 5100

Any ideas how to fix this or should I to use a custom compile of jME3?

Thank you

-Dissing

If you use the opengl2 one and defines the proper GLSL versions for the shader it probably works better.

in j3md

VertexShader GLSL150: Shaders/multimaterial.vert
FragmentShader GLSL150: Shaders/multimaterial.frag

The Material was already set to use GLSL150. I have tried many combinations, but it does not seam to have anything with the shaders to do.
I have also tried to use other materials, but to no avail.

Hm I kinda wonder then, since I use mesa on arch linux on my laptop the settings is as identicall as it gets.
My laptop has a ati apu however, maybe the xf86-video-intel is not properly used?

Please check that it does not fallback to another driver. (aka remove them all ^^)

@Dissing said: As my shaders requires some features only available in OpenGL 3, I tried to force this version by using settings.setRenderer(AppSettings.LWJGL_OPENGL3);

Note: while you should be able to do this there is no reason that I know of that you have to do it. You can use OpenGL 3 features without doing that.

@pspeed said: Note: while you should be able to do this there is no reason that I know of that you have to do it. You can use OpenGL 3 features without doing that.

Sorry when I said OpenGL 3, I actually meant GLSL 1.5 which is OpenGL 3.2. My error.
If I do not include the settings.setRenderer(AppSettings.LWJGL_OPENGL3); it report that the caps [GLSL150] are required.

I might have found something, but I am by no means an OpenGL expert, so please correct me if anything of the following is wrong! =D

According to glxinfo, my driver does not have GL_EXT_framebuffer_object when running OpenGL 3.3 (core). Instead it provides GL_ARB_framebuffer_object. Therefore I tried to change the code in LwjglRenderer.java:1924 from:

[java]
if (GLContext.getCapabilities().OpenGL30) {
if (!img.hasMipmaps() && img.isGeneratedMipmapsRequired() && img.getData() != null) {
// XXX: Required for ATI
glEnable(target);
glGenerateMipmapEXT(target);
glDisable(target);
img.setMipmapsGenerated(true);
}
}
[/java]
to

[java]
if (GLContext.getCapabilities().OpenGL33) {
glEnable(target);
GL30.glGenerateMipmap(target);
glDisable(target);
img.setMipmapsGenerated(true);
} else if (GLContext.getCapabilities().OpenGL30) {
if (!img.hasMipmaps() && img.isGeneratedMipmapsRequired() && img.getData() != null) {
// XXX: Required for ATI
glEnable(target);
glGenerateMipmapEXT(target);
glDisable(target);
img.setMipmapsGenerated(true);
}
}
[/java]

Now it no longers crashes on startup, but instead the window remains all black.

Is it some kind of problem with Mesa Intel OpenGL 3.3? It is quite new after all.

@Dissing said: Sorry when I said OpenGL 3, I actually meant GLSL 1.5 which is OpenGL 3.2. My error. If I do not include the settings.setRenderer(AppSettings.LWJGL_OPENGL3); it report that the caps [GLSL150] are required.

…which I think is indicating that your card (at least as JME sees it) does not support GLSL150.

Normally, you can have shaders that specify these versions without forcing only OpenGL3 compatibility. I assume your j3md does indicate GLSL150 in its definition. If not then that’s your problem.

Found the reason for the missing GLSL150 Caps.
According to this link
" OpenGL 3.3 is only available if requested at context creation because compatibility contexts not supported. "

So unless I specifically request AppSettings.LWJGL_OPENGL3, it will fall back to OpenGL 3.0

Might be I have to settle for OpenGL 3.0 then.

Found the reason why it does not work when I force OpenGL 3.3 Core profile.

Core profile requires VAO’s and they seem to be unsupported in jME3?

Found this in the code:

[java]
// if (ctxCaps.GL_ARB_vertex_array_object){
// renderMeshVertexArray(mesh, lod, count);
// }else{
renderMeshDefault(mesh, lod, count, instanceData);
// }
[/java]

Well OpenGL 3.0 it is then

But thank you for the help anyway! =D

I’m no OpenGL expert, but shouldn’t you use VBO’s?

From what I’ve read from the page above, is that VAO’s are an ATI extension.

VAOs are Core since 3.0
http://www.opengl.org/wiki/Vertex_Specification#Vertex_Array_Object

1 Like