backup_assgn2_car_octa

# backup_assgn2_car_octa -...

This preview shows pages 1–4. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: //////////////////////////////////////////////////// // main.cpp // Template code for drawing an articulated figure. // CS 174A //////////////////////////////////////////////////// / #ifdef _WIN32 #include &lt;windows.h&gt; #endif # #include &lt;GL/gl.h&gt; #include &lt;GL/glu.h&gt; #include &lt;math.h&gt; # #include &lt;iostream&gt; # using namespace std; u #include &lt;GL/glut.h&gt; # #include &quot;Ball.h&quot; #include &quot;FrameSaver.h&quot; #include &quot;Timer.h&quot; #include &quot;image.h&quot; # /* / Global Variables. The use of global variables is not considered good practice in programming and in most cases they can be avoided. However for graphics applications the need for global resources arises very frequently for you may require some data that is shared, by all callbacks. The best way to deal with this problem is to use a Singleton design pattern, yet we stick with globals here for simplicity. h */ * // Vector pointer definition / typedef struct _V *VectorPtr; t typedef struct _V { float x, y, z; } Vector; } // Vector operations #define INC_VEC(v1, v2) {v1.x += v2-&gt;x; v1.y += v2-&gt;y; v1.z += v2-&gt;z;} #define MUL_VEC(v1, k) {v1.x =v1.x*k; v1.y =v1.y* k; v1.z =v1.z* k;} { FrameSaver g_frameSaver; Timer g_timer; T GL_Image2D Img(&quot;img0048_2.bmp&quot;); GLuint g_ImgID; G BallData *g_arcBall = NULL; int g_width = 500; int g_height = 500; int g_button = -1; float g_zoom = 1; int g_previousY = 0; i int g_animate = 0; int g_recording = 0; i void resetArcball(); void save_image(); void instructions(); void set_color(float r, float g, float b); v const int STRLEN = 100; typedef char STR[STRLEN]; t float carX=0.0; float AngleY=0.0; float OscY=0.0; float AngleTail=0.0; float AngleWeed=0.0; f #define X 0 #define Y 1 #define Z 2 # //For octahedron recursion. int recurse_level = 3; float size=2.0; // To determine the size of the octahedron f #define D 0.577350269189625764 // Normalizing factor 1/Sqrt (3) # // The eye point and look-at point. double g_eye[3] = {0, 0.0, 50.0}; double g_ref[3] = {0.0, 0.0, 0.0}; double g_time = 0.0 ; d void initTexture(void) { glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glGenTextures(1, &amp;g_ImgID); glBindTexture(GL_TEXTURE_2D, g_ImgID); g glTexImage2D(GL_TEXTURE_2D, 0, 3, Img.m_width, Img.m_height, 0, GL_RGB, GL_UNSIGNED_BYTE, Img.m_data); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); glEnable(GL_TEXTURE_2D); } } ///////////////////////////////////////////////////// // PROC: drawCylinder() // DOES: this function // render a solid cylinder oriented along the Z axis. Both bases are of radius 1....
View Full Document

## backup_assgn2_car_octa -...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online