PDA

View Full Version : problems getting a screen shot



mithun_daa
11-24-2003, 12:22 PM
i have a terrain generated from a ".dem" file. the whole terrain is stored in a display list. what im doing right now to reduce the load and make the app a little faster is, rather then rotating the whole scene, i have a wireframe box that encloses the whole scene which rotates rather then the terrain, while the terrain remains as it is. even this turned out to be real slow. so now im plannin to take a screen shot of the scene just before i start rotating, and im goin to leave the terrain fixed(show the snapshot) and move only the wireframe box to rotate the scene. im trying to use glcopyteximage2d, but all i get is a blank screen. herez the code


glPixelStoref pxsUnpackAlignment, 1
glGenTextures 1, intSnapShot

glReadBuffer rbmFront 'even if i read the back its the same.
glBindTexture glTexture2D, intSnapShot
glTexParameterf glTexture2D, tpnTextureWrapS, GL_CLAMP
glTexParameterf glTexture2D, tpnTextureWrapT, GL_CLAMP
glTexParameterf glTexture2D, tpnTextureMagFilter, GL_LINEAR
glTexParameterf glTexture2D, tpnTextureMinFilter, GL_LINEAR
glTexEnvf tetTextureEnv, tenTextureEnvMode, tepDecal
glCopyTexImage2D GL_TEXTURE_2D, 0, ifRGBA8, 0, 0, tempwidth, tempheight, 0
intI = glGetError()

i think im making an obvious mistake somewhere. also when i try to get the error returned, it returns 1280, i.e GL_INVALID_ENUM - target was not an accepted value. could someone help me out plz.
thank u.

mithun_daa
11-24-2003, 12:28 PM
also, herez the code in the display routine :
glBindTexture glTexture2D, intSnapShot
glBegin bmQuads
glTexCoord2f 0, 0
glVertex2d -500, -500
glTexCoord2f 0, 1
glVertex2d -500, 500
glTexCoord2f 1, 1
glVertex2d 500, 500
glTexCoord2f 1, 0
glVertex2d 500, -500
glEnd
....
..

Relic
11-25-2003, 05:34 AM
Put another glGetError before the code to see if it was nothing else before.
Remember width and height need to be power-of-2 values for anything target except texture rectangles.