Jump to content
  • Advertisement
Sign in to follow this  
mitchen

rendering methods in OpenGL

This topic is 4869 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

Hi, I need to access the greyvalues of what I have rendered. I have done this using glReadPixels() reading from the framebuffer. The problem is that it's very slow. I would like to know which method can be used to do it much faster. I can create a DIB and render to it directly; or create a PBuffer; or render directly to a texture using WGL extensions etc. ... But which method is the best to acces the greyvalues?

Share this post


Link to post
Share on other sites
Advertisement
anybody with experience on this? What is the best way to access the data bits of what you have rendered? something like a memcopy of these bits to a buffer. It has to work at 30 fps. Any idees? Or is it just not possible?

Share this post


Link to post
Share on other sites
I'm not sure but I think glReadPixels is the fastest way. It does nothing else than copy the memory content of the framebuffer to client memory, so it is naturally slow because it means a transport between the graphics card and CPU. But if you want to work with data you have to do this.
Rendering to a memory DC will need a PFD_DRAW_TO_BITMAP flag instead of PFD_DRAW_TO_WINDOW, and in this case it won't use the graphics card, it will use a software renderer so it will be also slow.

Or if data is suitable for you as a texture, you might try glCopyTexImage2D/glCopyTexSubImage2D, it can be faster than glReadPixels.

Share this post


Link to post
Share on other sites
Maybe look at some of the newer extensions in the 2.0 spec??

There's probably one for rendering your scene to a texture, which seems to be the "new thing". :)

Once that's done, you can then quickly loop through it and grab the pixel information you need.

At least, that's how I would start approaching the problem..

hth,

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!