Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wglMakeCurrent Very Slow #56

Open
nsmryan opened this issue Jul 23, 2023 · 2 comments
Open

wglMakeCurrent Very Slow #56

nsmryan opened this issue Jul 23, 2023 · 2 comments

Comments

@nsmryan
Copy link

nsmryan commented Jul 23, 2023

Thank you for tigr! I've been having a lot of fun with it.

One thing I'm having trouble with though is that I have been finding that the call to wglMakeCurrent on Windows is very slow, ~10-15 ms.

I would really like to use tigr for some GUIs at work (small, no dependencies, and responsive!), but I would like the application to not take so much time just to draw.

I have not been able to figure out the root cause here: there are forum threads discussing similar problems, even similar slow downs, but it is not at all clear what is wrong.
I tried to avoid the call to wglMakeCurrent by comparing wglGetCurrentContext and the hglrc field of GLStuff, but I'm not clear enough on the design to know which calls might be omitted if we are already in the current context.

Do you have any thoughts about this? The lines I'm looking at are:

return wglMakeCurrent(win->gl.dc, win->gl.hglrc) ? 0 : -1;

and especially

return wglMakeCurrent(NULL, NULL) ? 0 : -1;

which seems to be what is causing the slow down.

Thank you!

@erkkah
Copy link
Owner

erkkah commented Jul 23, 2023

Hi there. Thanks for the report.

  • What resolution is your tigrWindow?
  • Do you use the TIGR_AUTO?
  • Are you using more than one window?

Theoretically, we should not need the NULL call, and I guess doing a check like you suggest could be a good idea.
I don't have my windows dev env accessible right now, so I can't test atm.

@nsmryan
Copy link
Author

nsmryan commented Jul 24, 2023

At the time I was trying 64x64, with TIGR_2X, and only one window.

I'm not sure what to make of my performance tests. TIGR_AUTO did not make a difference if the drawing code is fast (just drawing a simple circle with tigrCircle), but when I added in the 'blur' effect from the examples, tigrUpdate takes 0 ms and the drawing (a simple circle, blurred) takes 25 ms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants