1

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?

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
  • ...is your embedded target using OpenGL or OpenGL ES? `glOrthof()` is an OpenGL ES function. Why not use a proper OpenGL ES implementation like [ANGLE](https://github.com/google/angle) or [SwiftShader](https://github.com/google/swiftshader) on Windows instead of trying to swap out functions out like that? – genpfault Sep 18 '19 at 15:21
  • 1
    OpenGL SC, a specific implementation provided by CoreAVI. We're also limited in what we can use here, we have to go through a lot of redtape use something like ANGLE. But we're not using ES on either. – Robert Joseph Dacunto Sep 18 '19 at 15:29

0 Answers0