All pastes #336928 Raw Edit

Stuff

public text v1 · immutable
·published 2007-02-02 11:18 UTC
rendered paste body
void UpdateScreen()
{
		// Blank entire screen
		glClear(GL_COLOR_BUFFER_BIT);

		// Enable vertex, color and texture arrays.
		glEnableClientState(GL_VERTEX_ARRAY);
		glEnableClientState(GL_COLOR_ARRAY);
		glEnableClientState(GL_TEXTURE_COORD_ARRAY);

		// Feed the arrays.
		glVertexPointer(2, GL_INT, 0, &this->VertexCoords.at(0));
		glColorPointer(3, GL_FLOAT, 0, &this->ColorCoords.at(0));
		glTexCoordPointer(2, GL_FLOAT, 0, &this->TextureCoords.at(0));

		// Draw a number of primitives based upon currently fed arrays.
		glDrawArrays(GL_QUADS, 0, this->VertexCoords.size());

		// Disable vertex, color and texture arrays.
		glDisableClientState(GL_VERTEX_ARRAY);
		glDisableClientState(GL_COLOR_ARRAY);
		glDisableClientState(GL_TEXTURE_COORD_ARRAY);

		// Wait for all OpenGL operations to finish.
		glFinish();

		// Draw content to screen.
		SDL_GL_SwapBuffers();

		// Reset coordinate system.
		glLoadIdentity();
}