MedicalVisualization

Open GL Graphic Primitives

OpenGL State | | OpenGL ModelView Transformations

A 3D scene is made up from 3D objects, which are defined by a set of triangles, a so called triangle mesh. Each triangle consists of 3 vertices with associated attributes defined by the actual rendering state. A series of vertices is started with the glBegin() command, whereas it is ended with the glEnd() command:

For example a series of 3 vertices that make up a red triangle is rendered with the following OpenGL commands:

glColor3f(1,0,0);
glBegin(GL_TRIANGLES);
   glVertex3f(0,0.5f,0);
   glVertex3f(-0.5f,-0.5f,0);
   glVertex3f(0.5f,-0.5f,0);
glEnd();

Each glVertex command immediately sends a new point with the actual attributes to the rendering pipeline.

Interpolated triangle with per-vertex color attributes:

glBegin(GL_TRIANGLES);
   glColor3f(1,0,0);
   glVertex3f(0,0.5f,0);
   glColor3f(0,1,0);
   glVertex3f(-0.5f,-0.5f,0);
   glColor3f(0,0,1);
   glVertex3f(0.5f,-0.5f,0);
glEnd();


OpenGL State | | OpenGL ModelView Transformations

Options: