Results 1 to 6 of 6

Thread: Getting color of backface vertex

  1. #1
    Member Contributor
    Join Date
    May 2011
    Location
    Alabama, USA
    Posts
    66

    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,574

    Re: Getting color of backface vertex

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

  3. #3
    Member Contributor
    Join Date
    May 2011
    Location
    Alabama, USA
    Posts
    66

    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,161

    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,574

    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
    Member Contributor
    Join Date
    May 2011
    Location
    Alabama, USA
    Posts
    66

    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!"

Similar Threads

  1. How to get vertex color ?
    By alexnai in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 11-19-2015, 08:30 AM
  2. How to send vertex color to vertex shader?
    By ddguan in forum OpenGL: GLSL
    Replies: 4
    Last Post: 08-01-2014, 08:12 PM
  3. Vertex Color Ranges
    By Vasko in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 07-10-2004, 09:11 PM
  4. Use the same Color for a set of vertex
    By EpSiLoN in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 01-29-2004, 07:17 AM
  5. 1D texture or vertex color?
    By dabeav in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 12-14-2002, 12:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean