Jump to content
  • Advertisement
Sign in to follow this  

OpenGL glReadPixels on back buffer only works for positive coordinates

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

[font="Arial"] Hello,

Is it possible to use glReadPixels to read negative coordinates from the OpenGL back buffer? I'm trying to do "color" mouse picking. I created vertices where some have negative coordinates and others have positive coordinates. However when I read pixel colors only the vertices with positive coordinates show the expected colors; all others with negative x or y are read as black.

[/font]For an example/demonstration of the problem, I created a git repository.[font="Arial"] On the "master" branch, glReadPixels always works, because 0,0 is the lowest coordinate. However switch to branch "negative_offset" and run the code again, and see how glReadPixels fails to detect anything with a negative coordinate.[/font]

Thanks for any suggestions

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!