How to draw a simple Chess Board in OpenGL Computer graphics full descriptive along with code.
Rajeev
Chess Board in OpenGL Computer graphics
Chess board consist of the Black and White boxes with each follows other alternatively. Let build a chess board with computer graphics using OpenGL platform.
First draw the black and the white strips for the board with the draw_BlackArea() and draw_whiteArea() functions. In the functions GL_QUADS is used to form the rectangular shape, while rest is easily understood in the following code. The 6 blocks of GL_QUADS is used as for each faces in the cube.
void draw_BlackArea()
{
glBegin(GL_QUADS);
glColor3f(0.05f,0.05f,0.05f);
glVertex3f(0.0f,0.0f,0.0f);
glVertex3f(1.50f,0.0f,0.0f);
glVertex3f(1.5f,0.3f,0.0f);
glVertex3f(0.0f,0.3f,0.0f);
glEnd();
glBegin(GL_QUADS);
glColor3f(0.05f,0.05f,0.05f);
glVertex3f(0.0f,0.0f,0.0f);
glVertex3f(0.0f,0.0f,-1.5f);
glVertex3f(0.0f,0.3f,-1.5f);
glVertex3f(0.0f,0.3f,0.0f);
glEnd();
glBegin(GL_QUADS);
glColor3f(0.05f,0.05f,0.05f);
glVertex3f(1.5f,0.0f,0.0f);
glVertex3f(1.5f,0.0f,-1.5f);
glVertex3f(1.5f,0.3f,-1.5f);
glVertex3f(1.5f,0.3f,0.0f);
glEnd();
gl…
7 comments
Jim
Aren't all this OpenGL functions deprecated?
Jim
these*
Dhanush Mallya
wher is the main function in this?
Rajeev Kumar Singh
You have to code main function and put all these in asingle projects
Rajeev Kumar Singh
yes but still they are in need for learning
zulker
sir! pls upload n queens using opengl....
vinutha s r
Sir plz send me leaky bucket and tic toe game using opengl my e mail id srvinutha50@gmail.com