Panda3D

init.cxx

00001 #include "zgl.h"
00002 
00003 GLContext *gl_ctx;
00004 
00005 void glInit(GLContext *c, ZBuffer *zbuffer)
00006 {
00007   GLViewport *v;
00008   int i;
00009 
00010   c->zb=zbuffer;
00011   
00012   /* viewport */
00013   v=&c->viewport;
00014   v->xmin=0;
00015   v->ymin=0;
00016   v->xsize=zbuffer->xsize;
00017   v->ysize=zbuffer->ysize;
00018   v->updated=1;
00019 
00020   /* lights */
00021   c->first_light=NULL;
00022   c->ambient_light_model=gl_V4_New(0.2, 0.2, 0.2, 1.0f);
00023   c->local_light_model=0;
00024   c->lighting_enabled=0;
00025   c->light_model_two_side = 0;
00026   c->normalize_enabled = 0;
00027   c->normal_scale = 1.0f;
00028 
00029   /* default materials */
00030   for(i=0;i<2;i++) {
00031     GLMaterial *m=&c->materials[i];
00032     m->emission=gl_V4_New(0.0f, 0.0f, 0.0f, 1.0f);
00033     m->ambient=gl_V4_New(0.2, 0.2, 0.2, 1.0f);
00034     m->diffuse=gl_V4_New(0.8f, 0.8f, 0.8f, 1.0f);
00035     m->specular=gl_V4_New(0.0f, 0.0f, 0.0f, 1.0f);
00036     m->shininess=0;
00037   }
00038 
00039   /* default state */
00040   c->current_color.v[0]=1.0f;
00041   c->current_color.v[1]=1.0f;
00042   c->current_color.v[2]=1.0f;
00043   c->current_color.v[3]=1.0f;
00044 
00045   c->current_normal.v[0]=1.0f;
00046   c->current_normal.v[1]=0.0f;
00047   c->current_normal.v[2]=0.0f;
00048   c->current_normal.v[3]=0.0f;
00049 
00050   c->cull_face_enabled=0;
00051   
00052   /* specular buffer */
00053   c->specbuf_first = NULL;
00054   c->specbuf_used_counter = 0;
00055   c->specbuf_num_buffers = 0;
00056 
00057   /* depth test */
00058   c->depth_test = 0;
00059   c->zbias = 0;
00060 }
00061 
00062 void glClose(GLContext *c)
00063 {
00064   gl_free(c);
00065 }
 All Classes Functions Variables Enumerations