Sign in to follow this  
masd

3D Programming using GDI?

Recommended Posts

Quote:
Original post by masd
Is it possible to do 3D programming using only GDI?

Possible? Yes. Don't do it though.
Seeing as GDI is considered awfully slow even for simple 2D games, if you're aiming for that I'd move up to OpenGL and/or DirectX at some point.

Share this post


Link to post
Share on other sites
There are a few 3D games using just GDI.

You basically have to program your own engine though. There are no premade calls to matrices, vertices, etc.

Just know lots, and lot of math. Honestly, I'd suggest for anyone interested in programming 3D to make their own 3D engine at least once, without OpenGL or D3D. Learn how to calculate everything, learn how to filter, etc.

Share this post


Link to post
Share on other sites
Quote:
Original post by masd
Can u explain a little, how it is possible? I mean doing 3D programming in GDI... Can u refer any artilce/stuff about it?


we just had a discussion about this. basically, to do it with GDI you'd want to use a device dependent "bitmap", and calculate the rendering yourself. at the end you would only call BitBlt, so it wouldn't involve GDI all that much at all.

here's a link to a good Vesa page. outdated as it is, it will expose you to 3D concepts like shading.

Share this post


Link to post
Share on other sites
There is a good example on codeguru.com that draws a cube and rotates it, Also shows a basic engine to perform the task.

<<http://www.codeguru.com/Csharp/Csharp/cs_misc/graphicsandimages/article.php/c8185/>>

Share this post


Link to post
Share on other sites
Its possible to do any type of graphical work with GDI, but it would be slow, and difficult. If your interested in learning about 3D graphics wo/DX,OpenGL you should read "Black Art Of 3D Game Programming" or "Tricks of the 3D Game Programming Gurus" both by Andre' LaMothe.

As for MS releasing a HW accelerated version of GDI, I think one is planned for LongHorn - considering that LH has been pushed back twice tho, I wouldn't hold my breath for it.

Share this post


Link to post
Share on other sites
Quote:
Original post by Onemind
Its possible to do any type of graphical work with GDI, but it would be slow, and difficult. If your interested in learning about 3D graphics wo/DX,OpenGL you should read "Black Art Of 3D Game Programming" or "Tricks of the 3D Game Programming Gurus" both by Andre' LaMothe.
Bad advice.

Both of the books you mentioned are targeted at DOS. They don't address the GDI bottleneck at all. The only thing that does is using Direct3D surfaces or OpenGL render contexts for presentation while performing all the 3D calculations in software.

It should be noted that the GDI bottleneck is not all that severe on contemporary hardware. As anist mentioned, all that you'd need GDI for is calling BitBlt to present the results of all the 3D operations.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Oluseyi
Quote:
Original post by Onemind
If your interested in learning about 3D graphics wo/DX,OpenGL you should read "Black Art Of 3D Game Programming" or "Tricks of the 3D Game Programming Gurus" both by Andre' LaMothe.
Bad advice.

Both of the books you mentioned are targeted at DOS. They don't address the GDI bottleneck at all.

While its true that neither of the books address the GDI bottleneck, its not true that "Tricks of the 3D Game Programming Gurus" is targeted at DOS. Do you own the book (2003 ed), I think all the demos are Win32 based. Also, the engine that the book helps you create only uses DirectDraw for blitting to the screen, and not Direct3D, so if you wanted to create a 3D engine that used the GDI, all you would need to do is swap calls to DirectDraw functions with calls to the GDI for blitting graphics.

I must admit, that some of the book's techniques seem outdated, especially for it being published in 2003, but I would say its a very good starting point towards implementng your own 3D Engine.

Share this post


Link to post
Share on other sites
If you want to try dong 3D in GDI then checkout GCL (GDI Console Layer).Check out the screenshots on the page.

It makes using GDI as easy as Mode13h by giving you a linear char buffer to which you can draw. It also provides you with keyboard i/o and someother things.You can have any screen dimentions you like too.

The best thing about is that you can try out the tutorials which are directed towards Mode13 or vesa modes.Mostly all tutorials on rasterization and algorithms are directed towards these.

Helps?

Share this post


Link to post
Share on other sites
Although I would not recommend using the GDI for anyting but toy implementations of 3D... If you'd like to see a cool application of the concept check out the "I, Robot" arcade game emulator:

http://mywebpages.comcast.net/lordfrito/irobot/

Here is the quote from the ReadMe explaining the motivation behind using the GDI:

"
COOL feature - metafile dump to Window's clipboard:
---------------------------------------------------
Yes, that's right, a _metafile_ dump. After studying the hardware graphics functions available on the hardware, it dawned on me that there was a 1:1 correspondance between the I, Robot display routines implemented in hardware and routines present in the Windows GDI. With about 15 lines of code I added 100% clipboard support for the game.
"

Just don't ask about ROMs, OK?

Share this post


Link to post
Share on other sites
Quote:
Original post by sakky
I wonder if Microsoft will ever develop a Hardware Accelerated GDI that is as fast as Direct3D or OpenGL.


No they won't since they're using Direct3D (or OpenGL, anyways a one of them) for Longhorn

Share this post


Link to post
Share on other sites
If you can plot a pixel, you can theoretically do pretty much anything. One time I was reading a biology book and it had a diagram of a cross-section of an eye, and it suddenly hit me why objects look smaller as they get farther away (it's not just a corallary fact! There is very simple a reason!) and from there I made a couple functions that did the necessary math to project points in "3D Space" on a 2D screen, and I had eight points which were the corner of a box that would transform across the screen, and to a fro.

As simple as it sounds, I was wicked excited! I then researched line-drawing algorythms so that I could connect those points into a polygonal wireframe, and then I learned how to fill those polygons in with color, and how to alter the color according to their normals with respect to some arbitrary light source. It was a pretty cool looking thing.

Before I got any further, though, I switched to OpenGL and SDL. That stuff is fun to dick around with, and I might write a ray tracer someday, but it doesn't really produce anything useful.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I'd recommend using DirectDraw to get direct access to video memory if you want to play with low level graphics.

see http://www.icarusindie.com/DoItYourSelf/rtsr/realtime3d/lessons34-38.php

coredx.cpp is what you need to see how to lock the backbuffer to plot pixels to it. core.cpp uses OpenGL to do the same thing except OpenGL doesn't give direct access to video memory. You have to render to a texture first and then render the texture to a quad.

The lessons themselves demonstrate how to render to your own custom video memory buffer (a simple array) and then the core file translates that buffer into whatever it takes to show it to the user.

With ray tracing you can go directly to video memory since there's zero over draw. With everything else it's easier to render to a custom buffer and then convert that over to whatever format the real video buffer uses.

The tutorials at the site cover everything you need to know to get started.

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