I want hook all OpenGL games/applications. I want load my library only if application actually use OpenGL. Something like Direct3DCreate9 for Direct3D 9 or CreateDXGIFactory for Direct3D 10/11.

I thought this function wglDescribePixelFormat, but some app's/games not use it.

  • \$\begingroup\$ So in short you only want to use GL when DirectX isn't available? \$\endgroup\$ – The Communist Duck Jul 5 '11 at 16:06
  • \$\begingroup\$ 2 The Communist Duck, no I want hook GL and DirectX. I know when application start using Direct3D, but I don't know when it start using OpenGl. \$\endgroup\$ – KindDragon Jul 7 '11 at 15:00

wglCreateContex is what creates an OpenGL context on Windows, but it isn't the only way anymore. There is also wglCreateContextAttribARB, which is an extension function (and thus paradoxically means that you need to have created an OpenGL context already). This is used to create OpenGL 3.2+ core contexts.

I don't know what you intend by "load my library," but if you're trying to hook into all of OpenGL's stuff, to get every OpenGL call, then glIntercept is probably the place to look.


I am not sure about it, but wglCreateContext seems to be the first one. PIXELFORMATDESCRIPTOR is a structure.

and platform to platform context creating is the first one and its initialization varies. Like when you are using glut/freeglut, you can get started without creating context manually or describing pixel format.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.