Professional Documents
Culture Documents
3D Rendering:
A mechanism responsible for producing a 2D
image from 3D models.
the equation x2 + y2 + z2 = r2
is a model of a perfect
sphere with radius r.
Off State
Input devices
Image formed in FB
glBegin (GL_TRIANGLES);
glVertex (0,0,0);
glVertex (1,1,0);
glVertex (2,0,0);
glEnd ();
#include <GL/gl.h>
#include <GL/glu.h>
If we are using GLUT for managing our window
automatically
A Polygon: glBegin(GL_POLYGON);
glVertex2d(x1,y1);
glVertex2d(x2,y2);
glVertex2d(x3,y3);
glVertex2d(x4,y4);
glEnd();
GL_LINES
GL_POLYGON
GL_LINE_STRIP GL_LINE_LOOP
GL_POINTS
GL_TRIANGLES
GL_QUADS
GL_QUAD_STRIP
GL_TRIANGLE_STRIP GL_TRIANGLE_FAN
Prepered By:Yeshanew A. Interactive computer graphics 72
void drawRhombus( GLfloat color[] )
{
glBegin( GL_QUADS );
glColor3fv( color );
glVertex2f( 0.0, 0.0 );
glVertex2f( 1.0, 0.0 );
glVertex2f( 1.5, 1.118 );
glVertex2f( 0.5, 1.118 );
glEnd();
}