Help with setting up a depth buffer

Hi guys,

i am currently rewritting my old code for shadow mapping. Here is the problem right know:

in my old project i setted up depth buffer by this:


		gl.glGenTextures(1, depthBuffer, 0);
		gl.glBindTexture(GL2.GL_TEXTURE_2D, depthBuffer[0]);
		gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST);
		gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_NEAREST);
	 
		gl.glTexParameterf(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S, GL2.GL_CLAMP);
		gl.glTexParameterf(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T, GL2.GL_CLAMP);

.....etc.....

My question is…how can i do this in JME? Can anyone help me or i should just go back to jogl ?:frowning:

Thanks for any help.

Hm jme abstracts low level gl calls, you should not call low level functions at all.

What you probably want is load a texture,/or create a new one
and use it in a material.

I strongly suggest you to read the tutorials first as it will make the engine design clearer.

Thank you…

I also find it at Texutre after searching for a while…and you are right, i am learning with jme…I will use this texture for store depth…than i am going to use it at shadow map method…

Because of one topic i also figured out that there are jmeTests projects, that helped me a lot too…but thanks for response! :slight_smile:

There’s a tutorial on how to do shadow mapping here, so you don’t have to write your own:
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:light_and_shadow#casting_shadows

If you do want to write your own, there’s a very simple shadow mapping implementation here:

Yes, i want to write my own, because its a bachelor thesis…Do you think that its a good idea to write it in jme or should i just stick with jogl library in netbeans?

The thing is, that i wanted to use advanteges of loading objects, camera, math, asset manager and etc…i had my own parser, camera and everything else, but i am rewritting the code and i am looking for a way how to make these things easier, because they are not exactly the object of my thesis.

@WCIDFY said: Yes, i want to write my own, because its a bachelor thesis...Do you think that its a good idea to write it in jme or should i just stick with jogl library in netbeans?

The thing is, that i wanted to use advanteges of loading objects, camera, math, asset manager and etc…i had my own parser, camera and everything else, but i am rewritting the code and i am looking for a way how to make these things easier, because they are not exactly the object of my thesis.

@Momoko_Fan said: If you do want to write your own, there's a very simple shadow mapping implementation here: https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-core/src/main/java/com/jme3/shadow/BasicShadowRenderer.java