mithun_daa
06-11-2004, 12:20 PM
hello everyone
i have a routine that draws some stuff in a 2d projection and i read the frame buffer to get the image. whatz happening is sometimes it works fine and sometimes it just reads 0s. it alwayz works if i step thru the code in debug mode. any help would be appreciated
glPushAttrib amAllAttribBits
'set projection to 2D othro to draw the vector image overlay and take a snapshot
glMatrixMode mmProjection
glPushMatrix
glLoadIdentity
gluOrtho2D dblTempXMin, dblTempXMax, dblTempYMin, dblTempYMax
'clear buffers
glClearColor 0, 0, 0, 1
glClear clrColorBufferBit
............... Draw the 2d polygon .....
'read the back buffer
glReadBuffer rbmBack
'set the size
lngSize = CLng(mintWidth) * mintHeight * 4
ReDim sngFrameBuff(lngSize)
'read the contents of the framebuffer
glReadPixels 0, 0, mintWidth, mintHeight, rpRGBA, pxlFloat, sngFrameBuff(0)
'end the OpenGL DL
glFinish
glPopMatrix
glPopAttrib
i have a routine that draws some stuff in a 2d projection and i read the frame buffer to get the image. whatz happening is sometimes it works fine and sometimes it just reads 0s. it alwayz works if i step thru the code in debug mode. any help would be appreciated
glPushAttrib amAllAttribBits
'set projection to 2D othro to draw the vector image overlay and take a snapshot
glMatrixMode mmProjection
glPushMatrix
glLoadIdentity
gluOrtho2D dblTempXMin, dblTempXMax, dblTempYMin, dblTempYMax
'clear buffers
glClearColor 0, 0, 0, 1
glClear clrColorBufferBit
............... Draw the 2d polygon .....
'read the back buffer
glReadBuffer rbmBack
'set the size
lngSize = CLng(mintWidth) * mintHeight * 4
ReDim sngFrameBuff(lngSize)
'read the contents of the framebuffer
glReadPixels 0, 0, mintWidth, mintHeight, rpRGBA, pxlFloat, sngFrameBuff(0)
'end the OpenGL DL
glFinish
glPopMatrix
glPopAttrib