Sign in to follow this  
speedie

ideas on putting together a render/graphics engine

Recommended Posts

speedie    140
I'm getting close to finishing my renderer, but I'm curious as to how all of you organized yours. Currently my core encapsulates DirectX, texture management, Light management, and fonts. my next goals were to allow loading and displaying of 2D animations, and a Particle engine. For these types of things, do you guys just pile it all into your graphics class, or do you make seperate classes that use the graphics class. What are the pros/cons of both?

Share this post


Link to post
Share on other sites
Benjamin Heath    925
I have a class called VideoHandler that intializes SDL video and sets up OpenGL (which I could replace with Direct3D or some other system since it's hidden). It keeps a list of Sprites, which are rendered every time an "update" event is handled. Sprites contain Surfaces (which are just texture objects) and Sprites also have a parent and a list of children. For a sprite to be rendered, it must be added to the list of sprites.

Derived from Sprite, there is also AnimatedSprite (which contains an array of rectangles), String (which uses a Font), and TileMap. (Yes, a tilemap is a sprite.)

It works well, but it's still very young.

Share this post


Link to post
Share on other sites
Quote:
Original post by speedie
I'm getting close to finishing my renderer, but I'm curious as to how all of you organized yours.

Currently my core encapsulates DirectX, texture management, Light management, and fonts.

my next goals were to allow loading and displaying of 2D animations, and a Particle engine. For these types of things, do you guys just pile it all into your graphics class, or do you make seperate classes that use the graphics class. What are the pros/cons of both?


There should be a group of classes that interact with each other, not one monolithic class - monolithic classes kind of defeat the purpose of having classes in the first place.

Search for the Renderable() idiom on GameDev - there's been plenty said about it.

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