Panda3D
 All Classes Functions Variables Enumerations
init.cxx
1 #include "zgl.h"
2 
3 GLContext *gl_ctx;
4 
5 void glInit(GLContext *c, ZBuffer *zbuffer)
6 {
7  GLViewport *v;
8  int i;
9 
10  c->zb=zbuffer;
11 
12  /* viewport */
13  v=&c->viewport;
14  v->xmin=0;
15  v->ymin=0;
16  v->xsize=zbuffer->xsize;
17  v->ysize=zbuffer->ysize;
18  v->updated=1;
19 
20  /* lights */
21  c->first_light=NULL;
22  c->ambient_light_model=gl_V4_New(0.2, 0.2, 0.2, 1.0f);
23  c->local_light_model=0;
24  c->lighting_enabled=0;
25  c->light_model_two_side = 0;
26  c->normalize_enabled = 0;
27  c->normal_scale = 1.0f;
28 
29  /* default materials */
30  for(i=0;i<2;i++) {
31  GLMaterial *m=&c->materials[i];
32  m->emission=gl_V4_New(0.0f, 0.0f, 0.0f, 1.0f);
33  m->ambient=gl_V4_New(0.2, 0.2, 0.2, 1.0f);
34  m->diffuse=gl_V4_New(0.8f, 0.8f, 0.8f, 1.0f);
35  m->specular=gl_V4_New(0.0f, 0.0f, 0.0f, 1.0f);
36  m->shininess=0;
37  }
38 
39  /* default state */
40  c->current_color.v[0]=1.0f;
41  c->current_color.v[1]=1.0f;
42  c->current_color.v[2]=1.0f;
43  c->current_color.v[3]=1.0f;
44 
45  c->current_normal.v[0]=1.0f;
46  c->current_normal.v[1]=0.0f;
47  c->current_normal.v[2]=0.0f;
48  c->current_normal.v[3]=0.0f;
49 
50  c->cull_face_enabled=0;
51 
52  /* specular buffer */
53  c->specbuf_first = NULL;
54  c->specbuf_used_counter = 0;
55  c->specbuf_num_buffers = 0;
56 
57  /* depth test */
58  c->depth_test = 0;
59  c->zbias = 0;
60  c->has_zrange = 0;
61  c->zmin = 0.0;
62  c->zrange = 1.0;
63 }
64 
65 void glClose(GLContext *c)
66 {
67  gl_free(c);
68 }
Definition: zgl.h:141
Definition: zgl.h:77
Definition: zgl.h:64