lab #1: computer graphics framework igx is a set of programs which allow you to write graphics...

11
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.

Upload: lee-whitehead

Post on 22-Dec-2015

213 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 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

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.

Page 2: 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

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.

Page 3: 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

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.

Page 4: 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

written in C/C++

calls libraries

Page 5: 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

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 .”

Page 6: 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

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.

Page 7: 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

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.

Page 8: 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

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.

Page 9: 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

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.

Page 10: 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

After you type “run .” you should get this! …. Example from lab #2.

Page 11: 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

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?