This repository contains the practical work developed for the Computer Graphics course (3rd year, Computer Science).
The project is divided into four phases, progressively extending the capabilities of a C++ OpenGL engine and a geometry generator.
- Pedro Manuel Pereira dos Santos
- João Manuel Franqueira da Silva
- David Alberto Agra
- João Pedro da Silva Faria
Each phase builds upon the previous one:
-
Phase 1 – Generator & Engine Basics
- Implemented a generator capable of producing 3D primitives (plane, box, sphere, cone).
- Implemented an engine to read
.3dfiles and render objects to the screen. - Introduced XML parsing for scene description.
- Focus: hierarchical scene construction and first rendering pipeline.
-
Phase 2 – Transformations & Hierarchy
- Extended the engine to support geometric transformations: translation, rotation, scale.
- Allowed hierarchical modeling from XML.
- Added new primitive: torus (used for Saturn’s rings).
- Solar System scene introduced with planets, moons, and rings.
-
Phase 3 – Animation & Bezier Surfaces
- Added support for Catmull-Rom curves (for smooth translations).
- Introduced time-based rotations.
- Implemented Bezier surfaces (generator creates complex geometry like a teapot/comet).
- Transitioned rendering to VBOs for better performance.
- Extended XML with attributes to enable/disable axes and curve drawing.
- Solar System demo with animated orbits and a Bezier comet.
-
Phase 4 – Lighting & Textures
- Generator updated to compute normals and texture coordinates for all primitives (plane, box, sphere, cone, torus, Bezier).
- Engine extended with:
- Lighting (ambient, diffuse, specular, emissive, shininess).
- Texture mapping from image files.
- VBO support for vertices, normals, and texture coordinates.
- Camera improvements: zoom in/out.
- Final Solar System demo:
- Version 1 with only lights.
- Version 2 with realistic textures applied to celestial bodies.
- C++
- OpenGL / GLUT
- TinyXML (for XML parsing)
- GLUT / GLEW (for rendering support)
Each phase contains its own generator and engine programs. To Run on Linux do:
cmake CMakeLists.txt
make- Use the generator to create .3d model files (plane, sphere, torus, Bezier surface, etc.).
- Launch the engine with a given XML scene file to visualize it.
Example:
./generator sphere 1 50 50 sphere.3d
./engine solar_system.xmlThe Solar System is used across all phases as the main test scene:
- Phase 2: static planets + hierarchical moons.
- Phase 3: animated orbits, Catmull-Rom curves, Bezier comet.
- Phase 4: realistic lighting & textures.





