[gameprogrammer] Re: OpenGL + SDL + multi-threading + Theora

Sorry to be late for my replay, thank you for you suggestion, it's working
fine, I rendered it to a memory bitmap and then in the main thread I
rendered it from the memory bitmap, and as you said I used a BMP pair to
avoid errors and set a flag to show which one the main thread will use, and
it's working fine.

now I'll have to work for the sound, which will use virbos, so any
suggestions for how I can do it in with SDL_Mixer?


On 8/22/07, richard sabbarton <richard.sabbarton@xxxxxxxxx> wrote:
>
> Hi There,
>
> I ran into similar problem with OpenGL and Multi-Threading.  I was able to
> generate textures without errors but they never displayed correctly in the
> application.  I think you run into problems because of the glBegin() and
> glEnd() in your Main Thread.  You can't manipulate Textures between these (I
> think from memory) and you cannot guaranty the current status of you main
> thread when generating the texture.
>
> What you could try is decoding the video frames to a Memory Bitmap and
> then generate the Texture in your main thread from the memory BMP.  Also,
> you could use a BMP pair and alternate between them for each frame.  You can
> then set a flag to show which one the main thread should use.  This will
> avoid errors as you are likely to render each frame a different number of
> times depending on the speed of your main thread.
>
> I have not done this myself but it should be possible.  This was my
> planned workaround but I never got as far as coding it. My wife had a baby
> and I haven't looked at a line of code since!  He's two months old now.
> Maybe I can start sneaking back to the keyboard while my wife isn't
> looking...
>
> Let me know if it works or if you try it.
>
> Rich
>
>
>  On 22/08/07, Husam Zakaria <hzcppff@xxxxxxxxx> wrote:
>
> > Hi, every one
> >
> > I am working on an application that can play theora ogg file using
> > OpenGL and SDL, and I looked at the Nebula Device 2 nOggTheoraplayer
> > class at this link:
> >
> >
> > http://nebuladevice.cubik.org/documentation/nebula2/classnOggTheoraPlayer.shtml
> >
> > and build my class the same way they build it, but the problem is that
> > I don't know how to play the video with such heirarcy.
> > so I decide to create a thread that decode the video frames and render
> > the decoded frames to a texture, and in the main thread I will render
> > this texture to the screen for every frame.
> >
> > the problem is that I created the texture in the main thread and then
> > I created the thread that will render to this texture, and when I want
> > to render to this texture I call the following code to be sure that
> > the texture has been created:
> >
> >     assert(glIsTexture(texture_id));
> >
> > when the application run the assertion will cut the program indecating
> > that the texture isn't valid, so why does that happend?!! I am sure
> > that I create the texture in the main thread with the same id, so what
> > I can do to solve this?
> >
> > ---------------------
> > To unsubscribe go to http://gameprogrammer.com/mailinglist.html
> >
> >
> >
>

Other related posts: