How bad can wglMakeCurrent hurt performance ?

Hi !

What is faster: change opengl states (the one that should be changed), glViewport(…), draw object, glBindTexture(…)
glCopyTexSubImage2D(…) for each object I want to render,

or have different rendering contexts for each object, draw object and then glCopyTexSubImage2D…

The problem is that the objects are not known at compile time so I cannot optimize anything.

Hi !

wglMakeCurrent is pretty expensive.

If you for example need for different OpenGL views and create one conext and split it up with glViewport, this is much faster then creating for windows and switching context (at least on the hardware I tried on).

It is all hardware dependant, but you should always try to minimize state changes if possible, try to keep geometry with similar attributes together if possible.


Something related to shadow maps and wglMakeCurrent was posted some time ago on advanced forum.

It turns out it is very expensive, check advanced forum’s thread.