Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question
    
So in short you only want to use GL when DirectX isn't available? –  The Communist Duck Jul 5 '11 at 16:06
    
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. –  KindDragon Jul 7 '11 at 15:00

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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