I cannot drawing sprites on 3D
Posted: Wed Mar 01, 2006 3:14 pm
I do ... a merging mesh.pb + sprite.pb
but sprite cannot be drawed with 3d mesh
Is it impossible?
but sprite cannot be drawed with 3d mesh
Is it impossible?
http://www.purebasic.com
https://www.purebasic.fr/english/
No, he meant drawing a GUI or HUD or however you'll call it.Fred wrote:you will have to create a textureif you want to apply it on a 3D mesh.
Code: Select all
; mesh.pd
...
...
If InitEngine3D()
Add3DArchive("Data\" , #PB_3DArchive_FileSystem)
Add3DArchive("Data\Skybox.zip", #PB_3DArchive_Zip)
InitSprite()
InitKeyboard()
InitMouse()
...
;sprirte.pb
LoadSprite(0, "Data\PureBasic.bmp", 0)
CopySprite(0,1,0)
...
...
..
; mesh.pd
Repeat
Screen3DEvents()
...
...
MoveCamera (0, KeyX, 0, KeyY)
RenderWorld()
Screen3DStats()
;;;;;;;;;sprite.pb
DisplaySprite(0, x, 100)
DisplaySprite(1, x, x)
DisplaySprite(0, 600-x, x)
x+1
;;;;;;;;;mesh.pb
FlipBuffers()
Code: Select all
;
; ------------------------------------------------------------
;
; PureBasic - Entity
;
; (c) 2002 - Fantaisie Software
;
; ------------------------------------------------------------
;
IncludeFile "Screen3DRequester.pb"
Define.f KeyX, KeyY, MouseX, MouseY
If InitEngine3D()
Add3DArchive("Data\" , #PB_3DArchive_FileSystem)
Add3DArchive("Data\Skybox.zip", #PB_3DArchive_Zip)
InitSprite()
InitKeyboard()
InitMouse()
If Screen3DRequester()
LoadMesh (0, "Robot.mesh")
; Load a sprite here
;
LoadSprite(0, x"c:\8bits.bmp"x)
CreateMaterial(0, LoadTexture(0, "clouds.jpg"))
CreateMaterial(1, LoadTexture(1, "r2skin.jpg"))
CreateEntity(0, MeshID(0), MaterialID(0))
CreateEntity(1, MeshID(0), MaterialID(1), -60, 0, 0)
CreateEntity(2, MeshID(0), MaterialID(1), 60, 0, 0)
AnimateEntity(0, "Walk")
SkyBox("desert07.jpg")
CreateCamera(0, 0, 0, 100, 100)
CameraLocate(0,0,0,100)
Repeat
Screen3DEvents()
ClearScreen(RGB(0, 0, 0))
If ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left)
KeyX = -1
ElseIf KeyboardPushed(#PB_Key_Right)
KeyX = 1
Else
KeyX = 0
EndIf
If KeyboardPushed(#PB_Key_Up)
KeyY = -1
ElseIf KeyboardPushed(#PB_Key_Down)
KeyY = 1
Else
KeyY = 0
EndIf
If KeyboardPushed(#PB_Key_PageUp)
RollZ = 3
Else
RollZ = 0
EndIf
If KeyboardPushed(#PB_Key_Add)
Frame.f+0.005
EndIf
EndIf
If ExamineMouse()
MouseX = -MouseDeltaX()/10
MouseY = -MouseDeltaY()/10
EndIf
RotateEntity(1, 1, 0, 0)
RotateEntity(2, 1, 0, 0)
RotateCamera(0, MouseX, MouseY, RollZ)
MoveCamera (0, KeyX, 0, KeyY)
RenderWorld()
; Here is the sprite..
;
DisplaySprite(0, 0, 0)
Screen3DStats()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
EndIf
Else
MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf
End
I didn't know that, because Ogre also renders with OpenGL on Linux, so why is there no Ogre OpenGL subsystem?Fred wrote:No, because the engine 3D doesn't work in OpenGL (but you already know that, so why do you asked that ?).