I’ve got a display list being called to render some points on the screen. I want the user to press a button, have the display list re-created with the new points and then drawn but this isn’t working.
The points are rendered initially however the list isn’t being redrawn when edited?
public void buildFunctions(GL gl, int function) {
functionList = gl.glGenLists(1);
switch(function) {
case 0 :
{
for (int n=0;n<3142;n++) {
double x=(-1*3.14159)+(n*.002);
dataX [n] = x;
dataY [n] = x*x*x;
}
System.out.println("Y : " + dataY[0]);
gl.glNewList(functionList, GL.GL_COMPILE);
for (float r=0;r<360;r++)
{
gl.glRotated(r,xaxis,yaxis,zaxis);
gl.glBegin(GL.GL_POINTS);
gl.glColor3d (xaxis*.225+(1/(Math.random()%100+1)), yaxis*.225, zaxis*.225+(1/(Math.random()%100+1)));
for(int i = 0; i < dataX.length; i+= 10) {
gl.glVertex3d(dataX[i], dataY[i],0);
}
gl.glEnd();
}
gl.glEndList();
break;
}
case 1:
{
for (int n=0;n<3142;n++) {
double x=(-1*3.14159)+(n*.002);
dataX [n] = x;
dataY [n] = Math.tan(x);
}
System.out.println(dataY[0]);
gl.glNewList(functionList, GL.GL_COMPILE);
for (float r=0;r<360;r++)
{
gl.glRotated(r,xaxis,yaxis,zaxis);
gl.glBegin(GL.GL_POINTS);
gl.glColor3d (xaxis*.225+(1/(Math.random()%100+1)), yaxis*.225, zaxis*.225+(1/(Math.random()%100+1)));
for(int i = 0; i < dataX.length; i+= 10) {
gl.glVertex3d(dataX[i], dataY[i],0);
}
gl.glEnd();
}
gl.glEndList();
break;
}
}
}
Thanks