Results 1 to 4 of 4

Thread: Performing Color Picking when using Vertex arrays

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2004
    Location
    Greece
    Posts
    10

    Performing Color Picking when using Vertex arrays

    I'm using vertex arrays to draw a Mesh. Additionally I want to be able to select any triangle of the mesh.
    Before switching to Vertex arrays I was painting each triangle of the mesh with a different colour and then using glReadPixels to pick a triangle.
    By switching to vertex arrays, I tried to use a colour array but from what is see this approach paints individual vertices instead of the whole facet. This results in blended colour on the facet and incorrect picking. Changing to the shading model to GL_FLAT is also wrong.

    Is there a way to colour the facets instead of the vertices while using vertex arrays?

    Thank you.
    OpenGL under OpenTK,C#,Visual Studio

  2. #2
    Super Moderator OpenGL Guru imported_dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    3,966

    Re: Performing Color Picking when using Vertex arrays

    Flat shading can work for his, you just need to understand that the final vertex that completes each triangle is the one that determines the solid color.

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2004
    Location
    Greece
    Posts
    10

    Re: Performing Color Picking when using Vertex arrays

    Indeed it worked (thank god I already kept a list with the facets each vertex participates in)!!! Although for some reason my Ray-Triangle intersection point seems little off...

    Anyway, I thank you dorbie
    OpenGL under OpenTK,C#,Visual Studio

  4. #4
    Junior Member Newbie san3Designer's Avatar
    Join Date
    Jul 2010
    Posts
    2

    Re: Performing Color Picking when using Vertex arrays

    I have a related but more basic question:

    Is Color picking the only method for picking objects when using Vertex Arrays/VBO?

    Is there any way to adapt the Names Buffer method to use with VAs?

    I have a general 3D Visualizer already implemented using Vertex Arrays. I need to add picking to it as efficiently as possible.

Similar Threads

  1. Replies: 3
    Last Post: 04-19-2014, 09:47 PM
  2. Vertex Arrays, interleaved arrays, mouseMove func
    By Nibirue in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 02-13-2012, 11:17 AM
  3. Reusing small color array for large vertex arrays
    By Dylan in forum OpenGL: Basic Coding
    Replies: 11
    Last Post: 12-06-2006, 03:42 AM
  4. picking with vertex arrays
    By Kyllan in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 01-18-2002, 01:58 AM
  5. Picking and Vertex arrays
    By hawn in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 10-15-2000, 09:11 PM

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