Sign in to follow this  
SteveHatcher

Converting procedural directX program to objects...

Recommended Posts

SteveHatcher    1236

Hi guys,

 

I have a fully procedural simple directX program which I would like to turn into proper oop design with structs and classess. I am a bit at a loss as what should go where in the setting up of this though.

 

Right now my program first initializes a window -> this can stay the same in the new code.

 

It then initalizes Direct3D. Where is the right place to stop this? at D3D11CreateDeviceAndSwapChain? My code goes up until OMSetRenderTargets.

 

It then initiates the 'scene' which is essentially the viewport.

 

It then initiates the objects which are just a bunch of predefined vertices making simple shapes.

 

Then finally Render() is called in a loop which draws my shapes after their translations and / or rotations have been calculated.

 

Now how would I go about turning this simple program into objects? I am confident I can make a program which will create a graphics 'object' and then initialize the directX window but I am at a loss as to how to store and call up the geometry.

 

Would something like a class 'geometry' that stores all the vertex buffers work? I would then like to chose what to draw with a command like square.draw(). The problem is I just can't visualize how this is done from my procedural program where the vertex descriptions and directx stuff is all together.

 

Thanks

Edited by SteveHatcher

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