Archived

This topic is now archived and is closed to further replies.

glTexSubImage2D problems

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

Recommended Posts

the following code is used to draw a black transparent square hole into a 2d (to simulate bits of level getting blown up!). the problem is: the level remains unchanged
  //vars: l, r, t, b (left, right, top, bottom) are long''s and are definately within the bounds of the texture unsigned char* pixel = NULL; for(int x=l; xBytes[(y*m_image->Width*m_image->BytesPerPixel) + (x*m_image->BytesPerPixel)]; *(pixel+0) = 0; *(pixel+1) = 0; *(pixel+2) = 0; *(pixel+3) = 0; } } glBindTexture(GL_TEXTURE_2D, m_maintexture); glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_image->Width, m_image->Height, GL_RGBA, GL_UNSIGNED_BYTE, m_image->Bytes); //gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, m_image->Width, m_image->Height, GL_BGRA_EXT, GL_UNSIGNED_BYTE, m_image->Bytes); 
if i use the commented gluBuild2DMipMaps line instead of texsubimage, it works (but is slooooow) which verifies the validity of m_image. im not concerned with any optimisations for now - just getting it working at a decent speed (ie not using build2dmips func).

Share on other sites
You do not have width and height the power of two in glTexSubImage2D so that does not verify the validity of m_image.

Share on other sites
no need to be powers of 2
ill say you''re doing someit wrong with the pointers
are both textures RGBA ones?

http://members.xoom.com/myBollux

1. 1
Rutin
36
2. 2
3. 3
4. 4
5. 5

• 12
• 14
• 9
• 9
• 14
• Forum Statistics

• Total Topics
633345
• Total Posts
3011441
• Who's Online (See full list)

There are no registered users currently online

×