if (pn_rc->actuator) { GLuint texture_id; // set the viewport to a texture size glViewport(0, 0, 128, 128); // run actuators exec_actuator (pn_rc->actuator); // copy prerendered frame to texture glGenTextures(1, &texture_id); glBindTexture(GL_TEXTURE_2D, texture_id); glTexImage2D(GL_TEXTURE_2D, 0, 4, 128, 128, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 128, 128, 0); // reset the viewport to window size and render the pre-rendered image // 100% prerendered! yeah!!! glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glViewport(0, 0, pn_image_data->width, pn_image_data->height); glBegin(GL_QUADS); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glTexCoord2f(0, 1); glVertex2i(-1, -1); glVertex2i(-1, 1); glVertex2i(1, 1); glVertex2i(1, -1); glEnd(); glBindTexture(GL_TEXTURE_2D, 0); glDeleteTextures(1, &texture_id); SDL_GL_SwapBuffers(); }