0% found this document useful (0 votes)
23 views2 pages

Microproject ComputerGraphics OpenGL

The document outlines a microproject focused on developing a basic computer graphics application using OpenGL to display and rotate a 3D object. It includes software and hardware requirements, implementation details in C, and highlights the advantages of understanding 3D transformations. Future enhancements suggested include adding lighting, keyboard controls, and loading external 3D models.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views2 pages

Microproject ComputerGraphics OpenGL

The document outlines a microproject focused on developing a basic computer graphics application using OpenGL to display and rotate a 3D object. It includes software and hardware requirements, implementation details in C, and highlights the advantages of understanding 3D transformations. Future enhancements suggested include adding lighting, keyboard controls, and loading external 3D models.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Microproject on Computer Graphics

Title: 3D Object Rotation using OpenGL

Objective:

To develop a basic computer graphics application using OpenGL that displays a 3D object (e.g., cube or

pyramid) and applies rotation along different axes (X, Y, Z).

Software Requirements:

- C/C++ Compiler (Turbo C++ / GCC)

- OpenGL Utility Toolkit (GLUT)

- Code Editor (Code::Blocks / Visual Studio Code)

Hardware Requirements:

- Standard PC or Laptop

- Minimum 2 GB RAM

Theory / Working Principle:

OpenGL is an API for rendering 2D and 3D graphics.

Rotation in 3D is achieved using transformation matrices (glRotatef function).

User input can be used to rotate the object interactively (e.g., using keyboard arrows).

Implementation (C with OpenGL):

#include <GL/glut.h>

float angle = 0.0;

void display() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glRotatef(angle, 1.0, 1.0, 0.0);

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

glutSwapBuffers();
}

void timer(int value) {


angle += 1.0f;
if (angle > 360) angle -= 360;
glutPostRedisplay();
glutTimerFunc(16, timer, 0);
}

void init() {
glEnable(GL_DEPTH_TEST);
glClearColor(0.1, 0.1, 0.1, 1.0);
}

int main(int argc, char** argv) {


glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize(500, 500);
glutCreateWindow("3D Object Rotation");
init();
glutDisplayFunc(display);
glutTimerFunc(0, timer, 0);
glutMainLoop();
return 0;
}

Advantages:

- Helps understand the basics of 3D transformations.

- Gives hands-on practice with OpenGL and real-time rendering.

Conclusion:

This project demonstrates real-time 3D object manipulation using OpenGL, enhancing the conceptual

understanding of transformations in computer graphics.

Future Scope:

- Add lighting and shading.

- Allow keyboard control for manual rotation.

- Load 3D models from external files.

You might also like