Skip to content

Commit

Permalink
Disable any enabled client-side arrays when binding a new shader.
Browse files Browse the repository at this point in the history
--HG--
branch : trunk
  • Loading branch information
icculus committed Apr 27, 2008
1 parent b7879fd commit c26fcee
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions mojoshader_opengl.c
Expand Up @@ -347,14 +347,27 @@ MOJOSHADER_glProgram *MOJOSHADER_glLinkProgram(MOJOSHADER_glShader *vshader,
void MOJOSHADER_glBindProgram(MOJOSHADER_glProgram *program)
{
GLhandleARB handle = 0;

if (program == bound_program)
return; // nothing to do.

// Disable any client-side arrays the current program could have used.
if (bound_program != NULL)
{
pglDisableClientState(GL_VERTEX_ARRAY);
for (i = 0; i < bound_program->attribute_count; i++)
{
const AttributeMap *map = &bound_program->attributes[i];
pglDisableVertexAttribArrayARB(map->location);
} // if
} // for

if (program != NULL)
{
handle = program->handle;
program->refcount++;
} // if

// !!! FIXME: unbind client-side arrays.

pglUseProgramObjectARB(handle);
program_unref(bound_program);
bound_program = program;
Expand Down

0 comments on commit c26fcee

Please sign in to comment.