# simple/light (wireframe) 3d graphic engine

Hello,
I need a simple/light (wireframe) 3d graphic engine C/C++ source, that I can do point and vector line drawing with and control the view from. (rotate point/vector, move view etc)

Now I have search the web for hours looking for some and all I can seem to find is stuff that is fare more complicated than I need, or stuff that looks perfect but has a dead link.

The only on that look about for me is the following, but I can get figure out how to define an object as it has little to none documentation.
http://www.fastgraph.com/makegames/3Drotation/3dsrce.html

If anyone knows one of one out in web space please post.

• : Hello,
: I need a simple/light (wireframe) 3d graphic engine C/C++ source,
: that I can do point and vector line drawing with and control the
: view from. (rotate point/vector, move view etc)
:
: Now I have search the web for hours looking for some and all I can
: seem to find is stuff that is fare more complicated than I need, or
:
: The only on that look about for me is the following, but I can get
: figure out how to define an object as it has little to none
: documentation.
: http://www.fastgraph.com/makegames/3Drotation/3dsrce.html
:
: If anyone knows one of one out in web space please post.
:
: Many thanks in advance IMK
:
:
It isn't hard to implement your own code for that. In fact, I'm sure your code would be easier to write and understood by you than anything you'd find online. I made a short program, 100 to 200 lines in Delphi that may be of use to you. It also includes a PDF to explain the math behind its space to plane projections.

Look at the .pas(Pascal language) and PDF files in:

If you want to use perspective and see from viewpoint (0,0,0), you can map a 3D vertex position(X,Y,Z) using this:
x = X/Z.
y = Y/Z.

If you move the viewpoint, just subtract the new viewpoint from the vertex before doing the above math.

If you want to rotate the camera, you could use a 3D rotation matrix. One that lets you rotate around the x, y, and z axis. Again, you just transform the vertex (X,Y,Z) before doing the above math. Constructing a 3D rotation matrix is on wikipedia at: http://en.wikipedia.org/wiki/Rotation_matrix#Nested_dimensions
You can create a single transformation matrix from all 3 rotation angles by multiplying the 3 matrices together.

I used these techniques in an applet you can see here:
http://socr.uwindsor.ca/~greig3/testing/PolyMapping/appletExample.html

The source code is open but it is significantly larger and more complex than the pascal program referred to earlier. If you want the Java source, it is available at: http://www.programmersheaven.com/download/54752/download.aspx