aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorphil <[email protected]>2016-12-20 10:24:52 +1300
committerphil <[email protected]>2016-12-20 10:24:52 +1300
commitaccb57ec382460665eef74654154b8f3b698e1b1 (patch)
tree28f86a3b2e14a0cc5196d2f285be8c87c98ed2ef /src/main/java
parentf335553b084203e03789646ffc225250d0e512e4 (diff)
Jogl2es2pipeline: ignoreVertexColors load into shader was buggy
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java b/src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java
index afd5a7a..c82494f 100644
--- a/src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java
+++ b/src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java
@@ -286,7 +286,7 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline
ProgramData pd = ctx.programData;
LocationData locs = pd.programToLocationData;
- setFFPAttributes(ctx, gl, shaderProgramId, pd, vformat);
+ setFFPAttributes(ctx, gl, shaderProgramId, pd, vformat, ignoreVertexColors);
int stride = 0, coordoff = 0, normoff = 0, coloroff = 0, texCoordoff = 0;
int texSize = 0, texStride = 0;
@@ -1000,7 +1000,7 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline
ProgramData pd = ctx.programData;
LocationData locs = pd.programToLocationData;
- setFFPAttributes(ctx, gl, shaderProgramId, pd, vdefined);
+ setFFPAttributes(ctx, gl, shaderProgramId, pd, vdefined, ignoreVertexColors);
// If any buffers need loading do that now
GeometryData gd = loadAllBuffers(ctx, gl, geo, ignoreVertexColors, vertexCount, vformat, vdefined, fverts, vfcoords, dverts,
@@ -1558,7 +1558,7 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline
ProgramData pd = ctx.programData;
LocationData locs = pd.programToLocationData;
- setFFPAttributes(ctx, gl, shaderProgramId, pd, vformat);
+ setFFPAttributes(ctx, gl, shaderProgramId, pd, vformat, ignoreVertexColors);
int stride = 0, coordoff = 0, normoff = 0, coloroff = 0, texCoordoff = 0;
int texSize = 0, texStride = 0;
@@ -2297,7 +2297,7 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline
ProgramData pd = ctx.programData;
LocationData locs = pd.programToLocationData;
- setFFPAttributes(ctx, gl, shaderProgramId, pd, vdefined);
+ setFFPAttributes(ctx, gl, shaderProgramId, pd, vdefined, ignoreVertexColors);
// If any buffers need loading do that now
GeometryData gd = loadAllBuffers(ctx, gl, geo, ignoreVertexColors, vertexCount, vformat, vdefined, fverts, vfarray, dverts,
@@ -2911,7 +2911,7 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline
* @param vdefined
*/
- private static void setFFPAttributes(Jogl2es2Context ctx, GL2ES2 gl, int shaderProgramId, ProgramData pd, int vdefined)
+ private static void setFFPAttributes(Jogl2es2Context ctx, GL2ES2 gl, int shaderProgramId, ProgramData pd, int vdefined, boolean ignoreVertexColors)
{
LocationData locs = pd.programToLocationData;
@@ -3089,18 +3089,30 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline
if (locs.ignoreVertexColors != -1)
{
// vertex colors MUST be ignored if no glColors set
- boolean ignoreVertexColors = (!floatColorsDefined && !byteColorsDefined) || ctx.renderingData.ignoreVertexColors == 1;
+ boolean finalIgnoreVertexColors = (!floatColorsDefined && !byteColorsDefined) || ctx.renderingData.ignoreVertexColors == 1;
+
+ //TODO: the execute calls all have a separate ignore vertex colors bool, but it appears to add no value?
+ // is it just a legacy artifact of some sort?
+ /*if(finalIgnoreVertexColors != ignoreVertexColors )
+ {
+ System.out.println("odd mismatch I wonder about why ");
+ System.out.println("finalIgnoreVertexColors " +finalIgnoreVertexColors+ " ignoreVertexColors " +ignoreVertexColors);
+ System.out.println("ctx.renderingData.ignoreVertexColors " +ctx.renderingData.ignoreVertexColors);
+ System.out.println("floatColorsDefined " +floatColorsDefined);
+ }*/
+
+ int finalIgnoreVertexColorsInt = finalIgnoreVertexColors ? 1 : 0;
//note ctx.gl_state.ignoreVertexColors can be -1 for not set
if (!MINIMISE_NATIVE_CALLS_FFP || (shaderProgramId != ctx.prevShaderProgram
- || ctx.gl_state.ignoreVertexColors != ctx.renderingData.ignoreVertexColors))
+ || ctx.gl_state.ignoreVertexColors != finalIgnoreVertexColorsInt))
{
- gl.glUniform1i(locs.ignoreVertexColors, ignoreVertexColors ? 1 : 0);// note local variable used
+ gl.glUniform1i(locs.ignoreVertexColors, finalIgnoreVertexColorsInt);// note local variable used
if (DO_OUTPUT_ERRORS)
outputErrors(ctx);
if (MINIMISE_NATIVE_CALLS_FFP)
- ctx.gl_state.ignoreVertexColors = ctx.renderingData.ignoreVertexColors;
+ ctx.gl_state.ignoreVertexColors = finalIgnoreVertexColorsInt;
}
}