I want to use the GL_LINE_STRIP to plot some data, however I’m unable to get the data to appear. If I move the gl.glBegin(GL_LINE_STRIP) and gl.glEnd inside my for loop and run the program my entire sphere object gets turned the color that the line strip to be. If I move the begin and end outside the for loop nothing appears. I have attached some code below.
public void display(){
glj.gljMakeCurrent(); solidSphere();
//wireSphere();
new gl4java_gcitrajectory(gl); //call to class that
//reads data from file
// and tries to plot
gl.glFlush();
}
//----------------------------------------------
// class that is suppose to plot data
//-----------------------------------------------
public class gl4java_gcitrajectory {
public gl4java_gcitrajectory(GLFunc ready) {
try{
//io stuff performed
//-----------------------------------------------------
// trying to plot data in red line_strip
//-----------------------------------------------------
gl.glColor3d(1.0,0.0,0.0);
gl.glBegin(gl.GL_LINE_STRIP);
for(int i = 0; i< numCoords; i++)
{
//System.out.println(“This is the loop”);
gl.glVertex3d(coords[i][0],coords[i][1],coords[i][2]);
}
gl.glEnd();
}