/** * Per-context one-time init of things for intl_clear_tris(). * Basically set up a private array object for vertex/color arrays. */ static void init_clear(GLcontext *ctx) { struct intel_context *intel = intel_context(ctx); struct gl_array_object *arraySave = NULL; const GLuint arrayBuffer = ctx->Array.ArrayBufferObj->Name; const GLuint elementBuffer = ctx->Array.ElementArrayBufferObj->Name; /* create new array object */ intel->clear.arrayObj = _mesa_new_array_object(ctx, ~0); /* save current array object, bind new one */ _mesa_reference_array_object(ctx, &arraySave, ctx->Array.ArrayObj); _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, intel->clear.arrayObj); /* one-time setup of vertex arrays (pos, color) */ _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0); _mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); _mesa_ColorPointer(4, GL_FLOAT, 4 * sizeof(GLfloat), intel->clear.color); _mesa_VertexPointer(3, GL_FLOAT, 3 * sizeof(GLfloat), intel->clear.vertices); _mesa_Enable(GL_COLOR_ARRAY); _mesa_Enable(GL_VERTEX_ARRAY); /* restore original array object */ _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, arraySave); _mesa_reference_array_object(ctx, &arraySave, NULL); /* restore original buffer objects */ _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, arrayBuffer); _mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, elementBuffer); }
/** * Initialize vertex array state for given context. */ void _mesa_init_varray(struct gl_context *ctx) { ctx->Array.DefaultArrayObj = _mesa_new_array_object(ctx, 0); _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, ctx->Array.DefaultArrayObj); ctx->Array.Objects = _mesa_NewHashTable(); }
/** * Initialize vertex array state for given context. */ void _mesa_init_varray(struct gl_context *ctx) { ctx->Array.DefaultArrayObj = _mesa_new_array_object(ctx, 0); _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, ctx->Array.DefaultArrayObj); ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */ ctx->Array.Objects = _mesa_NewHashTable(); }