• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Shaders Shader gm_BaseTexture problems.

X

XMan3

Guest
I've been trying my best to understand this problem. I've read the manuals, and everything I use should be correct, but I keep getting an error.

The error I get is as follows:
Code:
Reading project file... Error compiling vertex shader:
In Shader shader_shader at line 11 : 'gm_BaseTexture' : undeclared identifier
In Shader shader_shader at line 11 : 'texture2D' : no matching overloaded function found
In Shader shader_shader at line 11 : 'r' : field selection requires structure, vector, or matrix on left hand side
Compile Failed - Please check the Compile window for any additional information
My Vertex shader is as follows:
Code:
attribute vec3 in_Position;                  // (x,y,z)
//attribute vec3 in_Normal;                  // (x,y,z)     unused in this shader.
attribute vec4 in_Colour;                    // (r,g,b,a)
attribute vec2 in_TextureCoord;              // u(,v)

varying vec4 v_vColour;

void main() {
    float zz = texture2D(gm_BaseTexture, in_TextureCoord).r;
    
    vec4 object_space_pos = vec4( in_Position.x * 32.0, in_Position.y * 32.0, zz * 32.0, 1.0);
    
    gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
    
    v_vColour = vec4(0, zz / 2.0, zz / 2.0, 1);
}
If it makes any difference, I am using GLSL ES.

As the logs tell, the error is in "texture2D(gm_BaseTexture, in_TextureCoord)", no matter what I change the in_TextureCoord the error persists, but changing gm_BaseTexture has effect, for example using an uniform sampler2D seems to fix the problem but this is not what I wish to use.

Is there a stupid mistake I'm making, or is this something bigger?
 
Top