Results 1 to 2 of 2

Thread: selection the 3d objects OpenGL ES 1.1

  1. #1
    Junior Member
    Join Date
    Jul 2010

    selection the 3d objects OpenGL ES 1.1

    Hi there...

    How can I select 3d objects in OpenGL ES 1.1 ?

    My application is for iPhone OS and it works in perspective
    3d and when the user touch in the screen any objects must
    be select or not. The application have boxes, spheres, teapots, tubes,
    torus and others geometric objects.

    In OpenGL I have the solution but in OpenGL ES 1.1 many functions are not suported.

    look de code in OpenGL below.

    unsigned int obj_sel(const int max, unsigned int buffer[])
    float menor_z = 1.0;
    unsigned int menor = 0;
    unsigned int *ptr = buffer;

    for (int i = 0; i < max; ++i)
    *ptr++; float zmin = (float)*ptr++ / 0xffffffff; *ptr++;
    if (zmin < menor_z){ menor = *ptr; menor_z = zmin;} ptr++;

    return menor;

    unsigned int select_object()
    int viewport[4];
    unsigned int select[3000];

    glSelectBuffer(3000, select); glRenderMode(GL_SELECT);
    glInitNames(); glPushName(0); glMatrixMode(GL_PROJECTION);

    glGetIntegerv(GL_VIEWPORT, viewport); glLoadIdentity();
    gluPickMatrix((double)x, (double)viewport[3] - y, 1.0, 1.0, viewport);
    gluPerspective(45.0, (float)480 / (float)320, 1.0, 1000.0);
    glMatrixMode(GL_MODELVIEW); draw_scene(true); glMatrixMode(GL_PROJECTION);

    glMatrixMode(GL_MODELVIEW); glFlush(); int max = glRenderMode(GL_RENDER);
    return obj_sel(max, select);

    it not work very well in OpenGL ES 1.1 because
    glSelectBuffer(), glRenderMode(GL_SELECT),
    glInitNames(), glPushName() and glLoadName() are not supported

    I have finding in web sites for (picking, selection in OpenGL ES...)
    but no results. Someone know where can I find it ?
    maybe books, web sites, links or tutorials... any help will be usefull... thanks to all...

  2. #2
    Senior Member
    Join Date
    May 2010
    Toronto, Canada

    Re: selection the 3d objects OpenGL ES 1.1

    I believe that the usual way to accomplish this is by rendering each "object" in a different solid color, then calling glReadPixels() in the area where you want to pick the object and the which color(s) you get in that area will indicate the objects that are visible.

    The other way to do this involves ray casting, which is probably overkill for what you want.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

Similar Threads

  1. Replies: 5
    Last Post: 01-29-2013, 07:58 AM
  2. Selection 3d objects OpenGL ES 1.x
    By lacasrac in forum OpenGL ES
    Replies: 1
    Last Post: 04-20-2012, 12:45 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