Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


glCompressedTexImage3D and GL_INVALID_OPERATION


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Martin Perry   Members   -  Reputation: 1342

Like
0Likes
Like

Posted 04 November 2013 - 08:44 AM

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, 04 November 2013 - 08:47 AM.


Sponsor:

#2 Martin Perry   Members   -  Reputation: 1342

Like
1Likes
Like

Posted 07 November 2013 - 04:45 AM

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, 07 November 2013 - 04:46 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS