Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualSollum

Posted 17 June 2013 - 11:46 AM

Could you please explain your code a little bit?

 

What is a "rubber_SHADER"? I am taking a guess it's a vertex shader.

 

In render part, why do you re add "rubber_SHADER" each draw?

By "draw call" you mean "GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, 6);"?

 

My fragment shader looks like this

final String fragmentShader =
	"precision mediump float;\n"

	+ "uniform vec3 u_LightPos;\n"
	+ "uniform sampler2D u_Texture;\n"
	+ "uniform vec4 u_Color;\n"

	+ "varying vec4 v_Color;\n"
	+ "varying vec2 v_TexCoordinate;\n"

	+ "void main()\n"
	+ "{\n"
	+ "    gl_FragColor = u_Color * (v_Color * texture2D(u_Texture, v_TexCoordinate));\n"
	+ "}\n";

And if i try

int i_test = GLES20.glGetUniformLocation(fragmentShaderHandle, "u_Color");

i get -1

 

By the way, actual version does not use

+ " gl_FragColor = u_Color * (v_Color * texture2D(u_Texture, v_TexCoordinate));\n"

but

+ " gl_FragColor = (v_Color * texture2D(u_Texture, v_TexCoordinate));\n"

 

Otherwise screen will go black. since u_Color is all 0's, but i can't access it :(


#1Sollum

Posted 17 June 2013 - 11:44 AM

Could you please explain your code a little bit?

 

What is a "rubber_SHADER"? I am taking a guess it's a vertex shader.

 

In render part, why do you re add "rubber_SHADER" each draw?

By "draw call" you mean "GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, 6);"?

 

My fragment shader looks like this

final String fragmentShader =
	"precision mediump float;\n"

	+ "uniform vec3 u_LightPos;\n"
	+ "uniform sampler2D u_Texture;\n"
	+ "uniform vec4 u_Color;\n"

	+ "varying vec4 v_Color;\n"
	+ "varying vec2 v_TexCoordinate;\n"

	+ "void main()\n"
	+ "{\n"
	+ "    gl_FragColor = u_Color * (v_Color * texture2D(u_Texture, v_TexCoordinate));\n"
	+ "}\n";

And if i try

int i_test = GLES20.glGetUniformLocation(fragmentShaderHandle, "u_Color");

i get -1


PARTNERS