PDA

View Full Version : Problems with glGetTexImage() & cube maps.



Sergey K.
07-03-2004, 01:59 AM
Trying to save cube maps to file I've written this code:


Procedure tCubeTexture.SaveTextureInInternalFormat(Stream:tS tream);
Var Compressed:Lint;
CompInfo:tCompressionInfo;
CompressedImage:Pointer;
I:Longint;
Begin
Bind(GL_TEXTURE0);

glPixelStorei(GL_UNPACK_ALIGNMENT,1);

// preserve sizes of all compressed faces
For I:=0 To 5 Do Begin
CompInfo.CompressedSizes[I]:=Image.Width*Image.Height*3;
End;

// write headers
Stream.BlockWrite(Image, SizeOf(Image));
Stream.BlockWrite(CompInfo, SizeOf(CompInfo));

// write images
For I:=0 To 5 Do Begin
GetMem(CompressedImage, CompInfo.CompressedSizes[I]);

glGetTexImage(CubeTarget[I], 0, GL_RGB, GL_UNSIGNED_BYTE, CompressedImage);

glFinish();

Stream.BlockWrite(CompressedImage^, CompInfo.CompressedSizes[I]);

FreeMem(CompressedImage);
End;
End;Then I use Photoshop to load the resulting file in a RAW format (Header+512*3072). The result is wrong: i have the same image on all 6 faces of cube map. What might be the problem ?

sqrt[-1]
07-03-2004, 05:32 AM
GLIntercept (see other thread) has this same problem witn ATI drivers. So I guess you are using an ATI?

I was tould this was fixed in 4.6 but have not actually tested it.

(ATI drivers just return the same face no matter what face you request)

Sergey K.
07-03-2004, 09:48 AM
I use Radeon 9500Pro with Catalyst 4.6. I'm going to try 4.7beta, maybe it would help.