[SOLVED] 代写 graph CGT 215 Lab 5

30 $

File Name: 代写_graph_CGT_215_Lab_5.zip
File Size: 244.92 KB

SKU: 1414745292 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


CGT 215 Lab 5
Nested Loops and Graphic Output
Learning objectives:
• Practice loops.
• Learn about the customized 3D environment that we will use through the rest of the course.
Description:
Create a program to present four different graphic outputs.
Create a way for the user to alternate between the different scenes.
Introduction:
Make sure the framework compiles.
All your code will be inside the main.cpp file. Do not touch anything else.
This main.cpp includes three functions. Put all your code in the renderFrame function. At the beginning of the function, you should create a 3D context calling the function enable3d(). Also, if you want to draw 3D primitives, it is convenient to call the function setWireframeRendering(false) to create a fully shaded object.
The keyPressed(char key) function tests if a key was pressed in the current frame. You can use it to implement your user interaction logic—for example, using it with a globally defined variable.
Another two functions that can be of your interest are:
• setColor(double red, double green, double blue) sets the color to the desired RGB color. All
arguments must be double numbers between 0.0 and 1.0 for the consequent drawings.
• drawSphere(double x, double y, double z, double radius) draws a sphere with center at the
point (x, y, z), with the specified radius using a current color.
NOTE: Whenever you have trouble tracking down how to use a function, the cgt215.h file contains all of these functions in their original source, or see the demo.cpp for implementations! Open it up, then use Ctrl+F to search for a term, which should guide you on how to use it back in your own main.cpp!
See the next page for the requirements of the Lab, the four different graphic outputs to create:

Implement the following four graphic outputs:
1. A row of spheres with increasing radius as shown below:
2. A row of spheres alternating the radius from smallest, biggest, second smallest, second biggest, etc.
See the final two requirements below:

3. A rectangular grid of spheres augmenting the radius along the x and y coordinates.
4. A three-dimensional grid of spheres of the same size with procedural colors.
HINT: Make sure that any numbers used for calculations with a For Loop’s incrementing variable uses the amount of decimal places you want to end with.
e.g. To divide your incrementing variable by two, resulting in a double with decimal values, you would need (i / 2.0), not (i / 2).
2 is an integer, 2.0 is a double, 2.0f is a float

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] 代写 graph CGT 215 Lab 5
30 $