Jump to content
  • Advertisement
Sign in to follow this  
moonshine

How to do a render function?

This topic is 4993 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 struggling to understand how exactly to do this. In my engine I want a function (simply "Render()") that draws everything that needs to be drawn in a frame. Before I get to it I need to understand how to do it - ie what needs to go in it, how to structure it etc. Can anyone help explain it to me? Cheers :)

Share this post


Link to post
Share on other sites
Advertisement
You may need to ask some more specific questions. A 'render' function can be arbitrarily complex depending on what features you're trying to support, and is often broken up into smaller functions. So what exactly do you want to achieve?

For a simple case, though:

1. Clear color and z buffers
2. Render static objects
3. For each dynamic object
a) Push matrix
b) Set model matrix
c) Render model
d) Pop matrix
4. Flip buffer

That's off the top of my head, so I may have missed something.

Share this post


Link to post
Share on other sites
Later on, you will be sorting objects by material, depth (in some cases)...

I also suggest that you start with the one previously suggested by jyk.

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!