#include "main/macros.h"
#include "vbo/vbo.h"
-#include "vbo/vbo_context.h"
#include "st_context.h"
#include "st_atom.h"
st_RenderMode(GLcontext *ctx, GLenum newMode )
{
struct st_context *st = ctx->st;
- struct vbo_context *vbo = (struct vbo_context *) ctx->swtnl_im;
struct draw_context *draw = st->draw;
if (newMode == GL_RENDER) {
/* restore normal VBO draw function */
- vbo->draw_prims = st_draw_vbo;
+ 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->draw_prims = st_feedback_draw_vbo;
+ 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->draw_prims = st_feedback_draw_vbo;
+ 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;
}
#include "main/image.h"
#include "vbo/vbo.h"
-#include "vbo/vbo_context.h"
#include "st_atom.h"
#include "st_cache.h"
void st_init_draw( struct st_context *st )
{
GLcontext *ctx = st->ctx;
- struct vbo_context *vbo = (struct vbo_context *) ctx->swtnl_im;
/* actually, not used here, but elsewhere */
create_default_attribs_buffer(st);
- assert(vbo);
- assert(vbo->draw_prims);
- vbo->draw_prims = st_draw_vbo;
+ vbo_set_draw_func(ctx, st_draw_vbo);
}
#include "vbo.h"
#include "vbo_context.h"
+#if 0
/* Reach out and grab this to use as the default:
*/
extern void _tnl_draw_prims( GLcontext *ctx,
const struct _mesa_index_buffer *ib,
GLuint min_index,
GLuint max_index );
+#endif
/* By default:
*/
+#if 0 /* dead - see vbo_set_draw_func() */
vbo->draw_prims = _tnl_draw_prims;
+#endif
/* Hook our functions into exec and compile dispatch tables. These
* will pretty much be permanently installed, which means that the
FREE(vbo_context(ctx));
ctx->swtnl_im = NULL;
}
+
+
+void vbo_set_draw_func(GLcontext *ctx, vbo_draw_func func)
+{
+ struct vbo_context *vbo = vbo_context(ctx);
+ vbo->draw_prims = func;
+}
+