Jump to content
  • Advertisement
Sign in to follow this  
Martin Perry

glCompressedTexImage3D and GL_INVALID_OPERATION

This topic is 2077 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have compressed RGBA 3D texture. If I do  glTexImage3D with internal format set to GL_COMPRESSED_RGBA, I got correct result. I obtain texture from memory via

.

.

glBindTexture(GL_TEXTURE_3D, texture.id);

void * comprData= malloc(texture.compressedSize * sizeof(uint8));

glGetCompressedTexImage(GL_TEXTURE_3D, 0, comprData);

glBindTexture(GL_TEXTURE_3D, 0);

//save comprData to HDD for future use

.

.

Later on, I want to change texture content with already compressed data loaded from HDD, but glCompressedTexImage3D cracsh with GL_INVALID_OPERATION.

I am using NVidia card, so there is (or should be) support for 3D texture compression via their extension.

I am using PBO for texture updates (but also without it, program crash on same gl* function)

.

.

glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, this->pboWrite[this->pboIndexNext]);

glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, textureSize, 0, GL_STREAM_DRAW_ARB);

uint8 * dataPtr = (uint8 *)glMapBufferRange(GL_PIXEL_UNPACK_BUFFER_ARB, 0, textureSize, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);

memcpy(dataPtr, comprData,texture.compressedSize);

glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB);

glBindTexture(GL_TEXTURE_3D, texture.id)

glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, this->pboWrite[this->pboIndex]);

//THIS LINE CRASH WITH GL_INVALID_OPERATION
glCompressedTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, texture.width, texture.height, texture.depth, GL_COMPRESSED_RGBA, GL_UNSIGNED_BYTE, 0)
   
glBindTexture(GL_TEXTURE_3D, 0);

glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);

.

.

If I upload textures without compression, all is working fine

Edited by Martin Perry

Share this post


Link to post
Share on other sites
Advertisement

I have figured it. I messed up format

 

instead of 

.

GL_COMPRESSED_RGBA

.

, there should be

.

GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
Edited by Martin Perry

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!