Jump to content
  • Advertisement
Sign in to follow this  
fathom88

OpenGL OpenGL and Multi-Core CPU

This topic is 4554 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I noticed the benmarks on multi-core CPU's aren't better than a single core CPU of the same speed. I've read that computer games aren't multi-threaded. It's seems pretty confusing. Can't you simply call CreateThread like in VC++? I would hate to think DOOM 3 runs in some huge single case loop. Do they mean single threaded in terms of rendering (only one draw thread)? This makes sense because OpenGL allows for multiple contexts but only one per thread. In this case, will mutliple-core CPU's benefit OpenGL? Or is there a way to render with muliple threads? Just a general question mostly for fun.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
the games can profit from multi cores,
but not really in terms of rendering,

but everything else can seperated, if you plan carefully.
Physics, AI, World Pre Loading etc. etc. can work on the second core
and fetch new data to the rendering process.


Marc

Share this post


Link to post
Share on other sites
Quote:
Original post by fathom88
>>fetch new data to the rendering process


I'm curious. Could you explain further?


The rendering process obviousely comes last in the game loop/cycle, as all information must be ready and updated. Basically, and I do any of my games this way, is that you have a process queue, and everything gets processed when needed/requested. They all perform calculations on a large chunk of data, such as your mesh data/texture data/etc... The renderer, which now uses the GPU, then takes all this data and renders the scene. In single threaded applications, there's no problems with this, but in multi-threaded applications, problems arise such as you modifying data during the render cycle that shouldn't be changed. People usually put a lock on the renderer, and perhaps have a buffer where they can store things for the next render.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
ID released a patch for Quake4, that adds multithreading to the engine; go to http://www.firingsquad.com/hardware/quake_4_dual-core_performance. The performance increase on Pentium D & Athlon X2 is very big (of course if game settings don't make it fillrate limited). Even Pentiums with HyperThreading advance from this a bit. If more games are written with multithreading in mind, I guess dual-core CPUs will become standard...

Share this post


Link to post
Share on other sites
Quote:
Or is there a way to render with muliple threads?


Nope, opengl can only be used in the same thread it was initialised in.

Share this post


Link to post
Share on other sites
Quote:
Original post by MENTAL
Nope, opengl can only be used in the same thread it was initialised in.
That's not exactly true. It can be used in any thread as long as the OpenGL context is made current in that thread, but it can only be current in a single thread at a time. It's usually best to avoid the context switches and just do all OpenGL work inside the thread that created the context though.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!