View Full Version : Getting color of backface vertex
05-04-2011, 06:19 PM
Hi, I'm new here and to OpenGL. My question is this: Is there a way to get the color of a vertex(or point if you will) on a texture that is on one of the backfaces of a polygon?
05-05-2011, 04:52 AM
Render back faces only ?
Not sure of what you are trying to do...
05-05-2011, 07:04 AM
Umm, I'm not sure how else to put it. I've got a cube whose faces are textured. This cube rotates. I want to grab the color at a point that is on one of the backfaces at will. I'm not looking to grab the color of a pixel on the screen but rather a backface vertex that isn't drawn on the screen because you can't see it. I know this is confusing. If you like I will try to explain further.
05-05-2011, 12:01 PM
Render the back faces using glCullFace(GL_FRONT)
Then use glReadPixels to read back the backbuffer to obtain the colour at the screen coordinate.
05-05-2011, 12:07 PM
As said, render back faces only (by culling front faces)
You only need to do that at the moment you need to grab it, and you don't need to show it to the user (don't swap). glReadPixels, then glClear, then back to backface culling, then normal render, then swapbuffers.
05-05-2011, 05:42 PM
Thanks! I wouldn't have thought of that. :)
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.