Board index » delphi » OpenGL and multimedia hirez timer

OpenGL and multimedia hirez timer

2005-10-24 05:34:44 AM
Hi Everyone...
{using delphi 6 pro}
I've wanted to switch to a multimedia timer for better time resolution.
Currently in my code, I am using an onidle event to redraw my opengl scene.
If i switch to a ttimer, i get about the same time resolution depending on
hardware platform... and everything works fine.
Now, I have tried to use third part multimedia timer
wrappers in place of the Timer... but my scene does not appear to draw, I
just get a black window. I get nothing at all if I don't have a
SwapBuffers(DC); command at the end of my draw scene. Apparently it is not
straightforward to switch to a multi media timer? I am using a timer that I
got off Torry's Delphi site... and it seems to just have the standard
settimer and timegettime procedures and stuff.
If i put a label that updates every 10ms or other stuff in the window to
update it works fine at the frequency i chose.. just not working for opengl
stuff. (Some components called Wave Audio comes with a multimedia timer).
If I delete this multimedia timer and put the ttimer or onidle back in to
the code, everything is fine again. If I slow the multimedia timer down to
100ms it still doesn't work... I don't think it is a speed issue. I have used
examples from nehe to put my little project together.. plus it uses serial
components and zeos sql db components.

Re:OpenGL and multimedia hirez timer

Multimedia timer events are triggered in the context of another thread,
unless your component does a Synchronize for you.
OpenGL context activation is per-thread, so if you initialize in the
main thread and try rendering in a secondary thread, nothing will happen.