Browse Source

* Fix incorrect format for DepthStencil in TextureUtil (fix potential GL issue)
* Fix tex3DThumb.frag compile error (implicit int -> float conversion)

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9339 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

ShA..Rd 13 years ago
parent
commit
807a3e6fc5

+ 6 - 1
engine/src/lwjgl/com/jme3/renderer/lwjgl/TextureUtil.java

@@ -85,7 +85,7 @@ class TextureUtil {
         setFormat(Format.Depth32F, GL30.GL_DEPTH_COMPONENT32F, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT,         false);
         setFormat(Format.Depth32F, GL30.GL_DEPTH_COMPONENT32F, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT,         false);
         
         
         // Depth stencil formats
         // Depth stencil formats
-        setFormat(Format.Depth24Stencil8, GL30.GL_DEPTH24_STENCIL8, GL11.GL_DEPTH_COMPONENT, GL30.GL_UNSIGNED_INT_24_8, false);
+        setFormat(Format.Depth24Stencil8, GL30.GL_DEPTH24_STENCIL8, GL30.GL_DEPTH_STENCIL, GL30.GL_UNSIGNED_INT_24_8, false);
         
         
         // RGB formats
         // RGB formats
         setFormat(Format.BGR8,       GL11.GL_RGB8,  EXTBgra.GL_BGR_EXT, GL11.GL_UNSIGNED_BYTE, false);
         setFormat(Format.BGR8,       GL11.GL_RGB8,  EXTBgra.GL_BGR_EXT, GL11.GL_UNSIGNED_BYTE, false);
@@ -148,6 +148,11 @@ class TextureUtil {
                     return null;
                     return null;
                 }
                 }
                 break;
                 break;
+            case Depth24Stencil8:
+                if (!caps.OpenGL30){
+                    return null;
+                }
+                break;
             case Luminance16F:
             case Luminance16F:
             case Luminance16FAlpha16F:
             case Luminance16FAlpha16F:
             case Luminance32F:
             case Luminance32F:

+ 5 - 4
engine/src/test/jme3test/texture/tex3DThumb.frag

@@ -5,10 +5,11 @@ uniform float m_InvDepth;
 varying vec2 texCoord;
 varying vec2 texCoord;
 
 
 void main(){
 void main(){
-float depthx=floor(texCoord.x);
-    float depthy=(m_Rows-1.0) - floor(texCoord.y);    
+    float rows = float(m_Rows);
+    float depthx = floor(texCoord.x);
+    float depthy = (rows - 1.0) - floor(texCoord.y);    
     //vec3 texC=vec3(texCoord.x,texCoord.y ,0.7);//
     //vec3 texC=vec3(texCoord.x,texCoord.y ,0.7);//
   
   
-        vec3 texC=vec3(fract(texCoord.x),fract(texCoord.y),(depthy*m_Rows+depthx)*m_InvDepth);//
-    gl_FragColor= texture3D(m_Texture,texC);
+    vec3 texC = vec3(fract(texCoord.x),fract(texCoord.y),(depthy * rows + depthx) * m_InvDepth);
+    gl_FragColor = texture3D(m_Texture, texC);
 }
 }