Hi, I have been trying to make a game using the
Minecraft look , but i have run into some issues regarding the texturing of the cubes.
I'm using
OpenGL and sending the vertex array and index array generated for the
CubicSurfaceExtractor, the new one which don't generate normals.
Now i am trying to get the right texture coordinates using the vertex shader (GLSL), but the closer that i have come to the right answer is this:
The faces are supposed to look exactly the same.
As you can see, the textures are only correctly mapped in the faces who are facing the camera, that is, the z axis.
The code I am using in my shaders is:
Vertex Shader
Code:
#version 110
attribute vec4 gl_Vertex;
uniform mat4 gl_ProjectionMatrix;
void main()
{
gl_Position = ftransform();
gl_TexCoord[0] = gl_Vertex.xyzw;
}
Fragment Shader
Code:
#version 110
uniform sampler2D tex;
void main()
{
gl_FragColor = texture2D(tex, gl_TexCoord[0].st);
}
Thanks to anyone who tries to help me, and forgive me if I can't speak proper English, since I'm not a native speaker