I decided to re-use my topic instead of spam the board since it’s not really that active, so i just edited this.
The following posts were to do with my original problem so it hasn’t been answered yet.
Anyway…
Im having a problem with Picking/Selecting whatever you want to call it, i had it working perfectly but if i want to move the drawing of the model then it dosn’t work.
Here is the method to render the vertices of the model which IS VISIBLE, not the picking method;
public void renderVertices(GL gl)
{
gl.glPushMatrix();
gl.glTranslatef(5f, 0.0f, 0f);
//gl.glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
gl.glDisable(GL.GL_LIGHTING);
gl.glBegin(GL.GL_QUADS);
for (Vertex v : vertices)
{
gl.glColor3f(0.0f, 0.5f, 0.0f);
float xMinus = v.x - 0.01f;
float yMinus = v.y - 0.02f;
float zMinus = v.z - 0.01f;
float xPlus = v.x + 0.01f;
float yPlus = v.y;
float zPlus = v.z + 0.01f;
gl.glVertex3f(xPlus, yPlus, zPlus);
gl.glVertex3f(xPlus, yMinus, zPlus);
gl.glVertex3f(xPlus, yMinus, zMinus);
gl.glVertex3f(xPlus, yPlus, zMinus);
gl.glVertex3f(xPlus, yPlus, zMinus);
gl.glVertex3f(xPlus, yMinus, zMinus);
gl.glVertex3f(xMinus, yMinus, zMinus);
gl.glVertex3f(xMinus, yPlus, zMinus);
gl.glVertex3f(xMinus, yPlus, zMinus);
gl.glVertex3f(xMinus, yMinus, zMinus);
gl.glVertex3f(xMinus, yMinus, zPlus);
gl.glVertex3f(xMinus, yPlus, zPlus);
gl.glVertex3f(xMinus, yPlus, zPlus);
gl.glVertex3f(xMinus, yMinus, zPlus);
gl.glVertex3f(xPlus, yMinus, zPlus);
gl.glVertex3f(xPlus, yPlus, zPlus);
gl.glVertex3f(xMinus, yPlus, zMinus);
gl.glVertex3f(xMinus, yPlus, zPlus);
gl.glVertex3f(xPlus, yPlus, zPlus);
gl.glVertex3f(xPlus, yPlus, zMinus);
gl.glVertex3f(xMinus, yMinus, zPlus);
gl.glVertex3f(xMinus, yMinus, zMinus);
gl.glVertex3f(xPlus, yMinus, zMinus);
gl.glVertex3f(xPlus, yMinus, zPlus);
}
gl.glEnd();
gl.glPopMatrix();
gl.glEnable(GL.GL_LIGHTING);
}
Picking works perfectly if i take out the translation and rotation parts.
Here is the method for rendering the vertices using picking, i have made it so that it performs a loop so i can set the “names” for each vertice by doing;
gl.glPushName(index);
model.renderVertice(index, gl);
gl.glPopName();
index being the variable of the for statement.
So anyway, here is the picking rendering method;
public void renderVertex(int index, GL gl)
{
gl.glDisable(GL.GL_LIGHTING);
gl.glPushMatrix();
gl.glTranslatef(5f, 0.0f, 0f);
//gl.glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
Vertex v = vertices[index];
gl.glBegin(GL.GL_QUADS);
float xMinus = v.x - 0.01f;
float yMinus = v.y - 0.02f;
float zMinus = v.z - 0.01f;
float xPlus = v.x + 0.01f;
float yPlus = v.y;
float zPlus = v.z + 0.01f;
gl.glVertex3f(xPlus, yPlus, zPlus);
gl.glVertex3f(xPlus, yMinus, zPlus);
gl.glVertex3f(xPlus, yMinus, zMinus);
gl.glVertex3f(xPlus, yPlus, zMinus);
gl.glVertex3f(xPlus, yPlus, zMinus);
gl.glVertex3f(xPlus, yMinus, zMinus);
gl.glVertex3f(xMinus, yMinus, zMinus);
gl.glVertex3f(xMinus, yPlus, zMinus);
gl.glVertex3f(xMinus, yPlus, zMinus);
gl.glVertex3f(xMinus, yMinus, zMinus);
gl.glVertex3f(xMinus, yMinus, zPlus);
gl.glVertex3f(xMinus, yPlus, zPlus);
gl.glVertex3f(xMinus, yPlus, zPlus);
gl.glVertex3f(xMinus, yMinus, zPlus);
gl.glVertex3f(xPlus, yMinus, zPlus);
gl.glVertex3f(xPlus, yPlus, zPlus);
gl.glVertex3f(xMinus, yPlus, zMinus);
gl.glVertex3f(xMinus, yPlus, zPlus);
gl.glVertex3f(xPlus, yPlus, zPlus);
gl.glVertex3f(xPlus, yPlus, zMinus);
gl.glVertex3f(xMinus, yMinus, zPlus);
gl.glVertex3f(xMinus, yMinus, zMinus);
gl.glVertex3f(xPlus, yMinus, zMinus);
gl.glVertex3f(xPlus, yMinus, zPlus);
gl.glEnd();
gl.glPopMatrix();
gl.glEnable(GL.GL_LIGHTING);
}
Like i said, if i don’t add the translation part it works fine, but it’s included in both methods so im not sure why it’s not working.
Thanks for any help.