Skip to content Skip to sidebar Skip to footer

how to draw a 3d triangle in opengl

OpenGL Examples

Here are some OpenGL case programs, presented in an social club in which new topics are added in each successive instance. Many of these are modifications of programs in the OpenGL Ruddy Volume.

Triangle

  • Introductory program; just a static motion-picture show of a colored triangle.
  • Shows how to use GLUT.
  • Has minimal structure: simply main() and a brandish callback.
  • Uses only the default viewing parameters (in fact, it never mentions viewing at all). This is an orthographic view volume with premises of -i..1 in all three dimensions.
  • Draws only using glColor and glVertex inside glBegin and glEnd in the brandish callback.
  • Uses only the GL_POLYGON cartoon mode.
  • Illustrates glClear and glFlush.

triangle.cpp

// A simple introductory program; its principal window contains a static motion-picture show // of a triangle, whose iii vertices are reddish, light-green and blue.  The program // illustrates viewing with default viewing parameters only.  #ifdef __APPLE_CC__ #include <GLUT/glut.h> #else #include <GL/glut.h> 

Post a Comment for "how to draw a 3d triangle in opengl"