Rook Zimbabwe wrote:I am having troubles making a already loaded image work with Imagegadget 3D() the text from the online manual is slightly confusing... do I need to make it a texture???
Yes.
Anyone got a working example of the DUI 3D Imagegadget working?
added 3 lines in the Gadget3D.pb example.
Code: Select all
;
; ------------------------------------------------------------
;
; PureBasic - Gadget 3D
;
; (c) Fantaisie Software
;
; ------------------------------------------------------------
;
#CameraSpeed = 10
#MainWindow = 0
#CloseButton = 0
#Image3D = 1 ; <<< NEW
IncludeFile "Screen3DRequester.pb"
Define.f KeyX, KeyY, MouseX, MouseY
If InitEngine3D()
Add3DArchive("Data/", #PB_3DArchive_FileSystem)
Add3DArchive("GUI/", #PB_3DArchive_FileSystem)
Add3DArchive("Data/skybox.zip", #PB_3DArchive_Zip)
InitSprite()
InitKeyboard()
InitMouse()
If Screen3DRequester()
SkyBox("desert07.jpg")
CreateCamera(0, 0, 0, 100, 100) ; Front camera
CameraLocate(0,0,100,100)
LoadTexture(0, "Geebee2.bmp") ; <<< NEW
OpenWindow3D(#MainWindow, 100, 100, 300, 300, "Hello in 3D !")
ButtonGadget3D(#CloseButton, 10, 260, 120, 25, "Close")
ImageGadget3D(#Image3D, 10, 60, 200, 200, TextureID(0)) ; <<< NEW
ShowGUI(128, 1) ; Display the GUI, semi-transparent and display the mouse cursor
Repeat
Screen3DEvents()
If ExamineKeyboard()
Input$ = KeyboardInkey()
EndIf
If ExamineMouse()
MouseX = -(MouseDeltaX()/10)*#CameraSpeed
MouseY = -(MouseDeltaY()/10)*#CameraSpeed
InputEvent3D(MouseX(), MouseY(), MouseButton(#PB_MouseButton_Left), Input$)
EndIf
; Handle the GUI 3D events, it's similar to regular GUI events
;
Repeat
Event = WindowEvent3D()
Select Event
Case #PB_Event3D_Gadget
If EventGadget3D() = #CloseButton
CloseWindow3D(#MainWindow)
EndIf
EndSelect
Until Event = 0
RenderWorld()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
EndIf
Else
MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf