View Full Version : draw without paint
10-03-2009, 06:20 AM
Hi, Using delphi I am trying to render a directshow clip using a callback function. For ages nothing worked until I realised glDrawPixels does not force opengl to render the pixels. I then saved the frame in a temporary buffer and called refresh. In the Opengl draw method I used glDrawPixels to draw the frame from the temporary buffer. This works fine but how can I avoid the copy. Is there a way to force opengl to render without forcing a paint.
10-03-2009, 07:55 AM
You may have to call glFlush to empty all command buffers and force their execution. Actually, if you are using double buffering, you just have to call the "swapbuffers" command and refresh the screen. Then I don't know the function name in Delphi.
10-03-2009, 06:44 PM
thanks, had tried glFlush and SwapBuffers(DC) without success. It may be that the callback is from another thread and calling Refresh posts a paint message.
10-04-2009, 04:44 AM
Take care that all opengl commands are issued from the thread in which the opengl rendering context is created. Otherwise create a context in each thread.
I am sorry, I don't have any experience with delphi, so I don't have more ideas... Perhaps you will find more help on delphi related forums or a more general one.
10-04-2009, 06:07 PM
Can you post the relevant parts of the code and tell us what is being called when.
Is everything being done in the main thread or are you creating TThread objects ?
Is the OpenGL window in a Delphi form ?
If it is a Delphi form do you override the CreateParams procedure to set the window parameters, and do you have an ERASEBKGND message handler that sets Message.Result := 1 ?
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.