My aim is to render a series of video frames and side by side process them using GLSL shader programming.
My interface is in MFC (SDI – Single Doc Interface). Recently, I have been facing problem in displaying video frames once the shader code is invoked.
The problem is that a scene is rendered on MFC screen (or interface), but iff a shader code is invoked, then the next frame disappears and is substituted by the shader generated color and remains there forever.
I wrote a couple of posts regarding that. Got helpful responses but still the problem lingers.
A random search through archived posts in this forum reasoned for the problem that when a shader writes to a buffer through gl_FragData[x] , it remains there and since the context is single it is shared by both on-screen and off-screen frame buffer.
The details of my problem are in the above links.
In short what is happening is:
a. I get data for a new frame.
b. Render on screen using glDrawPixels(…)
c. Switch to off-screen frame buffer.
d. Set up Two textures, bind them to GL_TEXTURE0 and 1 resp.
e. Attach them to FBO
f. call shader to compute. [The shader works on the attached texture and the data therein are completely independent of current image frame rendered]
g. Swicth back to Main Frame buffer. i.e glFrameBufferEXT(…,0);
h. Restore viewport settings and repeat all steps for next frame.
Now if I do not call my shader program, the images in sequence are rendered correctly. But if I enable shader, then the color computed by it is rendered and stays there forever.
For code and details, they have been posted alread in forum as pointed to by the links of my previous posts.
As far as the suggestion I need is whether to go for MDI (Multiple document Interface – mfc) as it will give multiple context and that one context (or thread) can be used for shader computation … what do you say ?
Or is there any other method that I can use that requires only single MFC context?
Thank you for your time.