LAB #1: Computer Graphics Framework IGX is a set of programs which allow you to write graphics...
-
Upload
lee-whitehead -
Category
Documents
-
view
213 -
download
1
Transcript of LAB #1: Computer Graphics Framework IGX is a set of programs which allow you to write graphics...
LAB #1: Computer Graphics Framework
IGX is a set of programs which allow you to write graphics programs in C/C++ from plain text files.
Benefits:
1. You do not need an IDE like visual studio. (Follows the tradition of early programmers)
2. You can write simple or complex programs.
3. You can write graphics program for modern hardware, including CG Shaders for direct GPU programming.
Example:
void draw3D () { Vector3DF a; // Define a vector a.Set ( 5, 4, 2 ); // Set the vector
glColor3f ( 1, 0, 0 ); // Specify a color to OpenGL
glBegin ( GL_LINES ); // Start drawing lines glVertex3f ( 0, 0, 0 ); // Point A of line glVertex3f ( a.x, a.y, a.z ); // Point B of line glEnd ();
}
This will draw a line from the point 0,0,0 to point 5,4,2.
What does the IGX Framework do?
The underlying programming language is C/C++.This defines the syntax for variables, functions, and loop
The Luna Sandbox is a part of IGX which provides additional objects such as vectors, cameras, and images. Not normally part of OpenGL
OpenGL is a part of IGX which does the low-level work of rendering.Commands are sent to the graphics hardware to make an image appear.
written in C/C++
calls libraries
MinGW – Command line compiler for C/C++
Example of how to run lab02.
Notice that IGX starts the ‘gcc’ compiler, which “builds” your program.”
The only this you need to do is type “run .”
GLUT – Library for simple window management
GLUT is a part of your program code which creates a display window for output.
In this class, you do not need to change this.
GLUT – Library for simple window management
GLUT gives you a function where you can write 3D code.
You only need to write your labs by creating some additional code.
Only the required mini-projectinvolves more programming.
Drawing reference grid is done for you.
OpenGL – Low-level Graphics API library for rendering commands
This is mainly what you will be learning to write.
Calling low-level graphics command which draw images.
Specifies a color
Draws 3 lines, each /w different color, in 3D
Your textbook is the main reference for writing OpenGL.
LUNA Sandbox – A set of libraries for mathematical objects.
OpenGL is primarily for rendering commands.
LUNA Sandbox provides additional objects not found in OpenGL. These include:
- Vectors Vector3DF, Vector4DF- Matrices MatrixF, Matrix4F- 3D Cameras- Images- Meshes- CG Graphics Shaders
Example:
Camera3D my_camera; // Create a 3D CameraVector3DF camera_vec; // Create a vector
camera_vec = camera.getPos (); // Set the vector to thecurrent position of camera.
After you type “run .” you should get this! …. Example from lab #2.
Next week.. Your first OpenGL program!
Lab #2:
How do we draw vectors in 3D?
How might we interact with those vectors using the mouse?