PDA

View Full Version : Redrawing Lines



SuperNoob
10-22-2009, 01:15 PM
Ok so I'm trying to store vertexes in a linked list so when the screen is cleared the lines disappear but when i click on redraw in the menu the lines come back up. this is what i have in my code, it seems that i cant get them to come back up

This first part is where i actually store the points into the linked list. i tested the code to see if the points were storing and it does


......(more code above that doesn't matter)
public void mousePressed(MouseEvent e)
{
if (gui.getCurrentMode() == "Draw Line")
{
if (num_points == 0)
{
x0 = e.getX();
y0 = e.getY();
list.add(x0);
list.add(y0);
num_points++;
}
else if (num_points == 1)
{
x1 = e.getX();
y1 = e.getY();
list.add(x1);
list.add(y1);
canvas.display();
num_points++;
}
}
......(more code that works the same)


So now to actually draw out the lines here is the code i have.



........
else if (gui.getCurrentMode() == "Redraw Image")
{
gl.glBegin(gl.GL_LINES);
(color code)
gl.glVertex2i(list.get(0), list.get(1));
gl.glVertex2i(list.get(2), list.get(3));
gl.glEnd();
}


i was wondering why nothing shows up when i click on the Redraw image selection when its picked in the menu