Sign in to follow this  
moonshine

How to do a render function?

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this