Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Rendering structure


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 TomA3000   Members   -  Reputation: 361

Like
0Likes
Like

Posted 23 May 2013 - 01:32 PM

Hi, my question is, "What is the best way to structure rendering code".
Is it better to make a class with a render function that iterates through all game objects
based on there name or type and have no state manager or is it better 
to make a class with functions like drawpolygon, drawmesh, drawline and use it in a state class
or is there something else that works better?
Thank you in advance.

Sorry for my bad english

Sponsor:

#2 Jason Z   Crossbones+   -  Reputation: 5164

Like
3Likes
Like

Posted 24 May 2013 - 08:43 AM

It totally depends on what you want to do with your rendering code.  The best way to structure your code is to make it flexible so you can choose the right tool for the job at hand.  My engine allows for both of the mechanisms that you mentioned, but in my case each object carries around its own material information.  The 'state manager' then ensures that there aren't multiple API calls made to set the same data more than once.

 

The latter of your two ideas is usually called an immediate renderer or something similar.  It is generally a higher level object that simplifies the usage of the graphics hardware at the cost of performance.



#3 Burnt_Fyr   Members   -  Reputation: 1245

Like
1Likes
Like

Posted 28 May 2013 - 10:38 AM

+1 to what Jason said and or did. Having access to both a typical retained mode , where data is loaded into buffers created and destroyed by the renderer itself, as well as an immediate mode, where you can supply geometry on the fly,is a great boon to debugging("why is this model's lighting not working?, lets draw some normals quick and find out")

 

Every time I poke through Hieroglyphs source I learn something. Most recently it was how nice creating vertex layouts procedurally from user supplied data is, whereas before I had always had predefined Vertex types defined in the graphics lib that my app had to use. When I'm done, I will have the flexibility to complete define data from outside the graphics lib.



#4 Jason Z   Crossbones+   -  Reputation: 5164

Like
0Likes
Like

Posted 28 May 2013 - 01:44 PM

Every time I poke through Hieroglyphs source I learn something.

That is really great to hear - it makes me happy to know someone is getting some benefit from the engine :)






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS