void HaloRefImage::draw_objects(CGELlist& drawn) { assert(_view); GELlist objects; for (int i=0; i < drawn.num(); i++ ) { if (drawn[i]->is_3D()) if (drawn[i]->name()!="Skybox") // XXX - hack!! objects+=drawn[i]; } objects.sort(GL_VIEW::depth_compare); // setup projection matrix glMatrixMode(GL_PROJECTION); // GL_TRANSFORM_BIT glPushMatrix(); glLoadMatrixd(_view->cam()->projection_xform().transpose().matrix()); // setup modelview matrix glMatrixMode(GL_MODELVIEW); // GL_TRANSFORM_BIT glPushMatrix(); Wtransf mat = _view->cam()->xform().transpose(); glLoadMatrixd(mat.matrix()); glEnable(GL_BLEND); // GL_ENABLE_BIT glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // GL_COLOR_BUFFER_BIT //clear the aux0 buffer if (use_fbos) glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _fbo); else glDrawBuffer(GL_AUX0); glClearColor(1.0,1.0,1.0,0.0); glClear(GL_COLOR_BUFFER_BIT); if (use_fbos) glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); if (get_kernel_size()>0) { //no need to do this if kernel size is zero glReadBuffer(GL_BACK); for(int i=0; i<objects.num(); i++) { glDrawBuffer(GL_BACK); //clear back buffer glClearColor(1.0,1.0,1.0,0.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if (objects[i]->can_do_halo()) { _pass_color = Color::black; objects[i]->draw_halo_ref(); //perform the blur in GLSL copy_to_scratch(); _blur_filter->draw(_view); //render the white version on top //clear Z-buffer glClear(GL_DEPTH_BUFFER_BIT); } glDisable(GL_BLEND); _pass_color = Color::white; //white objects[i]->draw_halo_ref(); //accumulate copy_to_scratch(); glEnable(GL_BLEND); if (use_fbos) glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _fbo); else glDrawBuffer(GL_AUX0); draw_scratch(); //composite into AUX0 buffer if (use_fbos) glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); } } //at this point the combined image exists in GL_AUX0 buffer //it is copied to texture from there instead of being copied to back buffer // restore projection matrix glMatrixMode(GL_PROJECTION); glPopMatrix(); // restore modelview matrix glMatrixMode(GL_MODELVIEW); glPopMatrix(); }
void initialize_pysical_memory(void) { minfo.system_memory_blocks = sinfo.system_memory / ( KERNEL_PAGE_SIZE * 1024); minfo.memory_map = (unsigned int *)(0x100000 + get_kernel_size()); }