From b727d5998e7e021e3c7b72727e08a19933c2248c Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 3 Mar 2015 12:34:25 +0100 Subject: [PATCH 1/2] Fixed the swapped bits for Control and Evaluation Shader --- jme3-core/src/main/java/com/jme3/renderer/opengl/GL4.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/renderer/opengl/GL4.java b/jme3-core/src/main/java/com/jme3/renderer/opengl/GL4.java index 9ce4e835f..ce982eebf 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/opengl/GL4.java +++ b/jme3-core/src/main/java/com/jme3/renderer/opengl/GL4.java @@ -39,8 +39,8 @@ import java.nio.IntBuffer; * @author Kirill Vainer */ public interface GL4 extends GL3 { - public static final int GL_TESS_CONTROL_SHADER=0x8E87; - public static final int GL_TESS_EVALUATION_SHADER=0x8E88; + public static final int GL_TESS_CONTROL_SHADER=0x8E88; + public static final int GL_TESS_EVALUATION_SHADER=0x8E87; public static final int GL_PATCHES=0xE; public void glPatchParameter(int count); } From a793c818d6ac5d63928ad52b6c1c702cac15a5ba Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 3 Mar 2015 12:37:54 +0100 Subject: [PATCH 2/2] Renamed the shaders --- .../Materials/Tess/SimpleTess.tsctrl | 26 +++++++++++-------- .../Materials/Tess/SimpleTess.tseval | 26 ++++++++----------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/jme3-testdata/src/main/resources/Materials/Tess/SimpleTess.tsctrl b/jme3-testdata/src/main/resources/Materials/Tess/SimpleTess.tsctrl index 445276e42..3f7074642 100644 --- a/jme3-testdata/src/main/resources/Materials/Tess/SimpleTess.tsctrl +++ b/jme3-testdata/src/main/resources/Materials/Tess/SimpleTess.tsctrl @@ -1,13 +1,17 @@ -layout (quads,equal_spacing,cw) in; - -uniform mat4 g_WorldViewProjectionMatrix; - +layout(vertices=4) out; +out gl_PerVertex{ + vec4 gl_Position; +}gl_out[]; +uniform int m_TessellationFactor; void main(){ - vec3 p0 = mix(gl_in[0].gl_Position.xyz, gl_in[3].gl_Position.xyz, gl_TessCoord.x); - // interpolate in horizontal direction between vert. 1 and 2 - vec3 p1 = mix(gl_in[1].gl_Position.xyz, gl_in[2].gl_Position.xyz, gl_TessCoord.x); - // interpolate in vert direction - vec3 tePosition = mix(p0, p1, gl_TessCoord.y); - gl_Position = g_WorldViewProjectionMatrix * vec4(tePosition, 1); -} + if (gl_InvocationID == 0){ + gl_TessLevelOuter[0]=m_TessellationFactor; + gl_TessLevelOuter[1]=m_TessellationFactor; + gl_TessLevelOuter[2]=m_TessellationFactor; + gl_TessLevelOuter[3]=m_TessellationFactor; + gl_TessLevelInner[0]=m_TessellationFactor; + gl_TessLevelInner[1]=m_TessellationFactor; + } + gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +} \ No newline at end of file diff --git a/jme3-testdata/src/main/resources/Materials/Tess/SimpleTess.tseval b/jme3-testdata/src/main/resources/Materials/Tess/SimpleTess.tseval index 3f7074642..445276e42 100644 --- a/jme3-testdata/src/main/resources/Materials/Tess/SimpleTess.tseval +++ b/jme3-testdata/src/main/resources/Materials/Tess/SimpleTess.tseval @@ -1,17 +1,13 @@ -layout(vertices=4) out; -out gl_PerVertex{ - vec4 gl_Position; -}gl_out[]; -uniform int m_TessellationFactor; +layout (quads,equal_spacing,cw) in; + +uniform mat4 g_WorldViewProjectionMatrix; + void main(){ - if (gl_InvocationID == 0){ - gl_TessLevelOuter[0]=m_TessellationFactor; - gl_TessLevelOuter[1]=m_TessellationFactor; - gl_TessLevelOuter[2]=m_TessellationFactor; - gl_TessLevelOuter[3]=m_TessellationFactor; + vec3 p0 = mix(gl_in[0].gl_Position.xyz, gl_in[3].gl_Position.xyz, gl_TessCoord.x); + // interpolate in horizontal direction between vert. 1 and 2 + vec3 p1 = mix(gl_in[1].gl_Position.xyz, gl_in[2].gl_Position.xyz, gl_TessCoord.x); + // interpolate in vert direction + vec3 tePosition = mix(p0, p1, gl_TessCoord.y); + gl_Position = g_WorldViewProjectionMatrix * vec4(tePosition, 1); +} - gl_TessLevelInner[0]=m_TessellationFactor; - gl_TessLevelInner[1]=m_TessellationFactor; - } - gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; -} \ No newline at end of file