Basic 3D Shape Commands?

Just starting out? Need help? Post your questions and find answers here.
Yerrel
User
User
Posts: 14
Joined: Mon Sep 13, 2004 9:15 pm

Basic 3D Shape Commands?

Post by Yerrel »

Hoi there again,

After experimenting with PureBASIC, reading the manual etc.., i have a very very important question and that is:

Is there any 3D command for making a cube or cone or triangle or other basic 3D-shapes?
If not, how do i accomplish this? like creating a Cube, Triangle, Cone, sphere and so on.

Please help me! coz i need some serious help here..
:evil:

Tnx for you help..
LarsG
Enthusiast
Enthusiast
Posts: 713
Joined: Mon Jun 02, 2003 1:06 pm
Location: Norway
Contact:

Post by LarsG »

The current implementation of OGRE doesn't support making primitives in PB.

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
Yerrel
User
User
Posts: 14
Joined: Mon Sep 13, 2004 9:15 pm

Post by Yerrel »

LarsG wrote:The current implementation of OGRE doesn't support making primitives in PB.
Okay!

than can you give me a example-code or any Purebasic tutorial link that i can learn from on how to make Primitives plz.. :lol:

tnx
User avatar
waffle
Enthusiast
Enthusiast
Posts: 129
Joined: Mon May 12, 2003 1:34 pm
Location: USA
Contact:

Post by waffle »

the simplest method that I have used is to just do them
in MS3D and export as .mesh. Then just rescale them in code.
If you do a search for a desired shape, I think there is code
for creating shapes 1 polygon at a time. I'm sure I saw one for
spheres, cubes and planes are simple to construct.

edit:
Well, I did a search and the best I came up with was this...
viewtopic.php?t=10893

It shows how to load an MS3D ascii file. From this,
you should be able to see how vertexes are aranged and
polygons connected.
Code is good... Its an international language.
User avatar
Erlend
Enthusiast
Enthusiast
Posts: 125
Joined: Mon Apr 19, 2004 8:22 pm
Location: NORWAY

Post by Erlend »

Hi Yerrel

This can hopefully help you somewhat...
http://home.c2i.net/PreachersPlace/Pure ... ibrary.zip

My docs are not in the best of states, but there is a example that is quite explaining, would be very interested in feedback.

Erlend "Preacher" Rovik
Yerrel
User
User
Posts: 14
Joined: Mon Sep 13, 2004 9:15 pm

Post by Yerrel »

Erlend wrote:Hi Yerrel

This can hopefully help you somewhat...
http://home.c2i.net/PreachersPlace/Pure ... ibrary.zip

My docs are not in the best of states, but there is a example that is quite explaining, would be very interested in feedback.

Erlend "Preacher" Rovik
Hoi Erlend,

It must be great if it only could work. :lol:
But nothing happens when i run it!
Worse, i get the following error:

Line 25: QVertex() is not a function, an array or a linked list. :?:

Is it something that i have to do? like putting the required library somewhere? or need to Dload the needed Library?

Hope u can correct or guide me with this problem...

tnx,
Yerrel
olejr
Enthusiast
Enthusiast
Posts: 152
Joined: Sun Jul 11, 2004 7:48 pm
Location: Lillehammer, No(r)way
Contact:

Post by olejr »

You have to put the QMesh lib (in the archive)
into purelibraries\userlibraries...
Yerrel
User
User
Posts: 14
Joined: Mon Sep 13, 2004 9:15 pm

Post by Yerrel »

olejr wrote:You have to put the QMesh lib (in the archive)
into purelibraries\userlibraries...
Done that and the examples do execute. :lol:
But i still don't understand it at all.. :D ... Cozx i am a real beginner @ PureBASIC ( programming ).

Coz i am looking for something like Createcube() or like Make Cube).
Your library seems to be okay if u could only type just a little documention about how to use it etc...

....
Yerrel
olejr
Enthusiast
Enthusiast
Posts: 152
Joined: Sun Jul 11, 2004 7:48 pm
Location: Lillehammer, No(r)way
Contact:

Post by olejr »

Example. Here I use only QCube()(create a cube..). Don't ask me what else the
librarys does, I don't use it... :)
This is a result of 2 minutes of reading through the code..
As he (Erlend) say at the top of the source:
Best way to learn/understand is to test and modify

Code: Select all

;Example for the QMesh Lib.

;Best way to learn/understand is to test and modify, so enjoy...... 
; Erlend "Preacher" Rovik

;Simplified to show QCube() by olejr

;textures are in the original QMesh archive..
image.s="qmesh_texture.jpg"; remember sizes 64*64 128*128 etc.
earth.s="earth.jpg"
cube.s="cube.jpg"

#CameraSpeed = 1

DefType.f KeyX, KeyY, MouseX, MouseY


If InitEngine3D()
  InitSprite()
  InitKeyboard()
  InitMouse()
  
  If OpenWindow(0,0,0,300,300,#PB_Window_SystemMenu,"Example")
     OpenWindowedScreen(WindowID(), 0, 0, 300,300, 0, 0, 0)
    
    ;These 3 lines are for createing the Cube
    QCube()
    QObject(5)
    CreateEntity(5, MeshID(5), CreateMaterial(5, LoadTexture(5,cube)))

    ; Then setup Camera and put it in place
    CreateCamera(0, 0, 0, 100, 100)
    CameraLocate(0,0,0,20)
    
    Repeat
      ;Everything here is for rotating mesh (cube)/ Moving Camera 
      ClearScreen(0, 0, 0)

      If ExamineKeyboard()
        If KeyboardPushed(#PB_Key_Left)
          KeyX = -#CameraSpeed 
        ElseIf KeyboardPushed(#PB_Key_Right)
          KeyX = #CameraSpeed 
        Else
          KeyX = 0
        EndIf
                  
        If KeyboardPushed(#PB_Key_Up)
          KeyY = -#CameraSpeed 
        ElseIf KeyboardPushed(#PB_Key_Down)
          KeyY = #CameraSpeed 
        Else
          KeyY = 0
        EndIf

      EndIf
      If ExamineMouse()
        MouseX = -(MouseDeltaX()/10)*#CameraSpeed/2
        MouseY = -(MouseDeltaY()/10)*#CameraSpeed/2
      EndIf

      RotateEntity(5, 0.4, 0.4, 0.4)
      RotateCamera(0, MouseX, MouseY, RollZ)
      MoveCamera  (0, KeyX, 0, KeyY)
      
      ;Here we render (draw) the world
      RenderWorld()
      FlipBuffers()
      Delay(3)
      
    Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
  EndIf
EndIf
Yerrel
User
User
Posts: 14
Joined: Mon Sep 13, 2004 9:15 pm

Post by Yerrel »

[quote="olejr"]Example. Here I use only QCube()(create a cube..). Don't ask me what else the
librarys does, I don't use it... :)
This is a result of 2 minutes of reading through the code..
As he (Erlend) say at the top of the source:
Best way to learn/understand is to test and modify

Code: Select all

;Example for the QMesh Lib.

;Best way to learn/understand is to test and modify, so enjoy...... 
; Erlend "Preacher" Rovik

;Simplified to show QCube() by olejr


Okay thanks Olejr  :wink: 

Bcoz of work i can't hardly find time to do some heavy reading or xperimenting.. But time will come to dig into PureBASIC..

Diz code is clear as dunnow what  :D 

Now i understand the Qmesh Lib...

tanx 2 all
Post Reply