Skip to main content
GameDev.net gamedev.net
🔒 Locked

Rendermode GL_SELECT and GL_ALPHA_TEST [solved]

Started by -don- Jan 19, 2006 at 6:17 AM 1 replies 850+ views
Original Post
-don-
-don-
Hi! I am encountering problems with the GL_SELECT rendermode in combination with alpha testing... Although no glError is raised when i enable alpha testing in select rendermode, and glGet returns that it is on, the commands seem to be ignored because even when i set the glAlphaFunc to GL_NEVER all pixels are obviously "drawn" because the rendermode returns the same values as if i never used alpha testing.... Thats bad for selecting because my textures use transparency, so my GL_SELECT always returns the name of rectangle drawn and not only the pixels that are not transparent... Red and blue book gave me no clues to this :( Enabled: GL_TEXTURE_2D, GL_ALPHA_TEST Disabled: GL_BLEND I tried with several enabled and disabled states but nothing changed the result. Please help, thanks, don [Edited by - -don- on January 20, 2006 8:25:53 AM]
Brother Bob
Brother Bob
Selection in OpenGL works purely with geometry, and does not involve any fragments at all. If the geometry, after projection, intersects the view volume, a hit is recorded. What you want is a per-fragment selection but OpenGL provides a per-primitive selection. You have to perform the selection another way that takes individual fragments into account.

You could, for example, do it by putting the object ID in the color channel, and render the alpha channel as usual. Then read back the color from the frame buffer, and match the color with an object.
-don-
-don-
ok.. that sounds good. ty
don

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.