static void st_RenderMode(struct gl_context *ctx, GLenum newMode ) { struct st_context *st = st_context(ctx); struct draw_context *draw = st->draw; if (newMode == GL_RENDER) { /* restore normal VBO draw function */ vbo_set_draw_func(ctx, st_draw_vbo); } else if (newMode == GL_SELECT) { if (!st->selection_stage) st->selection_stage = draw_glselect_stage(ctx, draw); draw_set_rasterize_stage(draw, st->selection_stage); /* Plug in new vbo draw function */ vbo_set_draw_func(ctx, st_feedback_draw_vbo); } else { if (!st->feedback_stage) st->feedback_stage = draw_glfeedback_stage(ctx, draw); draw_set_rasterize_stage(draw, st->feedback_stage); /* Plug in new vbo draw function */ vbo_set_draw_func(ctx, st_feedback_draw_vbo); /* need to generate/use a vertex program that emits pos/color/tex */ st->dirty.st |= ST_NEW_VERTEX_PROGRAM; } }
void st_init_draw(struct st_context *st) { struct gl_context *ctx = st->ctx; vbo_set_draw_func(ctx, st_draw_vbo); vbo_set_indirect_draw_func(ctx, st_indirect_draw_vbo); }
GLboolean _tnl_CreateContext( GLcontext *ctx ) { TNLcontext *tnl; /* Create the TNLcontext structure */ ctx->swtnl_context = tnl = (TNLcontext *) CALLOC( sizeof(TNLcontext) ); if (!tnl) { return GL_FALSE; } /* Initialize the VB. */ tnl->vb.Size = ctx->Const.MaxArrayLockSize + MAX_CLIPPED_VERTICES; /* Initialize tnl state. */ if (ctx->VertexProgram._MaintainTnlProgram) { _tnl_install_pipeline( ctx, _tnl_vp_pipeline ); } else { _tnl_install_pipeline( ctx, _tnl_default_pipeline ); } tnl->NeedNdcCoords = GL_TRUE; tnl->AllowVertexFog = GL_TRUE; tnl->AllowPixelFog = GL_TRUE; /* Set a few default values in the driver struct. */ tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts; tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts; tnl->Driver.NotifyMaterialChange = _mesa_validate_all_lighting_tables; tnl->nr_blocks = 0; /* plug in the VBO drawing function */ vbo_set_draw_func(ctx, _tnl_vbo_draw_prims); _math_init_transformation(); _math_init_translate(); return GL_TRUE; }
void st_init_draw(struct st_context *st) { struct gl_context *ctx = st->ctx; vbo_set_draw_func(ctx, st_draw_vbo); st->draw = draw_create(st->pipe); /* for selection/feedback */ /* Disable draw options that might convert points/lines to tris, etc. * as that would foul-up feedback/selection mode. */ draw_wide_line_threshold(st->draw, 1000.0f); draw_wide_point_threshold(st->draw, 1000.0f); draw_enable_line_stipple(st->draw, FALSE); draw_enable_point_sprites(st->draw, FALSE); }