PDA

View Full Version : why the glGetTexImage() can not work with glCopyTexSubImage2D()?



pango
02-08-2004, 05:25 AM
My app render a image in a pbuffer,and then use glCopyTexSubImage2D() copy pixels to a texture,finally use glGetTexImage() to read the texture image to system memory.I found the glGetTexImage() is very very slow,my texture's size is 1024*1024,read it back by glGetTexImage() will consume about 0.5sc.I also found if I cancel the glCopyTexSubImage2D() and only read the texture's data,the speed is normal.Why glGetTexImage() can not work with glCopyTexSubImage2D()?Below is my render code:

m_pbRender.MakeCurrent();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
DrawSquare(&texPBRender);//draw a textured square in pbuffer
pTexRender->Bind(); //texture that save the image rendered by pbuffer
glCopyTexSubImage2D(GL_TEXTURE_2D,0,0,0,0,0,TEX_WI DTH,TEX_HEIGHT);//just this function make glGetTexImage() very slooow!

m_wndRender.MakeCurrent();//a window render
pTexRender->Bind();
glGetTexImage(GL_TEXTURE_2D,0,GL_BGRA_EXT,GL_UNSIG NED_BYTE,m_pTexData);//get texture image data to system memory,very slow!