Jump to content

View more

Image of the Day

Adding some finishing touches...
Follow us for more
#screenshotsaturday #indiedev... by #MakeGoodGames https://t.co/Otbwywbm3a
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Alpha picking in opengl

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 gnomgrol   Members   

699
Like
0Likes
Like

Posted 04 February 2013 - 04:33 AM

Hello there,

I am currently in charge of building an opengl-renderer for a little gamestudio at my university. 

Currently I am trying to implement alphapicking, which is causing me some problems. We are using openGL with GLKit. 

The game is mostly 2D, and therefor all objects are planes with textures mapped onto them. When I pick, I need to be able to determine if the picked pixel has an alphavalue < 0.1 to not have it picked then. I tried glReadPixels(...), but the returnvalues are pretty strange. The openGL selectionmode does not really help me either, since it does not apply alphachannels (does it?).

What is the basic way to do it?

 

Thanks!



#2 Ashaman73   Members   

13715
Like
1Likes
Like

Posted 04 February 2013 - 04:46 AM

I tried glReadPixels(...), but the returnvalues are pretty strange

Can you describe what pretty strange means ?

I use glReadPixels to do picking. You should ensure, that you pick the right buffer (front/back) and this only after the rendering has been finished (e.g. pick from front buffer buffer has been swapped).


Edited by Ashaman73, 04 February 2013 - 04:48 AM.

Ashaman

 

Gnoblins: Website - Facebook - Twitter - Youtube - Steam Greenlit - IndieDB - Gamedev Log


#3 gnomgrol   Members   

699
Like
0Likes
Like

Posted 05 February 2013 - 10:51 AM

What you mentioned was exactly the problem, tfixed it! Thanks!






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.