5

It seems that certain API-specific calls set the error returned by GetLastError(). For example, wglCreateContextAttribsARB(...) can return (information from the specification):

ERROR_INVALID_VERSION_ARB == 0x2095
ERROR_INVALID_PROFILE_ARB == 0x2096

When debugging, however, I get different results. For example, trying to use wglCreateContextAttribsARB(...) to set up a GL 4.5 context (which my GPU doesn't support) results in an error value of 0xC0072095. The lower 16 bits match the invalid version error (which makes sense because it is a version issue), but the upper 16 bits don't make sense to me.

I skimmed the GetLastError documentation, which said that bit 29 should be set for application error codes. However, I couldn't find any justification as to why the other bits would be set, and in any case this conflicts with the ARB specification saying that such-and-such a value is returned.

What's going on?

imallett
  • 13,288
  • 9
  • 49
  • 115
  • That might actually be a bug in the GL driver. I have seen such error codes myself. It looks like the driver sets the error code to a [HRESULT](http://msdn.microsoft.com/de-de/library/bb446131.aspx), where the high bits have some specific meaning, instead of a simple windows error code, as it should. – derhass Aug 23 '14 at 23:40
  • The `GetLastError()` documentation says that "the error codes... can vary by operating system or device driver." – Reto Koradi Aug 23 '14 at 23:54
  • Modern GL enums are only 16-bit. I do not think it necessarily conflicts with anything, you just kind of assumed that the missing high 16-bits from the enumerated constant were 0. – Andon M. Coleman Aug 25 '14 at 23:11

0 Answers0