Results 1 to 2 of 2

Thread: Tessellation and Selection

  1. #1
    Member Contributor
    Join Date
    Oct 2006
    Posts
    83

    Tessellation and Selection

    Hello all. I am using GLUTessellation and the GL_SELECT mode and am getting some strange results. Whenever I process the "hits" I always get 1. I was wondering if the tessellation could be causing the problem?

    Below is some snippets of my code:
    Code :
    ...
    int[] viewport = new int[4];
    int hits = 0;
    gl.glGetIntegerv(GL.GL_VIEWPORT, viewport, 0);
    gl.glSelectBuffer(selectionBuffer.capacity(), selectionBuffer);
    gl.glRenderMode(GL.GL_SELECT);
    this.mode = GL.GL_SELECT;
    gl.glInitNames();
    glu.gluPickMatrix((double)this.mouseX, (double)(viewport[3] - this.mouseY), 10.0d, 10.0d, viewport, 0);
     
    // Render the Model
    draw(gl);
     
    hits = gl.glRenderMode(GL.GL_RENDER);
    this.mode = GL.GL_RENDER;
    The draw(GL gl) Method is where the actual Model is rendered:
    Code :
    GLU glu = new GLU();
    tessellCallBack tessCallback = new tessellCallBack(gl, glu);
    GLUtessellator tobj = glu.gluNewTess();
    glu.gluTessCallback(tobj, GLU.GLU_TESS_VERTEX, tessCallback);
    glu.gluTessCallback(tobj, GLU.GLU_TESS_BEGIN, tessCallback);
    glu.gluTessCallback(tobj, GLU.GLU_TESS_END, tessCallback);
    glu.gluTessCallback(tobj, GLU.GLU_TESS_ERROR, tessCallback);
    glu.gluTessCallback(tobj, GLU.GLU_TESS_COMBINE, tessCallback);
    // A Vector of Polygon Faces (these are what I would like to
    // set on the NAME Stack for selection
    Vector faces = sd.getFaces();
    for (int i = 0; i < faces.size(); i++) {
        face = (FaceData)faces.get(i);
        // Vector of "holes" in Polygon
        holes = face.getHoles();
        if (this.mode == GL.GL_SELECT) {
            // We are in the SELECTION Mode, so push this identity
            // on the current NAME Stack
            gl.glPushName(i);
        }
        glu.gluTessBeginPolygon(tobj, null);
        glu.gluTessBeginContour(tobj);
        for (int j = 0; j < outPts.length; j++) {
            glu.gluTessVertex(tobj, outPts[j], 0, outPts[j]);
        }
        glu.gluTessEndContour(tobj);
        for (int j = 0; j < holes.size(); j++) {
            poly = (PolyData)holes.get(j);
            double[][] holePts = poly.getPtsArray();
            glu.gluTessBeginContour(tobj);
            for (int k = 0; k < holePts.length; k++){
                glu.gluTessVertex(tobj, holePts[k], 0, holePts[k]);
            }
            glu.gluTessEndContour(tobj);
        }
        glu.gluTessEndPolygon(tobj);
        if (this.mode == GL.GL_SELECT) {
            gl.glPopName();
        }
    }// End of OUTER FOR-LOOP
    glu.gluDeleteTess(tobj);
    Thanks in advance for ANY help/hints. I am fairly new to OpenGL and needless to say, selection seems pretty difficult at this point.

  2. #2
    Member Contributor
    Join Date
    Oct 2006
    Posts
    83

    Re: Tessellation and Selection

    anyone?

Similar Threads

  1. Tessellation shaders: more control over the actual tessellation?
    By Ailurus in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 12-17-2015, 03:57 PM
  2. Tessellation
    By imported_JoshKlint in forum OpenGL: Advanced Coding
    Replies: 7
    Last Post: 09-14-2010, 06:43 PM
  3. Tessellation!
    By Makinis in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 06-29-2009, 03:59 AM
  4. Tessellation
    By JeffBozeman in forum OpenGL: Windows
    Replies: 3
    Last Post: 04-04-2004, 08:33 PM
  5. Is using selection buffer for selection or picking slow?
    By mohsin in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 04-11-2001, 03:56 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