I am wondering . . . . . .
-
- User
- Posts: 14
- Joined: Sat Jan 06, 2018 4:54 am
- Location: Saint George, Utah
- Contact:
I am wondering . . . . . .
Hello Everyone on the board, Is there a easy way to program in 3D? Also is there some special files to download to add within PB to program in 3D or OpenGL?
Re: I am wondering . . . . . .
Hi RealUser60
you either have a choice of Ogre 3d or Opengl, the easiest to use is the Ogre 3d as demonstrated by the examples in PureBasic\Examples\3D. a one line in purebasic Ogre 3d equal many complex lines in Opengl.
the first thing is to install DirectX v9 from:
http://download.microsoft.com/download/ ... redist.exe
it will not harm the DirectX 10 or 11 in windows 8 or 10
another option is to write the word opengl in Compiler -> Compiler options -> Library subsystem. try this option before installing DX9
here is a small example:
the purpose of 3D programming is to create a scene
** we can't see a scene unless we look at it with our eyes, the eyes here is represented by the Camera, so the first thing is to create a camera
camera = CreateCamera(#PB_Any, x, y, Width, Height )
look example in https://www.purebasic.com/documentation ... amera.html
and the example Camera.pb
** the second thing is to fill the scene in which we look at it through our camera with Objects such as ground ,spheres, cubes, cylinder, torus,tube, trees, robots, or just a point in the middle of the scene.
some notes:
CreateCube()
CreateEntity()
Or
CreateMesh()
CreateEntity()
the entity is an instance of the Mesh, ie we can make hundreds of entities from the same Mesh
the mesh can be sphere made using CreateSphere, or any other fancy shape created by CreateMesh and related functions.
also use Light created with CreateLight or the scene will be semi black
to change the position of the camera or the objects use MoveEntity, remember it has a parameter #PB_Relative or #PB_Absolute
try to change the numbers in small amounts to see its effect
also we can dress the scene objects with a clothes, the clothes called here Material, to create a material we must first create a texture, and we can make several materials from the same texture . look example Texture.pb and Material.pb
your biggest help and friend is the examples in (PureBasic\Examples\3D)
there is also a greate other 3D egine called MP3D Engine Alpha 32:
http://www.purebasic.fr/english/viewtop ... hilit=mp3d
it needs also DirectX v9
works better in PB 5.61 ie it needs unicode as i have discovered recenly (except the shaders which needs ascii)
to install it run this setup: http://www.flasharts.de/mpz/mp33_beta/M ... taller.exe
in PB 5.61 , choose v5.50 from the list , and even you will get some error messages but continue until finishing the install
try as an example PureBasic\Examples\MP3D Demos\2DPhysik
other examples needs only little corrections
and you will be surprised by this engine achievments, but beware its developer is busy so your questions, you must be patient.
you either have a choice of Ogre 3d or Opengl, the easiest to use is the Ogre 3d as demonstrated by the examples in PureBasic\Examples\3D. a one line in purebasic Ogre 3d equal many complex lines in Opengl.
the first thing is to install DirectX v9 from:
http://download.microsoft.com/download/ ... redist.exe
it will not harm the DirectX 10 or 11 in windows 8 or 10
another option is to write the word opengl in Compiler -> Compiler options -> Library subsystem. try this option before installing DX9
here is a small example:
Code: Select all
InitEngine3D()
InitSprite()
InitKeyboard()
OpenWindow(0, 0, 0, 800, 600, "simple scene", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 800, 600)
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 3, 20)
CameraLookAt(0, 0,0,0)
;CreateLight(#Light, Color [, x, y, z [, Flags]])
CreateLight(1, RGB(120,200,120), 0,100,20)
CreateCube(0, 1)
CreateEntity(0, MeshID(0), #PB_Material_None, 0, 0, 0)
;create ground entity using the Cube mesh number 0 created above
CreateEntity(1, MeshID(0), #PB_Material_None, 0, -5, -5)
; and then we scale it to resemble a ground
ScaleEntity(1, 10,0.5,10)
Repeat
Repeat
event = WindowEvent()
Until event = 0
RotateEntity(0, 0,1,0, #PB_Relative)
RenderWorld()
FlipBuffers()
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
** we can't see a scene unless we look at it with our eyes, the eyes here is represented by the Camera, so the first thing is to create a camera
camera = CreateCamera(#PB_Any, x, y, Width, Height )
look example in https://www.purebasic.com/documentation ... amera.html
and the example Camera.pb
** the second thing is to fill the scene in which we look at it through our camera with Objects such as ground ,spheres, cubes, cylinder, torus,tube, trees, robots, or just a point in the middle of the scene.
some notes:
CreateCube()
CreateEntity()
Or
CreateMesh()
CreateEntity()
the entity is an instance of the Mesh, ie we can make hundreds of entities from the same Mesh
the mesh can be sphere made using CreateSphere, or any other fancy shape created by CreateMesh and related functions.
also use Light created with CreateLight or the scene will be semi black
to change the position of the camera or the objects use MoveEntity, remember it has a parameter #PB_Relative or #PB_Absolute
try to change the numbers in small amounts to see its effect
also we can dress the scene objects with a clothes, the clothes called here Material, to create a material we must first create a texture, and we can make several materials from the same texture . look example Texture.pb and Material.pb
your biggest help and friend is the examples in (PureBasic\Examples\3D)
there is also a greate other 3D egine called MP3D Engine Alpha 32:
http://www.purebasic.fr/english/viewtop ... hilit=mp3d
it needs also DirectX v9
works better in PB 5.61 ie it needs unicode as i have discovered recenly (except the shaders which needs ascii)
to install it run this setup: http://www.flasharts.de/mpz/mp33_beta/M ... taller.exe
in PB 5.61 , choose v5.50 from the list , and even you will get some error messages but continue until finishing the install
try as an example PureBasic\Examples\MP3D Demos\2DPhysik
other examples needs only little corrections
and you will be surprised by this engine achievments, but beware its developer is busy so your questions, you must be patient.
Re: I am wondering . . . . . .
I personally recommend using the OGRE library first, especially if its your first real foray into 3D stuff. It is more than capable of doing some cool things. And I have to say, I found it very straightforwards.... I even managed to load blender models via some tools.
Proud supporter of PB! * Musician * C64/6502 Freak
- Psychophanta
- Addict
- Posts: 4997
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Lípetsk, Russian Federation
- Contact:
Re: I am wondering . . . . . .
Hi RealUser60,
if you only need it under windows, I strongly recomment to you the MP3D library, because it is much powerful (and also easier to use) than the current 3D stuff implemented in PB.
If you want to try:
http://www.purebasic.fr/english/viewtop ... 27&t=43601
NOTICE: ask to me for the complete package if you are not able to obtain it.
if you only need it under windows, I strongly recomment to you the MP3D library, because it is much powerful (and also easier to use) than the current 3D stuff implemented in PB.
If you want to try:
http://www.purebasic.fr/english/viewtop ... 27&t=43601
NOTICE: ask to me for the complete package if you are not able to obtain it.
http://www.zeitgeistmovie.com
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB