-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrender.cpp
More file actions
44 lines (34 loc) · 884 Bytes
/
render.cpp
File metadata and controls
44 lines (34 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* render.cpp
* Omkar H. Ramachandran
* omkar.ramachandran@colorado.edu
*
* Functions for setting up the renderer
*/
#include "general.h"
void render_init(){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glLoadIdentity();
}
void setup_opengl( int width, int height ){
float ratio = (float) width / (float) height;
/* Our shading model--Gouraud (smooth). */
glShadeModel( GL_SMOOTH );
/* Culling. */
//glCullFace( GL_BACK );
//glFrontFace( GL_CCW );
//glEnable( GL_CULL_FACE );
/* Set the clear color. */
glClearColor( 0, 0, 0, 0 );
/* Setup our viewport. */
glViewport( 0.0, 0.0, width, height );
/*
* Change to the projection matrix and set
* our viewing volume.
*/
glMatrixMode( GL_PROJECTION );
glLoadIdentity( );
gluPerspective( 45.0f, ratio, 1.0f, 100.0f );
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}