Skip to main content
GameDev.net gamedev.net
🔒 Locked

How to do a render function?

Started by moonshine Nov 14, 2004 at 7:16 PM 1 replies 650+ views
Original Post
moonshine
moonshine
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 :)
Zakwayda
Zakwayda
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.
jjmontes
jjmontes
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.
-=[ J ]=-I always forget to change the tagline.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.