Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.



This topic is 6123 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

well i''m rather new with OpenGL, i''m now making (planning to make) a game using OpenGL, i''ve already completed the OOP analysis and design but i''m not quite sure how i''m going to use use the openGL functions in OOP, all of NeHe''s tutorials are in structured programming techniques. Will i need to change anything, for example will i need to use threading techniques for multi object movement?? will this slow down the performance??

Share this post

Link to post
Share on other sites

i haven''t done much structured programming, just OOP all the way, and i couldn''t say that OOP programs run slower than "structured" programs in any way. there was a debate on the subject some time ago in this forum. if you search for it, you can read it and you''ll see that most people who have dealt with OOP agree with me.

p.s. you can see signs of structured programming in NeHe''s examples because these are EXAMPLES. and examples are all about clarity and entirely serve the purpose of being easily understandable. in real life (lol) i couldn''t imagine drawing cubes the way it''s done in some of NeHe''s exaples. for me it would be natural to write a class or struct for it.
p.p.s. if you really understand the way OOP programs work you should have no problem converting NeHe''s examples to OOP. besides OOP IS used in the tutorials - e g (i''m not at all sure!) in lesson 11.

keep cool!

Share this post

Link to post
Share on other sites
Be careful when threading. This doesn''t only apply to OOP.

One thing That does apply to all graphics programming, is the large amout of data being held in the L2 cache. If another thread takes over, the L2 will be dumped, so a transfer from RAM to L2 will happen when a drawing thread takes over. This can have enormous effects on the overal performance of a game. Even in a 2 CPU enviroment, the best kind of gain you will have is around 15 - 25%. In a single CPU setup, expect a performance hit of around the same percentage.

BUT, having said that, there are instances when multiple threads on a single CPU can be beneficial. Say for example you instruct the driver to read large amounts of data from AGP mem - the driver is effectively stalled until the GPU returns ... which mean that the CPU is sitting idle - in this case threading makes sense to do other (maybe input, network, AI) work. It''s a very fine line to tread.

I''ve knocked OOP in here before - I don''t think It really applies to games. And check out some figures on the web - context swtiching in Windows can, in extreme cases, take as long as 10ms - that''s a huge amount of time.

Before I get flamed again - I use objects alot in a business enviroment. I will also use threads. But threads in that context are used mostly for the responsiveness of an app - not it''s overall performnce.

Now I''ve said all that ... if you feel happier with OOP, then use it. It will simplify the development process for you a great deal. But be carefull with threading - as I said - it can backfire in terms of performance an awful lot.

Have fun with your game

Share this post

Link to post
Share on other sites

  • 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!