PDA

View Full Version : How bad can wglMakeCurrent hurt performance ?



fuxifuxi
10-28-2003, 02:51 PM
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.

mikael_aronsson
10-28-2003, 10:09 PM
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.

Mikael

Obli
10-29-2003, 03:02 AM
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.