Hi,
I’m trying to do a very simple vertex shader deforming a mesh according to a texture.
I got a black picture or codea crash with this simple example ( just trying to read color value from texture within vertex shader)
Thanks for your help!
Here is the code:
//
// A basic vertex shader
//
//This is the current model * view * projection matrix
// Codea sets it automatically
uniform mat4 modelViewProjection;
uniform sampler2D texture;
//This is the current mesh vertex position, color and tex coord
// Set automatically
attribute vec4 position;
attribute vec4 color;
attribute vec2 texCoord;
//This is an output variable that will be passed to the fragment shader
varying lowp vec4 vColor;
varying highp vec2 vTexCoord;
void main()
{
//Pass the mesh color to the fragment shader
vColor = color;
vTexCoord = texCoord;
// if I remove the comment from the line below image goes black or codea crash
//vec4 colo=texture2D( texture, texCoord );
//Multiply the vertex position by our combined transform
gl_Position = modelViewProjection * position;
}