Original Post
I''m having trouble with texturing, when I load and render a texture it only shows the color of the polygon. The loading code (I''m using delphi, could that be a problem?):
glGenTextures(1, @TexName);
glBindTexture(GL_TEXTURE_2D, TexName);
glTexImage2D(
GL_TEXTURE_2D,
0,
GL_RGBA,
Width, //128
Height, //128
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);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
Where Data is a dynamic array of type:
TTexRGBA = packed record
R, G, B, A: GLuint;
end;
For testing I tried to load the texture with glGetTexImage just after loading it. The result is an array of 0s although the data passed to glTexImage2D was ok. glGetError returns 0 and texturing is enabled via glEnable(GL_TEXTURE_2D).
What am I doing wrong?