[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 352
  • Last Modified:

Drawing lines with OpenGL

I want to draw a simple plain 2D line between two points in a window with VC++ in windows 95. There's no need for anything fancy... but the only requirement is that it has to be very fast and I mean fast. I have tried windows API and the result is moderate. I was wondering if OpenGL can do the same in a faster speed. I would appreciate if someone gives me the source code to draw 2D lines with openGL. I would prefer not using matrices, it eould be better if the line can be crawn by providing two points or by providing only one point and drawing the line form the current position.
Also, can anyone suggest any better method of performing the task?

(A rather long question, isn't it?)
1 Solution
You can vizit www.codeguru.com and
get source code for valid initialization
of OpenGL under Win32.
As concerns lines drawing the code is very simple

glClear(GL_COLOR_BUFFER); //clear screen
glColor3f(1.0,1.0,1.0);//set color
      glVertex2f(x0,y0);//set begin point of line
      glVertex2f(x1,y1);//set end point of line


Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now