I downloaded the file you pointed me to and looked at the source (I couldn’t compile cause I was missing numerous files). I tried using GL_RGB8 and GL_RGBA8 and both fail. The texture is always white
What I am trying to do is take six “snapshots” of a scene to create a cube map for use in Cubic Environment Mapping. I have it working right now by saving the frame buffer with glReadPixels then generating a cubemap texture out of the six textures using gluBuild2DMipmaps.
The only drawback of this method is of course speed, its quite slow. I tried replacing gluBuild2DMipmaps with glTexImage2D but for some odd reason it doesn’t work at all. I made sure that the texture width/height were the same (512x512) and that all 6 textures were the exact same dimensions.
Doesn’t work , both glTexImage2d and glCopyTexImage2d both fail on me (no OpenGL error is reported though), I always get a white texture.
I’m at a loss…
Here is the chunk of code in question:
for I := 0 to 5 do begin
xRot := rot[I, 0];
yRot := rot[I, 1];
Right. Default texture object parameter usemagnification filter GL_LINEAR and minification filter GL_LINEAR_MIPMAP_NEAREST (the general OpenGL texture default). As these are stored with each texture object, you have to set it for each.
This explains why gluBuildMipmaps works.
Also gluBuildMipmaps scales the image to power of two dimensions, if I remember correctly. glTexImage rejects non power of two textures.
For glTexImage a faster way to download texture data is to build the texture object once and then update it with glTexSubImage resp. glCopyTexSubImage (run benchmarks!).
But this is for level 0 texture only. If you need mipmaps, I recommend to write your own scaling algorithm.
Watch out for the recommended clamp mode with cube maps. Haven’t done it myself, but I read GL_CLAMP_TO_EDGE somewhere.
[This message has been edited by Relic (edited 01-24-2001).]