Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: Getting color of backface vertex

  1. #1
    Intern Contributor
    Join Date
    May 2011
    Location
    Alabama, USA
    Posts
    65

    Getting color of backface vertex

    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?
    Benjamin Barrett aka vindy
    "Our knowledge is finite, while our ignorance is infinite!"

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: Getting color of backface vertex

    Render back faces only ?
    Not sure of what you are trying to do...

  3. #3
    Intern Contributor
    Join Date
    May 2011
    Location
    Alabama, USA
    Posts
    65

    Re: Getting color of backface vertex

    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.
    Benjamin Barrett aka vindy
    "Our knowledge is finite, while our ignorance is infinite!"

  4. #4
    Senior Member OpenGL Pro BionicBytes's Avatar
    Join Date
    Mar 2009
    Location
    UK, London
    Posts
    1,171

    Re: Getting color of backface vertex

    Render the back faces using glCullFace(GL_FRONT)
    Then use glReadPixels to read back the backbuffer to obtain the colour at the screen coordinate.

  5. #5
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: Getting color of backface vertex

    As said, render back faces only (by culling front faces)
    http://www.opengl.org/sdk/docs/man/xhtml/glCullFace.xml

    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.

  6. #6
    Intern Contributor
    Join Date
    May 2011
    Location
    Alabama, USA
    Posts
    65

    Re: Getting color of backface vertex

    Thanks! I wouldn't have thought of that.
    Benjamin Barrett aka vindy
    "Our knowledge is finite, while our ignorance is infinite!"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •