Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Called by Rocket when it wants to render geometry that it does not wish to optimise.
- void ShellRenderInterfaceOpenGL::RenderGeometry(Rocket::Core::Vertex* vertices, int ROCKET_UNUSED(num_vertices), int* indices, int num_indices, const Rocket::Core::TextureHandle texture, const Rocket::Core::Vector2f& translation)
- {
- glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS);
- glPushAttrib(GL_ALL_ATTRIB_BITS);
- glPushMatrix();
- glTranslatef(translation.x, translation.y, 0);
- glVertexPointer(2, GL_FLOAT, sizeof(Rocket::Core::Vertex), &vertices[0].position);
- glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Rocket::Core::Vertex), &vertices[0].colour);
- if (!texture)
- {
- glDisable(GL_TEXTURE_2D);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- }
- else
- {
- glEnable(GL_TEXTURE_2D);
- glBindTexture(GL_TEXTURE_2D, (GLuint) texture);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glTexCoordPointer(2, GL_FLOAT, sizeof(Rocket::Core::Vertex), &vertices[0].tex_coord);
- }
- glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
- glDrawElements(GL_TRIANGLES, num_indices, GL_UNSIGNED_INT, indices);
- glPopMatrix();
- glPopAttrib ();
- glPopClientAttrib ();
- }
Advertisement
Add Comment
Please, Sign In to add comment