Game Programming

game programming
Game Programming :: Programming :: General Programming :: Code Examples :: [OpenGL]Drawing a basic triangle - View Topic
Topic Rating: *****
Printable View

Posts: 40
Status: Offline
Gender: Male

Reputation: 0%

[OpenGL]Drawing a basic triangle (11th Jan 08 at 2:10am UTC)
Level: Must have a good understanding of C++ this example is just a small block of code showing you what call you use to draw a triangle to the screen i have left out how to create a OpenGL window

  1. glBegin(GL_TRIANGLES);//call to opengl to darw triangle
  2. glColor3f(1.0, 0.0, 0.0);//sets color of triangle to red
  3. glVertex3f(1.0, -1.0f, 0.0f);
  4. glVertex3f(-1.0, -1.0, 0.0f);
  5. glvertex3f(0.0f, 1.0f, 0.0f);
  6. glEnd();//end of call to opengl

so there you have how to call OpenGL to draw a triangle to the screen before you can do this you must create a OpenGL window
witch requires some understanding of the Win32 API
 Printable View

All times are GMT+0 :: The current time is 9:14pm
Page generated in 0.0953 seconds
Purchase Ad-Free Credits
This Forum is Powered By vForums (v2.4)
Create a Forum for Free | Find Forums