вход по аккаунту

код для вставкиСкачать
CO652 Class 1
1. Run the class1 project
Take the project from:
find the project.sln file and double click on it (it is in class1Code\projects\class1\source). Visual Studio should
start up, containing the project.
Compile and Run the project (just press the green ‘play’ triangle), a window should appear, showing a multicoloured triangle. You can press ‘Esc’ to exit, or ‘Alt’ and ‘Tab’ to switch to another window.
2. Build a shape
In OpenGL shapes are made of up of triangles. Each triangle is made up of three points. Each point is made up
of three floating point numbers: x,y and z. The outside face of a triangle is the side where the points go counter
clockwise around.
Find the vertexBufferData array in main.cpp. This contains the coordinates for the triangle that is
shown in the window.
Add triangles to make a four sided shape (a Tetrahedron). The new vertex location is (0.0f,0.0f,1.0f). You will
need to add 3 new triangles, each new triangle will take two vertices from the first triangle. The first triangle
forms the back face of the shape, so reverse the order of the coordinates in the first triangle, so that the front of it
is facing away from you.
The colour of the new vertex should be white. OpenGL RGB values are between 0 and 1, not 0 and 255, so to
get a OpenGL RGB value, take the value from the standard RGB colour space and divide the number by 255.
The colour of each vertex is specified in the colour array.
3. Change the colour of the shape
Make each face a solid colour: red, green, blue and white. To do this, make all the vertices for a triangle the
same colour.
4. Build a cube
Build a cube in the same VBO. It should be flat (the lines should be parallel to the axes). Two corners should be
at (2,2,-3) and (3,3,-4). Make each side of the cube a different solid colour.
Пожаловаться на содержимое документа