void R2D_InitBackground2D(Render2D *sr, SFNode *node) { Background2DStack *ptr = malloc(sizeof(Background2DStack)); memset(ptr, 0, sizeof(Background2DStack)); traversable_setup(ptr, node, sr->compositor); ptr->surfaces_links = NewChain(); ptr->first_render = 1; /*setup rendering object for background*/ ptr->node = BaseDrawStack2D(sr, node); ptr->node->IsPointOver = b2D_point_over; ptr->node->Draw = DrawBackground; ((M_Background2D *)node)->on_set_bind = b2D_set_bind; texture_setup(&ptr->txh, sr->compositor, node); ptr->txh.update_texture_fcnt = UpdateBackgroundTexture; Node_SetPrivate(node, ptr); Node_SetPreDestroyFunction(node, DestroyBackground2D); Node_SetRenderFunction(node, RenderBackground2D); }
void gl_setup(void) { // enable depth handling (z-buffer) glEnable(GL_DEPTH_TEST); // enable auto normalize glEnable(GL_NORMALIZE); // define the background color glClearColor(0,0,0,1); glMatrixMode(GL_PROJECTION) ; glLoadIdentity() ; gluPerspective(20, 1.0, 0.1, 200.0); glMatrixMode(GL_MODELVIEW) ; glLoadIdentity() ; // init modelview to identity // toggle to smooth shading (instead of flat) glShadeModel(GL_SMOOTH); lighting_setup(); texture_setup(); return; }