ATI && FBO && MipMaps

Hey guys!



I am rendering 13 scenes to 26 textures using a code very similar to ImposterNode, this is how i set the textures up:



    tRenderer =
        (LWJGLTextureRenderer)DisplaySystem.getDisplaySystem().createTextureRenderer(twidth, theight,
            TextureRenderer.Target.Texture2D);
    tRenderer.setBackgroundColor(new ColorRGBA(0, 0, 0, 0));
    tRenderer.setMultipleTargets(false);

    animatedTexture = new Texture2D();
    stillTexture = new Texture2D();

    animatedTexture.setMagnificationFilter(MagnificationFilter.Bilinear);
    animatedTexture.setMinificationFilter(MinificationFilter.Trilinear);
    stillTexture.setMagnificationFilter(MagnificationFilter.Bilinear);
    stillTexture.setMinificationFilter(MinificationFilter.Trilinear);

    tRenderer.setupTexture(stillTexture);
    tRenderer.setupTexture(animatedTexture);



as you can see i render every scene with one TextureRenderer to two textures. This works just fine on all systems with nVidia Cards, however when i try to run it on an ATI card i will get 13 of these (for every TR):


Jun 9, 2009 12:55:56 PM class com.jme.renderer.lwjgl.LWJGLTextureRenderer render(Spatial, Texture, boolean)
SEVERE: Exception
java.lang.RuntimeException: FrameBuffer: 13, has caused a GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT exception
   at com.jme.renderer.lwjgl.LWJGLTextureRenderer.checkFBOComplete(LWJGLTextureRenderer.java:783)
   at com.jme.renderer.lwjgl.LWJGLTextureRenderer.setupForSingleTexDraw(LWJGLTextureRenderer.java:726)
   at com.jme.renderer.lwjgl.LWJGLTextureRenderer.render(LWJGLTextureRenderer.java:569)
   at com.jme.renderer.lwjgl.LWJGLTextureRenderer.render(LWJGLTextureRenderer.java:545)
   at ...



and finally that one, which will crash the application:


Jun 9, 2009 12:55:56 PM com.jmex.game.DefaultUncaughtExceptionHandler uncaughtException
SEVERE: Main game loop broken by uncaught exception
org.lwjgl.opengl.OpenGLException: Invalid framebuffer operation (1286)
   at org.lwjgl.opengl.Util.checkGLError(Util.java:54)
   at org.lwjgl.opengl.Display.swapBuffers(Display.java:640)
   at org.lwjgl.opengl.Display.update(Display.java:660)
   at com.jme.renderer.lwjgl.LWJGLRenderer.displayBackBuffer(LWJGLRenderer.java:532)
   at com.jmex.game.StandardGame.run(StandardGame.java:252)
   at java.lang.Thread.run(Thread.java:619)



Now, i have narrowed it down to what is the problem. When i DONT use MipMapping for the rendered Textures it WORKS but looks ugly (so i really need it to work).


    animatedTexture.setMinificationFilter(MinificationFilter.BilinearNoMipMaps);
    stillTexture.setMinificationFilter(MinificationFilter.BilinearNoMipMaps);



TO SUM UP:

ATI card + FBO + MipMap == CRASH
ATI card + FBO + NO MipMap == OK

nVidia card + FBO + * == OK

The behavior is the same on Vista, Ubuntu and XP. I use the current jme 2.0 trunk.
any ideas? thanks in advance.

It's possible jME is making the call to glGenerateMipmap in the wrong place… The OpenGL code in LWJGLTextureRenderer should be reviewed to make sure it follows all guidelines.

You might be able to debug the OpenGLException better if you include lwjgl-debug.jar instead of lwjgl.jar in your classpath, as the former checks for OpenGL error after every GL call.

thx for the hint, i'll do that and report back.  :slight_smile:

Momoko_Fan said:

You might be able to debug the OpenGLException better if you include lwjgl-debug.jar instead of lwjgl.jar in your classpath, as the former checks for OpenGL error after every GL call.


I tried to, but i cant find a lwjgl-debug.jar nor in the jme project, the lwjgl site or anywhere else on the internet  :|

its in the  lwjgl-2.1.0.zip :



http://sourceforge.net/project/showfiles.php?group_id=58488&package_id=54362&release_id=670417