ShadowedRenderQueue and OpenGLException

Having solved world hunger, cured cancer, and reorganized my sock drawer, I've started trying to add shadows to my card game.  It's not working.  The TestShadowPass test app works just fine, but I can't get mine functional.  It crashes on the very first render that it attempts.

I'm using the FixedFramerateGame for my base app.  My geometries are all done using the com.jme.scene.shape primitives; they have materials and textures assigned to them.  At the bottom of this post, you can see my update and render methods.  After dropping dozens of debug statements into the ShadowedRenderPass.renderPass() method, I've determined that the OpenGL error is occurring while attempting to draw one of the shadow volumes.  All of my lights are attached to the root node; the nodes to be shadowed are children of a Node that is a child of the root.

Do my objects need to be of some specific type?  Is there some other step I'm missing (reading SimplePassGame leads me to believe there isn't)?  What could I possibly be doing incorrectly?

Log from around the crash:

INFO: Attempting to run at 30 fps.

Mar 5, 2007 12:34:44 PM com.jme.scene.Node <init>

INFO: Node created.

Mar 5, 2007 12:34:44 PM com.jme.scene.Node attachChild

INFO: Child (null) attached to this node (Volumes)

org.lwjgl.opengl.OpenGLException: Invalid value (1281)

at org.lwjgl.opengl.Util.checkGLError(

at org.lwjgl.opengl.Display.swapBuffers(

at org.lwjgl.opengl.Display.update(

at com.jme.renderer.lwjgl.LWJGLRenderer.displayBackBuffer(


at Main.main(

Mar 5, 2007 12:34:45 PM start

INFO: Application ending.


        protected synchronized void render(float frame) {


protected void update(float frame) {
float animation = timer.getTimePerFrame();

rootNode.updateGeometricState(animation, true);
if (KeyBindingManager.getKeyBindingManager().isValidCommand("exit")) {
finished = true;

So, I turned off a pointlight, and now it doesn't crash immediately.  It just doesn't display anything.

Another thing I find particularly odd.  In the TestShadowPass test app, if I comment out these lines:

RenderPass rPass = new RenderPass();



Then the test stops working–I get nothing but a gray screen.

Well, apparently, the shadow extrusion algorithm doesn't work on planar geometries.  So, the Disk that is the top/bottom of my chips, and the Quads that make up the cards, cause the whole thing to bomb out.

I guess I'll have a look at that.

I've extended ShadowedRenderPass and ShadowMeshes to do just that. What's even better is that with planar geometry, you know that the edges that are on the boundary between front and back are always the same. That gave a nice performance boost. It's ugly as hell and adapted to my project but you can have them if you'd like.

Yeah, I'd love to see it!  It'd be much appreciated.

My email is:

    user: netzapper


I've got the same OpenGl exception …  :?

could you send me your addition to the shadow classes please …  :slight_smile:

Thanks in advance !



Would make more sense to contribute it back here if it's simply extended functionality… :)  (iow, it doesn't break existing functionality)

I didn't work with me … I have stranges shadows.

I tried different option with your code as written but had no good results …

@renanse: Yeah, I will find some time to make it a bit more general and then post it here.

@kine: Do you still get the exception or just no shadows? Also, this only works for planar geometries. Try turning the other side of the geometry towards the light.

I have no exceptions but the shadows don't seems to be ok when setting a 3ds imported model as occluder… what is a "planar geometry" (sorry for this simple question… I plan to buy soon books on 3d engines/rendering/opengl etc …) ?

A planar geometry is a mesh whose vertices all lie on the same plane. I guess one could say it is two-dimensional, even though it is positioned in 3D-space.

If your geometry is not planar, you cannot use the classes I mailed you.

Quick guess: Your mesh is not closed and that is what is giving you this problem. (a mesh is not closed if any of it's edges belong to only one triangle instead of two)

I've just stumbled upon to this same problem, any help would be appreciated. I use light that casts pitch black shadows (to prevent player seeing behind walls), and currently occluders are boxes but using plain quads etc would be much faster.

I have the same problem when using shadow volumes on obj files. My application crashes right away with the exception.

org.lwjgl.opengl.OpenGLException: Invalid value (1281)

I have disabled material states on models by not loading the mtl file, after that the shadows work. However without loading the material file models have no textures or material properties. So this workaround is kind of useless, but maybe it will give more insight on fixing the problem.

I had similar problems before, and I too nailed it down that the FPS text pass is what causes the test to actualy work… See my list of issues thread.