Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Threads..

  1. #1

    Threads..

    Hi all,

    Is it possible to get my opengl engine to 'render' in a thread?

    I have tried using BeginThread(), this seems to work except all i get in the opengl context is a black screen.

    Is there something else i need to do?

    I can't put my entire engine in to a thread as there are several events going to and from my application.

    Thanks
    M109uk
    <br />--------------------------------------------------------
    <br />www.pulse-soft.oneuk.com

  2. #2

    Threads..

    Threading is an immense headache.

    The latest version of my Font Studio uses a render thread to do the pixel manipulation and I had endless problems getting the thing to work properly even with copying all necessary data into the thread at creation and copying it back to the main program after processing.

    I would recommend this text: http://www.eonclash.com/Tutorials/Mu...ey1.1/ToC.html

    It was quite a help to me while writing my threaded program.

    All I can say to you is: brush up on your critical sections and mutexes!
    My site: DelphiTuts.com (coming soon)...

    Download Font Studio 4.21 here.

  3. #3

    Threads..

    As far as I know, OpenGL is *not* thread-safe. It's a purely single-threaded system. So no, you cannot render in another thread. You can do math, physics, background loading, though.

  4. #4

    Threads..

    You can render in another thread, problem is you can't render in two threads at the same time .

    Take a look at the GLScene source code and try posting this in the GLScene NG and you will get LOTS of replies on how it can be achieved. Lots of smart people working on that project and Eric is always more then willing to help others out.

  5. #5

    Threads..

    Quote Originally Posted by Chebmaster
    As far as I know, OpenGL is *not* thread-safe. It's a purely single-threaded system. So no, you cannot render in another thread. You can do math, physics, background loading, though.
    Ugh.. your logic is flawed, opengl is useful within any thread as long as you execute opengl calls only one thread.
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

  6. #6

    Threads..

    Thanks for all the replys

    I will have a look at GLScene..

    I've managed to get threading working on one example, which is a barebone applications with no forms and an SDL window is created, and then everything is rendered in a thread via a repeat..until,

    However, with the same code, except i have a main form, this creates everything in the OnCreate, and this is now where i get a black screen :s...

    Im just not sure if windows is being temperamental lol...

    Thanks again
    M109uk
    <br />--------------------------------------------------------
    <br />www.pulse-soft.oneuk.com

  7. #7

    Threads..

    your logic is flawed, opengl is useful within any thread as long as you execute opengl calls only one thread.
    And...? As far as I know, you get a free crash fest if your window is created not in the main application thread. Same goes for trying to create OpenGL rendering context, and same goes for any DirectX operations.

    At least it was such way when I tried to explore the threading aspect of 3d graphics. It was in the times of Windows 98 and Riva TNT, though. Maybe things improved a bit since then.

  8. #8

    Threads..

    OGL and D3D are single-threaded, but it doesn't matter in which thread you use it that is it doesn't have to be the main process thread...

  9. #9

    Threads..

    Why would you want to go through the hassle of writing a threaded rendering module?
    Peregrinus, expectavi pedes meos in cymbalis
    Nullus norvegicorum sole urinat

  10. #10

    Threads..

    Its mainly for the use in my editors,

    i want to use my engine code so i have all the effects on hand, but it renders in a repeat loop, which renders, ticks and all,
    but with that some of the applications messages are not getting through, for example if i wanted to rename an object it would take 1 minute to type the name, sometimes missing out characters. Sometimes it even prevents me from closing Dialogs and such, i could'nt close a simple InputBox once and hard to Ctrl-alt-del it.

    I tried adding Application.ProcessMessages in several areas of the rendering, which made a few little differences but still having problems.

    If that makes any sense :?
    M109uk
    <br />--------------------------------------------------------
    <br />www.pulse-soft.oneuk.com

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •