need help with textures
I''m trying to load textures from an array of GLuints in delphi.
Loading the texture data:
{Load from file to Data
...
}
glGenTextures(1, @TexName);
glBindTexture(GL_TEXTURE_2D, TexName);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); //Is this needed?
glTexImage2D(
GL_TEXTURE_2D,
MipMapLevel, //0
GL_RGBA,
Width,
Height,
0,
GL_RGBA,
GL_UNSIGNED_INT,
Data
);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
Where each element in the dynamic array Data is of type:
TTexRGBA = packed record
R, G, B, A: GLuint;
end;
The stuff that is enabled/disabled:
glEnable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
glEnable(GL_TEXTURE_2D);
glEnable(GL_ALPHA_TEST);
glEnable(GL_POLYGON_SMOOTH);
glDisable(GL_LIGHTING);
When I try to render it onto a quad it shows only white (which is the color of the quad) instead of the texture. The texture coordinates should be correct since I copied them from the nehe tutorial. glBindTexture is also called before rendering.
What is wrong?
Thanks
Post the code for texture loading and rendering it with the quad, maybe then we''ll be able to help you.
" Do we need us? "
" Do we need us? "
" Do we need us? "Ionware Productions - Games and Game Tools Development
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement