PDA

View Full Version : Problems with compressed textures using pixel buffer object



martinsm
05-01-2007, 01:09 PM
Hello.
I'm implementing texture upload using pixel buffer objects. For uncompressed texture formats (RGB8/RGBA8) everything works fine. But with DXT compression I have problem - it doesn't work on my videocard ATI Mobility Radeon X1600 (with Mobile Catalyst v7.4 drivers). On another computer which have Geforce FX 5200 everything works - both compressed and uncompressed textures loads fine.

Here is fragment of code how I load texture:

FILE* f = fopen(name.c_str(), "rb");
fseek(f, offset, SEEK_SET);

GLuint buf;

glGenBuffersARB(1, &buf);
GL_ERROR();

glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, buf);
GL_ERROR();

glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, size, NULL, GL_STATIC_DRAW_ARB);
GL_ERROR();

unsigned char* memory = (unsigned char*)glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, GL_WRITE_ONLY_ARB);
GL_ERROR();

fread(memory, size, 1, f);

glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB);
GL_ERROR();

fclose(f);

glCompressedTexImage2DARB(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 512, 512, 0, size, NULL);
GL_ERROR(); // ***

glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
GL_ERROR();

glDeleteBuffersARB(1, &buf);
GL_ERROR();GL_ERROR() ir macro that checks for OpenGL error using glGetError and displays them. The error I'm getting is GL_INVALID_OPERATION on *** check.

I also tried loading compressed texture without using PBO (like without all these gen/bind/map/del buffer stuff, just using manually allocated memory). Then texture was loaded successfuly on both ATI and Nvidia.

What I am doing wrong? Maybe ATI drivers (or my video card) does not support compressed texture loading from PBO? In PBO extension specs if I recall correctly there is written that glCompressedTextureX should read data from bounded buffer.

Zengar
05-01-2007, 03:20 PM
Sounds like an ATI driver bug. You should probably ask Humus or submit a bug to ATI.