Skip to main content
GameDev.net gamedev.net
🔒 Locked

Multithread rendering

Started by v1nd1cat10n Jun 24, 2004 at 11:33 PM 5 replies 1.2k views
Original Post
v1nd1cat10n
v1nd1cat10n
I want to render a cursor on a seperate thread as the rest of my scene. Is this possible?? Since I'm using DirectInput with exclusive cooperation I lose my cursor. I have the cursor position being polled on a seperate thread. I could just render it with the scene on the main thread but I would rather have my cursor not be dependent on the framerate my scene is rendering. Is what I am proposing possible? Any examples out there? Do I need to use 2 different devices? Any suggestions and/or strategies would be helpful. Thanks in advance.
v1nd1cat10n"It's nice to be nice to the nice." - Frank Burns
mohamed adel
mohamed adel
using symetrical threads degrades the performance as the threads are competing to access the device.
you can use a thread for each separate task, for example thread for input, thread for rendering and so on, but not more than one thread for rendering.
SiCrane
SiCrane
Quote:
Original post by Fruny
... but OpenGL itself is not designed to allow multiple rendering threads ...


Isn't this the Direct X forum?

In any case, Mason McCuskey has an article on gamedev that mentions mouse rendering in a separate thread.
Fruny
Fruny
Quote:
Original post by SiCrane
Quote:
Original post by Fruny
... but OpenGL itself is not designed to allow multiple rendering threads ...


Isn't this the Direct X forum?


I'm tired...

There was an opengl forum question just below it.

I think I'll just delete my post.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Etnu
Etnu
Well, the OP never mentioned OGL...but anyway.

If you're polling the mouse in a seperate thread, and updating the position there, it shouldn't matter how high or low your frame rate is. Yes, your mouse may suddenly jump from one side of the screen to another if your frame rate is really low, but if your frame rate gets that bad you've probably got bigger problems than the mouse moving oddly.

You don't want to actually have 2 seperate rendering threads. One thread that updates things, and another that renders is the way to go.

Just keep in mind that if the "update" thread ever has to change data used by the "render" thread (such as rewriting a vertex buffer), it would be most prudent to set some sort of flag that "pauses" the rendering thread (I HIGHLY doubt that your video card will like it if you try to overwrite a vertex buffer that it's in the middle of drawing with).
---------------------------Hello, and Welcome to some arbitrary temporal location in the space-time continuum.
v1nd1cat10n
v1nd1cat10n
Thanks for the help. Probably saved me days of banging my head against the wall.

v1nd1cat10n
v1nd1cat10n"It's nice to be nice to the nice." - Frank Burns

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.