Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


#ActualBrother Bob

Posted 22 July 2013 - 12:23 PM

rubber is this particular shader's name, you didn't say what your shader's name is, so I used rubber.  For instance, rubber_SHADER, iron_SHADER, velvet_SHADER.  It's both a vertex shader and a fragment shader.  The reason I put the "glUseProgram(rubber_SHADER); " in the render loop is because if you have more than one shader, you have to activate the shader that you currently want to use.

 

And 'yes' by draw call I mean -> "GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, 6);"

//=================================================================================

This following part looks wrong to me. int i_test = GLES20.glGetUniformLocation(fragmentShaderHandle, "u_Color"); It looks like you are trying to make the u_Color a uniform specifically for the fragment shader. The way I set things up, all uniforms are available to both the vertex and fragment programs.  To my knowledge, GLSL doesn't make this distinction although Cg does and I assume HLSL does as well.  I suppose it's possible but I've never encountered this so far.  I would try int i_test = GLES20.glGetUniformLocation(ShaderHandle, "u_Color"); instead, but if the uniform is failing in the shader, this test will fail as well I suspect.  Without your full shader initialization code I can't even guess at where the error is coming from.  All I can say is that u_Color is not being initialized properly.


#2marcClintDion

Posted 22 July 2013 - 03:21 AM

There is far too much arrogance and out right abuse by site moderators, they are teaching other people to behave this way.  The posts I've made will all be shorty removed and replaced with this notice.  Game development is not the only thing being taught here, bad behavior is being taught as well.


#1marcClintDion

Posted 17 June 2013 - 03:12 PM

rubber is this particular shader's name, you didn't say what your shader's name is, so I used rubber.  For instance, rubber_SHADER, iron_SHADER, velvet_SHADER.  It's both a vertex shader and a fragment shader.  The reason I put the "glUseProgram(rubber_SHADER); " in the render loop is because if you have more than one shader, you have to activate the shader that you currently want to use.

 

And 'yes' by draw call I mean -> "GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, 6);"

//=================================================================================

This following part looks wrong to me.    int i_test = GLES20.glGetUniformLocation(fragmentShaderHandle, "u_Color"); It looks like you are trying to make the u_Color a uniform specifically for the fragment shader.   The way I set things up, all uniforms are available to both the vertex and fragment programs.  To my knowledge, GLSL doesn't make this distinction although Cg does and I assume HLSL does as well.  I suppose it's possible but I've never encountered this so far.  I would try int i_test = GLES20.glGetUniformLocation(ShaderHandle, "u_Color"); instead, but if the uniform is failing in the shader, this test will fail as well I suspect.  Without your full shader initialization code I can't even guess at where the error is coming from.  All I can say is that u_Color is not being initialized properly.


PARTNERS