Jump to content
  • Advertisement
Sign in to follow this  
MadsGustaf

OpenGL Copying pixels from one region of the buffer to another.

This topic is 3895 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to copy the whole buffer, and then draw it a little misplaced with transparency for special effects on top of the solid buffer. I thought i could achieve this by simply doing this with glCopyPixels():
[source langg = "cpp"]
glLoadIdentity();	 

glColor4f(1.0f, 1.0f, 1.0f, 0.3f);
glCopyPixels(0,0,screen->w,screen->h,GL_COLOR);	 
	
  glDisable(GL_BLEND);
 glDisable(GL_TEXTURE_2D);	
   glColor4f(1.0f, 1.0f, 1.0f, 1.0f);	
   
	//swap the buffer
    SDL_GL_SwapBuffers();

But obviously it is not working, as it does not seem to play any role wether i leave the glCopyPixels() there or not. I am doing this in glOrtho projection using SDL with OpenGL. Thanks in advice!

Share this post


Link to post
Share on other sites
Advertisement
I think you need to set glRasterPos to set the location pixels are copied to.

AFAIK blending and glColour will have no effect on CopyPixels. If I understand what you're trying to do, it sounds like you'd be better rendering to a texture, enabling blending, then rendering a quad with that texture mapped onto it.

Share this post


Link to post
Share on other sites
"I am trying to copy the whole buffer, and then draw it a little misplaced with transparency for special effects on top of the solid buffer"

Sounds like a job for the accumulation buffer!

Share this post


Link to post
Share on other sites
"I am trying to copy the whole buffer, and then draw it a little misplaced with transparency for special effects on top of the solid buffer"

Sounds like a job for the accumulation buffer!

Share this post


Link to post
Share on other sites
mrbastard:
how would i read from the buffer, and then draw it to a texture (read into GLuint?)?

Dolf:
I have not yet come to the chapter discussing OpenGL buffers in my book, so i suspect it being a little over my head just yet :).

Share this post


Link to post
Share on other sites
mrbastard:
how would i read from the buffer, and then draw it to a texture (read into GLuint?)?

Dolf:
I have not yet come to the chapter discussing OpenGL buffers in my book, so i suspect it being a little over my head just yet :).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!