A visualization openGl and cpp code for full robotic body model with all parts of the body, their limitations and floor and objects.
sudo apt-get install freeglut3-dev
-
Download the compiled source files Here.
-
Create a new folder in “C:\” directory, and name it “glut”.
-
Inside “C:\glut”, create two new folders with names “include” and “lib”
-
Create a new folder and call it “GL” inside “C:\glut\include”, copy glut.h” from the unzipped file and passed it here. where you should have : C:\glut\include\GL\glut.h
-
Inside “C:\glut\lib” copy “glut.def ” + “glut32.lib” + “glut32.dll” + “README-win32.txt” from the unzipped file and passed it here. where you should have : So: C:\glut\lib\glut.def, C:\glut\lib\glut32.lib, C:\glut\lib\ glut32.dll, C:\glut\lib\ README-win32.txt
-
Start, Control Panel, System, Advanced, Environment Variables
-
In the “Environment Variables” window and under the “system variables” select “path”, then click “edit” and in the “variable value” label add “C:\glut\lib”, then click “Ok”
-
restart your computer to make sure that the windows operating system noticed those changes.
-
Go to Visual Studio and create your C++ project as follow:
- New Project
- Under “Installed” on the left panel; select “Visual C++”, then select “ Win32” ,select from the middle panel “Win32 console application”, rename your project (with a meaningful name, ex: HelloCG), select your path from “Browse”, then click “Ok”.
- In the “Win32 Application Wizard” click “Next”, under “Additional options”select “Empty project”, then click “Finish” From “Solution Explorer” window, right click on “Source Files” and chose “Add” then chose “New Item…”
- From the “Add Existing Item” window, Add files of project.
- Move the data&images folders to the folder of the visual studio project.
- Go to “Project”, then “Properties” and in the “Configuration Properties” in the left panel chose “VC++ Directories”, then from the right panel edit “Include Directories” and browse to add the path of the C:\glut\include, also edit “”Library Directories” and browse to add “C:\glut\lib”.
- We completed the model of the Body and his parts by applying different transformations (Scaling, Rotation, Transformation).
- We animated the model by animated hands, legs, parts of them and its rotated limitations.
- We implement camera movements horizontally and vertically, navigate forward and backward (zoom in +, zoom out -, rotation up ↑, rotation down ↓, rotation right →, rotation left ←)
- We implement the timer function to make the robot interactive without press any key.
- Adding a floor below the robotic body.
- Adding a texture to the floor.
- Having a menu to change the texture of the floor.
- Adding some objects, a scene, to the enviroment.
- Making an animation for the robotic body.
Key | Movement type | Notes |
---|---|---|
8 | Camera rotation up | |
2 | Camera rotation down | |
6 | Camera rotation right | |
4 | Camera rotation left | |
f | move camera forward | |
b | move camera backward | |
W | Start/Stop animation | |
s | Shoulder Rotation | Abduction |
S | Shoulder Rotation | Adduction |
x | Right Shoulder Rotation in z-axis | |
X | Right Shoulder Rotation in z-axis | |
z | Left Shoulder Rotation in z-axis | |
Z | Left Shoulder Rotation in z-axis | |
l | Shoulders Rotation in y-axis | |
L | Shoulders Rotation in y-axis | |
e | elbow Rotation | Flexion |
E | elbow Rotation | Extension |
k | Knee rotation Leg1 | Flexion |
K | Knee rotation Leg1 | Extension |
n | Knee rotation Leg2 | Flexion |
N | Knee rotation Leg2 | Extension |
h | Hip rotation Leg1 | Abduction |
H | Hip rotation Leg1 | Adduction |
i | Hip rotation Leg2 | Abduction |
I | Hip rotation Leg2 | Adduction |
o | Right leg rotation | |
O | Right leg rotation | |
j | Left leg rotation | |
J | Left leg rotation | |
Hands movements:
Foot movements:
Camera movements & Time Function:
- Dealing with glPushMatrix and glPopMatrix functions in openGl confused us. Passed
- We determine the transformation functions, current matrix and stack from the first of the code to the end and solve that.
- The process of placing the objects in their location and maintainng the transformation was challenging and time consuming.
- The Animation that is added to the robot was very hard as we tried to make it look as real as possible.
Mohamed Ahmed
Ismail Tawfik
Note: Source of starter code: source
thanks!