jumps4fun
jumps4fun

Reputation: 4130

How to make basic line segments in LWJGL/OpenGL

I am in the process of learning LWJGL and also OpenGL. I have done the tutorials on quads, and also succesfully drawn polygons on a display. I am trying to draw lines using the same methods, but the lines are not created, or they are made invisible, possibly with a pixel width of 0? I have googled for an answer or a tutorial, but so far all of them seems to claim that I am doing the right thing. my method is as follows:

private void drawLine(Point point, Joint Point2) {
    GL11.glColor3f(0.0f, 1.0f, 0.2f);
    GL11.glBegin(GL11.GL_LINE);

    GL11.glVertex2d(point.getX(), point.getY());
    GL11.glVertex2d(point2.getX(), point2.getY());
    GL11.glEnd();
}

I also tried to put this one in the middle, but no effect.

GL11.glLineWidth(3.8f);

Upvotes: 4

Views: 7933

Answers (1)

jumps4fun
jumps4fun

Reputation: 4130

As stated in the comments, The answer was that GL11.GL_LINE is not accepted as a constant in this case. GL11.LINE_STRIP however works like a charm.

Upvotes: 4

Related Questions