Sanctus Animus
01-10-2004, 09:06 PM
Hi, I'm currently programming a kind of "worms" game where projectiles must make holes in the ground. To make this, I found the idea to set the alpha bytes to 0 around the explosion. Right now, I use .png files with RGBA format, and I have now problem showing them on screen. My problem is the fact that after using glGetTexImage in the following part of code, the pixels are not read (the data pointed isn't changed), but I get no glError!
Here is the code, and thanks for your help!
int w,h;
glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTUR E_WIDTH,&w);
glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTUR E_HEIGHT,&h);
GLubyte *pixels = new GLubyte[w*h*4];
glBindTexture(GL_TEXTURE_2D, TexID);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
delete [] pixels;
Here is the code, and thanks for your help!
int w,h;
glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTUR E_WIDTH,&w);
glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTUR E_HEIGHT,&h);
GLubyte *pixels = new GLubyte[w*h*4];
glBindTexture(GL_TEXTURE_2D, TexID);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
delete [] pixels;