Computer graphics homework

CANCELLED
Bids
0
Avg Bid (USD)
N/A
Project Budget (USD)
$30 - $300

Project Description:
For this assignment, you will write a program to display Bezier curves and surfaces. Structurally, this consists of two components: a simple camera control that will let you position and aim a perspective camera, and code to evaluate Bezier curves and surfaces and then draw them at varying resolutions in OpenGL.

## Deliverables

**Useful links:
**

**http://www.glprogramming.com/red/**

**http://www.swiftless.com/opengltuts.html
**

**Homework #3 OpenGL Bezier Curve/Surface viewer**
**Due: April 19th, 11:59pm**

For this assignment, you will write a program to display Bezier curves and surfaces. Structurally, this consists of two components: a simple camera control that will let you position and aim a perspective camera, and code to evaluate Bezier curves and surfaces and then draw them at varying resolutions in OpenGL.

**Camera Control**

Your camera control should be a simple "crystal ball" interface: the camera will be pointed at the origin and will rotate around it in two directions via the arrow keys. The "z" key should move the camera closer to the origin, and the "x" key should pull the camera away from the origin.

There is a good chance you will use gluLookAt or gluPerspective, though this can be done many different ways (see the Resources page for documentation links: on the posted tutorials, there are some camera movement demos as well. And in the "OpenGL superbible" there are a few places that describe how to do this, most notably Chapter 5.)

For a test object, try calling either glutSolidCube(size) or glutSolidTeapot(size) for a geometric primitive.

In OpenGL, there is no "world" coordinate system: all geometry must be specified in the camera coordinates. In class and in the book, we discussed a "modeling transformation" followed by a "camera transformation" - those two must be combined an applied to your individual pieces of geometry.

The standard way to do that is to set the MODELVIEW matrix to be the inverse of the camera transformation, then multiply in the model transformation, then construct your geometry (cube or teapot in this case). The geometry constructed will automatically pick up the current MODELVIEW transform. Another way of thinking of this is that, instead of moving the geometry to "world" space, and the camera to "world" space, we are moving the geometry to the "world" space and then to the camera space, where OpenGL expects it.

You can set the camera's (inverse) transformation up either by a few called to glRotatef and glTranslatef, or you can use gluLookAt. Examples of both are in the Resources posted. Please remember that the camera is located at (0 0 0) aimed down the -Z axis, with Y being the "up" vector.

The only other part of the puzzle is that of setting up the projection type: this only needs to be done when the window resize is called (i.e. when you end up in the callback function you provided to glutReshapeFunc()). You either call glOrtho here, or gluPerspective, just remember to set the matrix mode (via glMatrixMode ()) to GL_PROJECTION before you do this, and then back to GL_MODELVIEW after (so that when you create your geometry you will be using the MODELVIEW matrix!)

**Bezier Evaluation and Rendering**

You need to implement a bezier curve/surface drawing routine. Bezier curves have already been covered in your reading (Ch. 15) - in particular the de Castlejau algorithm which we will use to evaluate points both on Bezier curves and surfaces. We will discuss them in class as well and go through the steps necessary to evaluate positions and derivatives, which will be necessary for the assignment.

You will read a single file consisting of one or more bezier curves/surfaces, and their associated transforms. The file format is given below.

You are to load in the curves and surfaces, apply their modeling transform (in addition to any viewing transform you have) and then proceed to draw them while allowing the user to adjust the camera. You will provide the following control in addition to those for the camera:

1. Level-of-Detail: typing in a number from 1 to 5 will change the number of lines/triangles representing the surface from very coarse to very fine. (e.g. for a curve, the coarsest would be just the curve endpoints with a straight line between them, and each finer level would be 3 times as many points than the previous level). Once drawn, the segments/triangles do not need to be recalculated again until the resolution is changed - i.e. you can store them in an array and just keep sending them down the pipeline during redraws caused by camera motion, until the next level-of-detail request.

For computing points on the Bezier curves/surfaces, you are to use your *own* evaluation functions, NOT any built-in functions to GL, glu, or glut.

**File Format**

The file format is as follows: the first line states the number of curves and/or surfaces in the file. After that, for each curve or surface there is the following:

* a line with two integers (“u_deg?? and “v_deg??) specifying the degree of the curve/surface in U and V (note: for a curve, the V will always be “0??)
* 4 lines of 4 floats each, specifying the modeling transform that should be applied to this curve/surface
* a series of lines specifying the control points for the Bezier curve or surface. For a curve, there will be (u_deg+1) lines, with one XYZ point per line. For surfaces, there will be (v_deg+1) lines, each with (u_deg+1) columns. In this arrangement, it is expected that U runs from left to right, and V from bottom to top.


**Example Input File**

this file specifies a cubic bezier curve, followed by a degree-3 x degree-2 bezier surface, both with identity transforms:

_
2
3 0
1. 0. 0. 0.
0. 1. 0. 0.
0. 0. 1. 0.
0. 0. 0. 1.
0.0 1.0 1.0
0.0 -1.0 2.0
0.0 1.0 3.0
0.0 -1.0 4.0
3 2
1. 0. 0. 0.
0. 1. 0. 0.
0. 0. 1. 0.
0. 0. 0. 1.
0.0 2.0 0.0 0.0 1.8 1.0 0.0 1.6 2.0 0.0 1.3 3.0
0.0 1.0 0.0 0.0 1.0 1.0 0.0 1.0 2.0 0.0 1.0 3.0
1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 2.0 1.0 0.0 3.0
_

Skills required:
C Programming, Engineering, Linux, MySQL, PHP, Project Management, Software Architecture, Software Testing
Additional Files: vw_2010___04___03___bezier_RAC_NameCryptedToProtectYourPrivacy_X201043132228756639153030488123362320484.zip
About the employer:
Verified
Public Clarification Board
Bids are hidden by the project creator. Log in as the employer to view bids or to bid on this project.
You will not be able to bid on this project if you are not qualified in one of the job categories. To see your qualifications click here.