3-D Cube Transformations in OpenGL
Posted by aditya dani and classified in Computers
Written on in
English with a size of 2.54 KB
Write C++/Java program to draw 3-D cube and perform following transformations on it using OpenGL.
Scaling
#include // Include the GLUT header file
void display (void) {
glClearColor(0.0f, 0.0f, 1.0f, 1.0f); // Clear the background of our window to blue
glClear(GL_COLOR_BUFFER_BIT); // Clear the colour buffer (more buffers later on)
glLoadIdentity(); // Load the Identity Matrix to reset our drawing locations
glTranslatef(0.3f, 0.3f,-6.0f); // Push everything 5 units back into the scene, otherwise we won't see the primitive
//glScalef(0.5f, 1.0f, 2.0f); // Make the shape half as wide, the same height and twice as deep
glutWireCube(2.0f); // Render the primitive
glLoadIdentity(); // Load the Identity Matrix to reset our drawing locations
glTranslatef(0.0f,... Continue reading "3-D Cube Transformations in OpenGL" »