I'm writing graphics code that targets both an embedded VxWorks 653 system and Windows (VxWorks is our prime target that we're delivering, and Windows is our desktop environment to test).
Our VxWorks 653 graphics driver uses glOrthof and does not have glOrtho, so our graphics rendering code uses glOrthof. For consistency on Windows, I did this during setup:
glOrthof = (PFNGLORTHOFPROC)wglGetProcAddress("glOrthof");
to get the OpenGL Extension function for glOrthof that our NVidia driver supports.
This works fine for the NVidia drivers, but some of our developers are stuck with Intel drivers. For them I tried this:
glOrthof = (PFNGLORTHOFPROC)&graphics_support_glOrthof;
static void WINAPI graphics_support_glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
{
glOrtho((GLdouble)left, (GLdouble)right, (GLdouble)bottom, (GLdouble)top, (GLdouble)zNear, (GLdouble)zFar);
}
This stub gets hit when our graphics rendering loop calls glOrthof, and I can see that (via function breakpoints) that glOrtho is being called inside opengl32.dll and the parameters I'm passing in match. However, my display is entirely white, and I'm getting value 1281 (GL_INVALID_VLAUE) as a return code from glGetError().
My solution to fix this is to simply
#define glOrthof glOrtho
on my Windows target, but I'm wondering why this stub is failing?