How to make basic line segments in LWJGL / OpenGL

I participate in the learning process of LWJGL as well as OpenGL. I made ATV textbooks and also successfully drew polygons on the display. I'm trying to draw lines using the same methods, but no lines are created or are they invisible, possibly with a pixel width of 0? I have googled for an answer or a tutorial, but so far they all seem to be saying 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 in the middle, but no effect.

 GL11.glLineWidth(3.8f); 
+4
source share
1 answer

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

+3
source

Source: https://habr.com/ru/post/1395925/


All Articles