Weird rendering sequence

I try to embedded jme into SWT canvas, so made some changes on LWJGLRenderer

but it made the rendering sequence of my application become weird

Their rendering sequence is in order of how they would attached to the root node,

but not how they would viewed by camera



for example, I create a multii-box node form top to bottom and right to left

If it’s viewed from right side, it would looks like this



and if we look at the node from the left side, it would become





I have no idea which part of modification lead to this problem, and wondering

if someone is more experienced in lwgjl can give me some suggestion?

Looks like you have a problem with your zbuffer state.  Do you have one applied to your scene?

Yes, I did apply a zbuffer state to my scene

Are those a bunch of transparent blocks? Are you making use of the render queue?

redjava said:

Yes, I did apply a zbuffer state to my scene


If they aren't supposed to be transparent, what is your zbuffer settings, and did you remember to updateRS?  Also, you mentioned this came about after monkeying (excuse the pun) with LWJGLRenderer...  What were those changes?

Those are not transparent blocks, and I set the render queue as QUEUE_OPAQUE mode



I set my zbuffer fcuntion as CF_LEQUAL, and update RS after that



The modification on LWJGLRenderer in my program are about two parts:

1.The JVM will crash at this line in LWJGLRenderer constructor

if (TextureState.getNumberOfUnits() == -1) createTextureState()

so I delete it and set the prevTex as new FloatBuffer[4]



2.The previous code will store GLContext.getCapabilities() in capabilities during initial,

    and the following code will access to capabilities but cause JVM crash again

    So I remove capabilities and invoke GLContext.getCapabilities() every time the program needs to access this object



These JVM crash problem occurs when I try to embedded jme into swt

And now  my jme scene can display on swt window, but just this weird problem will emerge

I still seems like zbuffer issues to me… but it's hard to say without testing myself.

Finally, I found the problem.

Since I want to embed jme scene onto SWT canvas, so it requires a createCanvas method instead of createWindow.

During my development, the JVM will crash when calling updateStates (com.jme.system.DisplaySystem.updateStates),

so I remove that line try to avoid this problem. Thereafter, the program execute successfully, but the weird rendering sequence

describe above happened, and I didn't find out it's related to that modifycation.



Now I found why these JVM crash probelms will occurs

Thoses crash all happend when acces to GLContext.getCapabilities().* and cause EXCEPTION_ACCESS_VIOLATION error

This is because the GLContext hadn't been initialized(that is, call useContext(…))

then I have to create canvas and set the canvas as the context of GLContext, before creating renderer or taking

any other actions of lwjgl that will access to GLContext

(by the way, I use org.eclipse.swt.opengl.GLCanvas)



Before this relation had found, I try to made some ugly modifycation on lwjgl code.

Well, it wokrs, but I really doesn't like to do in this way, and it also dissable some functions of lwjgl

I had ever surveyed MonkdyWorld3D, want to see how they solve this problem, but found that they

avoid this kind of problem by disable some functions of lwjgl

I hope my experience can help them ,and all the others who also interested in making this kind of development



Thanks to everyone who had made suggestion to me :slight_smile: