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 4 of 4

Thread: Frame selection

  1. #1

    Frame selection

    Hi everyone,i have some trouble in frame selection, when i select the primitives in the frame. it just select the visible primitives, but the invisible primitives con'be selected. there is my code,any answer is well received.

    byte[] pixels = new byte[(width * 3) * height];
    gl.ReadBuffer(0x405);
    gl.PixelStorei(0xd05, 1);
    gl.ReadPixels(x, num3, width, height, 0x1907, 0x1401, pixels);
    int num7 = -1;
    int num8 = width * height;
    for (int i = 0; i < num8; i++)
    {
    int index = i * 3;
    int item = (pixels[index] + (pixels[index + 1] << 8)) + (pixels[index + 2] << 0x10);
    if ((item < base.entities.Count) &amp;&amp; (item != num7))
    {
    if (!list.Contains(item))
    {
    list.Add(item);
    }
    num7 = item;
    }
    }

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

    Re: Frame selection

    it just select the visible primitives, but the invisible primitives con'be selected
    How can you select something which is invisible? By invisible do you mean 'was not even rendered'?

  3. #3

    Re: Frame selection

    the invisible primitive means that it is blocked by the visible one.

  4. #4
    Member Regular Contributor
    Join Date
    Aug 2008
    Posts
    456

    Re: Frame selection

    You have to use your own ray-casting code for this, since any data about previously drawn primitives is lost once it has been overwritten. You could use glRenderMode(GL_SELECT) for what you want, but this has been dropped from core OpenGL and can be very slow.

Posting Permissions

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