Virtual Developer Workshop: Containerized Development with Docker

This demo show how to do transformations on, solid and wire-frame, 3d objects.

Image 1

The class file does all the grunt work for you. the only calls the user makes to the class is to "LoadObject", if the user wants to move or rotate it then they call the "SetRotations" and "SetTranslations" functions. There are also properties that allow the user to get the current translations and rotations for each axis. After the user has done all that, simply call the "RenderObject" routine and bamm!

In the "LoadObject" function you must supply a file path and an device context (picture box) along with initial values you would like set, such as the rotation, scale factor and it's world position.

In the "SetRotations" function there is three parameters. One for the X, Y and Z values. Only supply the one that you want to change. The same goes for the "SetTranslations" function.

There are no parameters for "RenderObject". Enjoy :-)

Download Zipped Project File (16k)


  • great

    Posted by edoov5153 on 03/07/2006 04:24am

    excellent work

  • is there a odf file format description out?

    Posted by Legacy on 08/08/2000 07:00am

    Originally posted by: Andr�


    I want to create a grid of rectangles using odf files so that your wonderful app can display it. (the wireframe only)

    But on the net I could not find any documentation about the format of such an odf file.

    So my question is: Is there any documentation about odf files?

    Thank you!


    • odf description

      Posted by chams on 09/15/2004 04:02am

      odf is not a standard file system. But it works in this way : #1 Header #2 Version #3 Object #4 <-Empty line-> separator #5 to n the next n lines are the points drawing the object (Called vertices by the author). One line per point, (x,y,z). In this sample : 1,1,-1 'point A 1,-1,-1 'point B -1,-1,-1 'point C -1,1,-1 'point D 1,1,1 'point E 1,-1,1 'point F -1,-1,1 'point G -1,1,1 'point H <-Empty line-> separator the following lines ares in fact triangles, refering to the index of the points, follow by the triangle's color. Each triangle must be connect to the previous with two points. In the sample : 0,1,2,255 'refer to points index 0, 1 and 2 ie : A,B,C,colorValue(Long) 2,3,0,255 'refer to C,D,A connect to the previous by A and C, etc... 3,2,6,16776960 6,7,3,16776960 7,6,5,16711935 5,4,7,16711935 4,5,1,65280 1,0,4,65280 4,0,3,0 3,7,4,0 1,5,6,16777215 6,2,1,16777215 With a total of 12 triangles forming the 6 faces of the cube (each face of the cube is draw by 2 triangles) Last Line : END : Quit the loading loop. I think it's possible to do a object converter from Povray's raw-triangles output, because it is a list of triangles connect to the other by to points ;-)) chams

  • email changed

    Posted by Legacy on 07/31/2000 07:00am

    Originally posted by: Chris

    My email has changed for those who care... :-)

    Chris Abbott

  • 3D Rotating Objects Demo

    Posted by Legacy on 05/03/2000 07:00am

    Originally posted by: mor

    I treid to load in VB5, but I got the Msg:
    Retained is an invalid key
    Project1.vbp cant be loaded.
    Please help

  • Note from Author...

    Posted by Legacy on 03/03/2000 08:00am

    Originally posted by: Chris Abbott

    I add new version and other interesting stuff Here: alccentral.cjb.net

  • Fantastic & Really superb chris

    Posted by Legacy on 02/28/2000 08:00am

    Originally posted by: Sathish Balasubramaniam

    Good Show & Great Mind

  • What a wonderfull creation

    Posted by Legacy on 01/21/2000 08:00am

    Originally posted by: Rick

    I think that the author is an increadibly tallented progrmer
    and deserves praise for their work

  • 1815.shtml

    Posted by Legacy on 12/27/1999 08:00am

    Originally posted by: Magnus G�venal

    Very smooth ....

  • Rendering multiple cubes that overlap.

    Posted by Legacy on 11/26/1999 08:00am

    Originally posted by: Pino Carafa

    The sample project is amazing, but alas, there is a problem if you're rendering multiple cubes that could obscure each other.

    The following sample code is an adaptation from the original form code and shows how you have to change the rendering order so that two cubes that are side by side are always displayed correctly.

    It would be nice if the sample program were improved so that it calculates the correct rendering order for a collection of cubes?

    Let me know if and how you're thinking of tackling this problem.

    Many thanks for your help


    Sample code follows:
    Option Explicit

    Private Const PI = 3.141593

    'declare new objects
    Dim obj1 As New cls3dObject
    Dim obj2 As New cls3dObject
    Sub RunDemo()

    Dim dblNewX As Double
    Dim dblNewZ As Double

    Dim lngCounter As Long
    'Rotate both cubes for the correct amount
    obj1.SetRotations obj1.RotateX, _
    obj1.RotateY - 3, _
    obj2.SetRotations obj2.RotateX, _
    obj2.RotateY - 3, _

    'The "outer" cube must be translated to give _
    the impression that both cubes are _
    rotating around a common axis
    dblNewX = 16 * Cos(PI * obj1.RotateY / 180)
    dblNewZ = -75 - 16 * Sin(PI * obj1.RotateY / 180)
    obj2.SetTranslations dblNewX, _
    obj1.TranslateY, _

    'clear picture box, render objects _
    and pause for moment.
    'The sample is indeed amazing. _
    In fact it's so fast I had to slow it down!
    For lngCounter = 1 To 10000

    'But here's the problem. Depending on the amount _
    of rotation, you have to render one cube before _
    the other.
    'where does the value 9 come from? _
    (189 = 180 + 9, 351 = 360 - 9)
    'Would it be possible to create a routine that _
    accepts a collection of cube objects, _
    and performs a calculation to determine the _
    order in which they should be rendered?
    If obj1.RotateY < 189 Or obj1.RotateY > 351 Then
    End If

    End Sub
    Private Sub Form_Load()

    'load each object
    obj1.LoadObject App.Path & "\cube.odf", _
    pic3d, 0, 0, -75, 2, 0, 0, 0
    obj2.LoadObject App.Path & "\cube.odf", _
    pic3d, 16, 0, -75, 2, 0, 0, 0

    End Sub

    Private Sub Form_Unload(Cancel As Integer)


    End Sub

    Many thanks


    • 3D program using c++

      Posted by em_1031609 on 03/12/2008 02:38pm

      can you help me write a code in c++ for 3D objects... A code for rotating 3D objects in x, y, and z axes... thanks...!

  • :-)

    Posted by Legacy on 11/25/1999 08:00am

    Originally posted by: Faris

    OPPPSSSSsss :o)

  • Loading, Please Wait ...

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date