Valhalla Legends Archive

Programming => General Programming => C/C++ Programming => Topic started by: Krush[LM] on July 01, 2004, 08:30 PM

Title: [C++] 3D Graphics
Post by: Krush[LM] on July 01, 2004, 08:30 PM
Anyone know about 3D graphics using only the Windows GDI that could possibly help me out?  I need to do clip planes and field of view and some other things and I'm having problems doing it.
Title: Re:[C++] 3D Graphics
Post by: Eibro on July 01, 2004, 08:53 PM
I'm pretty sure the GDI is 2D only. Besides that, it's _slow_.
Title: Re:[C++] 3D Graphics
Post by: Banana fanna fo fanna on July 01, 2004, 11:02 PM
Well all computer graphics are pretty much 2d.

Basically, you're gonna need the algorithm that translates a 3d point to a 2d one. In QBasic:

http://lightning.prohosting.com/~ichinar/Files/tuts/3d.txt

The important stuff you want is:

x2D = 256 * (x3D / (z3D + zCenter)) + xCenter
y2D = 256 * (y3D / (z3D + zCenter)) + yCenter

Then you can go ahead and implement everything on top of that! Good luck!
Title: Re:[C++] 3D Graphics
Post by: Adron on July 02, 2004, 02:39 AM
Quote from: Krush[LM] on July 01, 2004, 08:30 PM
Anyone know about 3D graphics using only the Windows GDI that could possibly help me out?  I need to do clip planes and field of view and some other things and I'm having problems doing it.

What are your problems more exactly?
Title: Re:[C++] 3D Graphics
Post by: iago on July 06, 2004, 08:49 AM
If you want to do cool stuff in 3d, I would recommend getting the DirectX SDK (http://www.microsoft.com/downloads/details.aspx?FamilyId=124552FF-8363-47FD-8F3B-36C226E04C85&displaylang=en) from Microsoft (http://www.microsoft.com)'s site.  It comes with TONS of tutorials and examples of simple and complex things you can do.  Go have a look at the simple stuff, that should scare you away from 3d programming for awhile.

Good luck!

Also, you might want to look up OpenGL.  
Title: Re:[C++] 3D Graphics
Post by: Banana fanna fo fanna on July 06, 2004, 11:48 AM
Quote from: Krush[LM] on July 01, 2004, 08:30 PM
using only the Windows GDI
Title: Re:[C++] 3D Graphics
Post by: Adron on July 06, 2004, 03:03 PM
Quote from: $t0rm on July 06, 2004, 11:48 AM
Quote from: Krush[LM] on July 01, 2004, 08:30 PM
using only the Windows GDI

Well, that, and if he's currently having trouble with clip planes and field of view, he's probably already got the translation algorithm. Trying to help without knowing more exactly what his problems are would require either posting a link to a tutorial or guide (which he could google up himself) or typing a lot (which is too much of an effort when most of it may be wasted anyway).

So, let's hope he posts back with more exactly what he's doing, what results he's getting, and what problems he has.
Title: Re:[C++] 3D Graphics
Post by: Krush[LM] on July 08, 2004, 09:40 PM
It's for this computer graphics class in or I wouldn't even be touching windows gdi.
Title: Re:[C++] 3D Graphics
Post by: Krush[LM] on July 08, 2004, 09:41 PM
Quote from: Adron on July 02, 2004, 02:39 AM
Quote from: Krush[LM] on July 01, 2004, 08:30 PM
Anyone know about 3D graphics using only the Windows GDI that could possibly help me out?  I need to do clip planes and field of view and some other things and I'm having problems doing it.

What are your problems more exactly?

Well with the way I have it current implemented I changing the fov doesn't do much of anything.
Title: Re:[C++] 3D Graphics
Post by: Adron on July 09, 2004, 03:26 AM
Quote from: Krush[LM] on July 08, 2004, 09:41 PM
Well with the way I have it current implemented I changing the fov doesn't do much of anything.

Perhaps you have a flat projection and aren't using the fov at all?

Show the algorithm you're using?