Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / I have done it! 3D objects drawn in 2D!

Author
Message
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 30th Nov 2009 03:29
This is a little project that i have been working on/am working on. It was a project to help me learn how the 3D world in DirectX works.

It uses matrices to transform the vertices. The meshes are stored in a type that has a vertex buffer which stores all the points of the mesh, and a index buffer which indexes all the points to create the polygons.

Everything is drawn using a pointer to bitmap 0 data(from the GetBitmapData Command) and then every loop is set back with the SetBitmapData command.

I got about 30-35 fps with 500 pyramids on screen. i had no noticable drop until around 400 pyramids.

use the mouse to look around and wsad to move. Space will jump(gives you a better view of all the objects)

you can input the number of objects to draw at the beginning. the exe is attached. here is a screen shot:



thats 495 pyramids and 5 boxes. all with a size of 10(the pyramids have a 10x10 base and the boxes are exact cubes) as you can see it's at 30 fps, but that's when they are all on screen.

New Site! Check it out \/

Attachments

Login to view attachments
Easelm
14
Years of Service
User Offline
Joined: 26th Nov 2009
Location:
Posted: 30th Nov 2009 04:02
Awesome!
Hayer
18
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Norway
Posted: 30th Nov 2009 13:09
if I am right this can be pretty helpful for 3d editors?

Looks fancy! Any chance for you to write a function of it, so u can get "2d'd" object with just a function call, like

render2DD(objNr)

Keep it simple.
Questions? Mail me
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 2nd Dec 2009 04:56
Sorry for the late reply.

Well this doesn't use db object functions at all. It uses it's own vertex declerations. It is possible to create/load a object and convert it to it's own mesh in my functiosn but they are completely different things.

My functions run off of pointers to pixel data and draw the objects directly to the screen(well in my example i send a pointer to bitmap 0 data).

New Site! Check it out \/
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 5th Dec 2009 08:09
Here's the source:




any questions feel free to ask. All functions are competely portable. exept for the trasitionColor function(i didn't define my own rgbr,g,b functions) so you can just copy and paste this code and use it on linux with SDL if you wanted to, because it just takes a pointer to a 640x480 bitmap.

New Site! Check it out \/

Login to post a reply

Server time is: 2024-10-01 18:40:07
Your offset time is: 2024-10-01 18:40:07