[committed] Depth texture

Hi,

I added Depth16, 24 and 32 to the texture rendering. The attachment contains the patch.



Best,

Andreas

The Patch seems to be incomplete:


+   case Depth16:
+   case Depth24:
+   c



Can you post the patch as pure text? Some mods have problems viewing attachments.

Also the code uses GL14, are checks needed to see if those extensions are actually available?

Hi,

here is the text:


### Eclipse Workspace Patch 1.0
#P jME2
Index: src/com/jme/renderer/lwjgl/LWJGLPbufferTextureRenderer.java
===================================================================
--- src/com/jme/renderer/lwjgl/LWJGLPbufferTextureRenderer.java (revision 4342)
+++ src/com/jme/renderer/lwjgl/LWJGLPbufferTextureRenderer.java (working copy)
@@ -299,6 +299,9 @@
    source = GL11.GL_ALPHA;
    break;
case Depth:
+ case Depth16:
+ case Depth24:
+ case Depth32:
    source = GL11.GL_DEPTH_COMPONENT;
    break;
case Intensity:
@@ -603,6 +606,9 @@
    source = GL11.GL_ALPHA;
    break;
case Depth:
+ case Depth16:
+ case Depth24:
+ case Depth32:
    source = GL11.GL_DEPTH_COMPONENT;
    break;
case Intensity:
Index: src/com/jme/renderer/jogl/JOGLTextureRenderer.java
===================================================================
--- src/com/jme/renderer/jogl/JOGLTextureRenderer.java (revision 4342)
+++ src/com/jme/renderer/jogl/JOGLTextureRenderer.java (working copy)
@@ -282,6 +282,18 @@
    format = GL.GL_DEPTH_COMPONENT;
    components = GL.GL_DEPTH_COMPONENT;
    break;
+ case Depth16:
+     format = GL.GL_DEPTH_COMPONENT16_ARB;
+     components = GL.GL_DEPTH_COMPONENT;
+     break;
+ case Depth24:
+     format = GL.GL_DEPTH_COMPONENT24_ARB;
+     components = GL.GL_DEPTH_COMPONENT;
+     break; 
+ case Depth32:
+     format = GL.GL_DEPTH_COMPONENT32_ARB;
+     components = GL.GL_DEPTH_COMPONENT;
+     break;   
case Intensity:
case Intensity8:
    format = GL.GL_INTENSITY;
@@ -800,8 +812,11 @@
    source = GL.GL_ALPHA;
    break;
case Depth:
-     source = GL.GL_DEPTH_COMPONENT;
-     break;
+ case Depth16:
+ case Depth24:
+ case Depth32:
+ source = GL.GL_DEPTH_COMPONENT;
+     break;   
case Intensity:
case Intensity8:
    source = GL.GL_INTENSITY;
Index: src/com/jme/renderer/lwjgl/LWJGLTextureRenderer.java
===================================================================
--- src/com/jme/renderer/lwjgl/LWJGLTextureRenderer.java (revision 4342)
+++ src/com/jme/renderer/lwjgl/LWJGLTextureRenderer.java (working copy)
@@ -40,10 +40,13 @@
import java.util.logging.Level;
import java.util.logging.Logger;

+import javax.media.opengl.GL;
+
import org.lwjgl.opengl.ARBDrawBuffers;
import org.lwjgl.opengl.ARBTextureFloat;
import org.lwjgl.opengl.EXTFramebufferObject;
import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL14;
import org.lwjgl.opengl.GLContext;

import com.jme.image.Texture;
@@ -282,6 +285,18 @@
    format = GL11.GL_DEPTH_COMPONENT;
    components = GL11.GL_DEPTH_COMPONENT;
    break;
+ case Depth16:
+     format = GL14.GL_DEPTH_COMPONENT16;
+     components = GL.GL_DEPTH_COMPONENT;
+     break;
+ case Depth24:
+     format = GL14.GL_DEPTH_COMPONENT24;
+     components = GL.GL_DEPTH_COMPONENT;
+     break; 
+ case Depth32:
+     format = GL14.GL_DEPTH_COMPONENT32;
+     components = GL.GL_DEPTH_COMPONENT;
+     break;     
case Intensity:
case Intensity8:
    format = GL11.GL_INTENSITY;
@@ -789,6 +804,9 @@
    source = GL11.GL_ALPHA;
    break;
case Depth:
+ case Depth16:
+ case Depth24:
+ case Depth32:
    source = GL11.GL_DEPTH_COMPONENT;
    break;
case Intensity:


This is called with glTexImage2D. A check seems to be necessary, but not only for the depth, also for rgba32f. How do you think about that?

Best,
Andreas

Hi,

at lwjgl i can easily check GLContext.getCapabilities().OpenGL14. At jogl, the test method needs a string (gl.isExtensionAvailable(…)). The string "OpenGL14" does not work. What would be the correct extensions for depthXX and for rgba32f textures?



Best,

Andreas

you can check in other existing JOGL implementations how checks are done.

for example:

http://code.google.com/p/jmonkeyengine/source/browse/trunk/src/com/jme/scene/state/jogl/JOGLTextureState.java

Hi,

with "GL_VERSION_1_4", gl.isExtensionAvailable(…) is working. Then JOGLContextCapabilities should also be updated. If I added the checks, I will post a new patch.



Thx,

Andreas

Hi,

here is the patch: http://www.lichtundliebe.info/projects/patchDepth.txt. I also formated the source code. That’s why it’s a bit bigger.



Best,

Andreas

its hard to see what has changed if everything is rereformatted, also it seems you use tab instead 4 spaces for indenting, can you change that?

see http://www.jmonkeyengine.com/wiki/doku.php?id=development_conventions


please look again at http://www.lichtundliebe.info/projects/patchDepth.txt. i changed my eclipse settings and removed the formatting.

Hi,

I'm now a member of the jme2 project and I tryed to commit my changes. With subclipse, I used my google user name and the generated password of google code. But, it did not work:


commit -m "" C:/Dokumente und Einstellungen/Andreas/Eigene Dateien/workspace/jME2/src/com/jme/image/Texture.java
    Authorization failed
svn: Commit failed (details follow):
svn: MKACTIVITY of '/svn/!svn/act/7247e0e9-6104-6740-8f02-f7db493388f0': authorization failed (http://jmonkeyengine.googlecode.com)


Do you know why? Do I have really write access?

Best,
Andreas

you need to use the https:// url to be able to commit

Thank you! I successfully committed the code.



Best,

Andreas