I want to write a universal utility function that will use an OpenBl Framebuffer object to create a texture that can be used by any OpenGL program for any purpose that a third-party programmer would like to request.
Assume that for an argument rate, the function looks like
void createSpecialTexture(GLuint textureID)
{
MyOpenGLState state;
saveOpenGLState(state);
setStateToDefault();
doMyDrawing();
restoreOpenGLState(state);
}
What should be MyOpenGLState, saveOpenGLState(state), setStateToDefault()and restoreOpenGLState(state)look to ensure that doMyDrawingwill behave correctly and that there is nothing that I do in doMyDrawingnot affect anything else that a third party can be?
The problem that bites me is that OpenGL has a lot of implicit state, and I'm not sure if this all captured.
Update . My main problem is OpenGL ES 2.0, but I thought that I would ask the question as a whole
doron source
share