How to access the back buffer ?
Hi
I am trying find out how to set the properties of a pixel in the back buffer without going via the various matrices etc.
Found a reference manual/online book where it said that I would have to use:
glPixelStorei(GLenum,GLfloat)
glRasterpos(x1,y1)
glDrawPixels(x2, y2, colormode, float/int/etc, *GLenum?? );
I cant figure out which one of those parameters specify what, as far is i could grasp GLenum was a name but what do you need that for ? And the rasterPos set the position of the pixel, but so does x2 and y2 .. i think.. And why do I have to store the pixel in the memory before storing it in the 3D cards memory ? (I think that is what the glPixelStorei does)
Is there a way you can simply tell OGL to make pixel at position x,y on the screen have the colors r,g,b ? Is this a very complicated task ?
Thanks for any help
My post up, your post down, my site here
Edited by - Jesper T on January 25, 2002 1:50:24 PM
you can use the "glDrawPixels" method. but there is a much easier way. tho, you will be going through the rendering pipeline.
this renders a single point in the middle of the screen (assuming 640x480 resolution).
this method is also good for doing textured fonts, etc. also disable "lighting, depth testing, etc" if they are not needed as this will speed up the rendering process.
if you want detailed information about "glPixelStorei", "glRasterPos2*" and "glDrawPixels" check MSDN or the OpenGL programmers guide. or ask.
Edit: added "glColor4f".
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
Edited by - jenova on January 25, 2002 2:58:29 PM
this renders a single point in the middle of the screen (assuming 640x480 resolution).
glMatrixMode(GL_PROJECTION);glLoadIdentity();glOrtho(0.0, 640.0, 480.0, 0.0, -1.0, 1.0);glMatrixMode(GL_MODELVIEW);glLoadIdentity();glBegin(GL_POINTS); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); // white. glVertex2i(320, 240); // or, wherever you want.glEnd();
this method is also good for doing textured fonts, etc. also disable "lighting, depth testing, etc" if they are not needed as this will speed up the rendering process.
if you want detailed information about "glPixelStorei", "glRasterPos2*" and "glDrawPixels" check MSDN or the OpenGL programmers guide. or ask.
Edit: added "glColor4f".
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
Edited by - jenova on January 25, 2002 2:58:29 PM
OK thanks for your reply. I was actually aware of that method, but I really need all the speed I can get, so I will check up on that OpenGL programmers guide. Thanks.
My post up, your post down, my site here
My post up, your post down, my site here
there are reasons directdraw was dropped with directx8
speed was one of them.
if u want just one pixel use GL_POINTS
if u want an area, update a texture ''glTexSubImage2d(..)'' + draw that to the screen on a polygon (turning off a lot of things as well eg depth testing/lighting/dither etc)
http://uk.geocities.com/sloppyturds/gotterdammerung.html
speed was one of them.
if u want just one pixel use GL_POINTS
if u want an area, update a texture ''glTexSubImage2d(..)'' + draw that to the screen on a polygon (turning off a lot of things as well eg depth testing/lighting/dither etc)
http://uk.geocities.com/sloppyturds/gotterdammerung.html
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement