I wrapped the basic OpenGL functions in a Delphi VCL user element. I am currently doing a loop using the TTimer
created in this control. I strongly feel that using a timer is completely wrong, as drawing can either overlap or be delayed. Instead, I would like to put this drawing loop into a stream. Please refer to my original question with some flickering problems - this is what I blame for the TTimer
that I use.
Question
Is OpenGL safe to use inside a thread? What should I know? I plan to make OpenGL API calls both inside and outside this thread. It will be essentially a continuous cycle, where as soon as he finishes drawing, he will immediately begin to paint again. Currently, using a timer, it depends on waiting for the timer interval to reach. So, for example, if the timer interval is set to 100 ms, and the drawing takes only 20 ms, then it will wait 80 ms until it is delayed again. Using a stream eliminates this delay. How do I make such calls from within this thread?
Background
The original sample project on which I based all my API calls used the main thread of the application and did not actually use VCL at all. The window that displayed the image was dynamically created using clean Windows API calls, and the drawing was repeated from a continuous loop in the main application thread. That's why I believe that using Thread will solve many of my problems - in particular, flicker.
source share