Talus
09-19-2010, 12:31 PM
Ive managed to get my shaders working with normals, color and basic positioning, but textures dont want to work so far. Ive stripped the shaders down to just the texture parts and posted them below.
The result Im getting is just black- Ive seen that it is getting through the whole bitmap loading process, and I know the bitmap file itself works fine with Opengl. Ive used the same bmp with the same loading code in another opengl program without shaders. I dont know that the texture coordinates are correct but I tried them as color to check that they are indeed holding varied information so I think they are correct. The solid black suggests to me that the texture information isnt getting through though...
...
texture = TextureLoad("rock.bmp", GL_FALSE, GL_LINEAR, GL_LINEAR, GL_REPEAT);
int texture_location = glGetUniformLocation(p, "myTexture");
glUniform1i(texture_location, texture);
...
// vertex shader
void main()
{
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = ftransform();
}
//Fragment shader
uniform sampler2D myTexture;
void main()
{
//Texture
gl_FragColor = texture2D(myTexture, gl_TexCoord[0].st);
}
Is there any problem with these sections?
The result Im getting is just black- Ive seen that it is getting through the whole bitmap loading process, and I know the bitmap file itself works fine with Opengl. Ive used the same bmp with the same loading code in another opengl program without shaders. I dont know that the texture coordinates are correct but I tried them as color to check that they are indeed holding varied information so I think they are correct. The solid black suggests to me that the texture information isnt getting through though...
...
texture = TextureLoad("rock.bmp", GL_FALSE, GL_LINEAR, GL_LINEAR, GL_REPEAT);
int texture_location = glGetUniformLocation(p, "myTexture");
glUniform1i(texture_location, texture);
...
// vertex shader
void main()
{
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = ftransform();
}
//Fragment shader
uniform sampler2D myTexture;
void main()
{
//Texture
gl_FragColor = texture2D(myTexture, gl_TexCoord[0].st);
}
Is there any problem with these sections?