add guGetUniformLocationsArray()

This commit is contained in:
Josh Holtrop 2011-05-25 08:39:51 -04:00
parent ec9af1b8b1
commit eb0530004d
2 changed files with 23 additions and 0 deletions

View File

@ -347,3 +347,13 @@ void guGetUniformLocations(GLuint program, guUniformLocation *locs)
*locs[i].loc = glGetUniformLocation(program, locs[i].name); *locs[i].loc = glGetUniformLocation(program, locs[i].name);
} }
} }
void guGetUniformLocationsArray(GLuint program, const char **names,
GLint *locations)
{
int i;
for (i = 0; names[i] != NULL; i++)
{
locations[i] = glGetUniformLocation(program, names[i]);
}
}

View File

@ -234,6 +234,19 @@ GLuint guMakeProgram(GLuint v_shader_id, GLuint f_shader_id,
*/ */
void guGetUniformLocations(GLuint program, guUniformLocation *locs); void guGetUniformLocations(GLuint program, guUniformLocation *locs);
/**
* Get the locations of uniform variables in an OpenGL program object.
* This function stores the locations found into an array of GLints.
* @param program the OpenGL program object
* @param names pointer to a NULL-terminated array of uniform names
* @param locations pointer to an array of GLints to store the locations in
*
* locations should point to an array with as many elements as names
* points to (minus the terminating NULL element).
*/
void guGetUniformLocationsArray(GLuint program, const char **names,
GLint *locations);
/** /**
* Create an OpenGL buffer object containing contents from memory. * Create an OpenGL buffer object containing contents from memory.
* @param target the OpenGL buffer target (ex: GL_ARRAY_BUFFER). * @param target the OpenGL buffer target (ex: GL_ARRAY_BUFFER).