Jump to content
  • Advertisement

Archived

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

game rendering logic

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

Im just wondering a good way to render a whole game. I don't want to start code till I know that the method im thinking of is not bad. Lets say I have a CWorld and CTrees class each with a render() method. The render method would look something like:
render()
{
  select vertex buffer
  drawprimitives
}
 
and then in my game loop:
if( render )
{
  BeginScene
  World->render()
  Trees->render()
  EndScene
}
  
Is this a correct way to do the rendering? Is there any other logic to do it? [edited by - Enselic on January 31, 2003 10:33:44 AM]

Share this post


Link to post
Share on other sites
Advertisement
Thats the idea.

Later on, which you get more experienced, you will want to use visibility checks. Partition up the trees and world into smaller blocks then check to see if they are within the camera view and render just those.

Share this post


Link to post
Share on other sites
Basically you have to decide what are the base objects that need to be rendered, and render them in the main loop. for instance, my mario clone how an object called Level that contains all the world data, so I tell it to render, and I also have an Object called EnitityList that renders all the entities that are visible. Finnally I have an object called HUD that display the status stuff, so I also need to render that. Part of my main loop looks kinda like this each frame:

HUD.Render();
EnitityList.Render();
Level.Render();

no, I don''t hardcode any specific entities, or level or anything. that gets taken care of by the level and enititylist.

so my point is that you might end up making tree''s part of the world object because that object could keep an octree or something that the tree could use as a speed boost. this would make visibility more centralized rather than having one octree for your world, and another for tree, and another for other entities/sprites

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!