Cannot put text on screen in 3D
Posted: Fri Jan 21, 2011 5:26 pm
I have the follwoing program (models can be found on topic:
http://www.purebasic.fr/english/viewtop ... 16&t=45061
and I want to be able t print on the 3D window... no technique I have attempted has allowed me to do this. I had thought of setting the text as texture on a billboard or something but I am confused as to how that would be possible.
The 3D text gadget seems to be broken...
How can I print info on the screen?
BTW I am .mesh converting all me b3D models to OGRE... will post a link to the gallery FREE for PBers! (posted very soon!)
http://www.purebasic.fr/english/viewtop ... 16&t=45061
and I want to be able t print on the 3D window... no technique I have attempted has allowed me to do this. I had thought of setting the text as texture on a billboard or something but I am confused as to how that would be possible.
The 3D text gadget seems to be broken...
Code: Select all
;
; ------------------------------------------------------------
;
; PureBasic - Mesh (Skeleton Animation)
;
; (c) 2002 - Fantaisie Software
;
; ------------------------------------------------------------
;
; Modified by Rook Zimbabwe
; and DarkDragon (in order to help Rook Zimbabwe)
InitSprite()
InitKeyboard()
InitMouse()
Define.f KeyX, KeyY
#WheelMesh = 0
#WheelMesh2 = 1
#WheelMesh3 = 2
#WheelMesh4 = 3
#WheelTexture = 0
#METAL = 1
#Wheel = 0
#Wheel2 = 1
#Wheel3 = 2
#Wheel4 = 3
#Gear = 4
#Rod = 5
#Sun = 6
#a3Dtext = 7
#File = 8
#Sprite = 9
#Sprite3D = 10
; DATA OUTPUT
;OpenFile(#File, "wheeldrop.txt")
Dim spin(9)
spin(0) = 254
spin(1) = 292
spin(2) = 324
spin(3) = 0
spin(4) = 38
spin(5) = 74
spin(6) = 108
spin(7) = 144
spin(8) = 180
spin(9) = 216
If InitEngine3D()
OpenWindow(0, #PB_Ignore, #PB_Ignore, 800, 600, "Test", #PB_Window_SystemMenu)
If OpenWindowedScreen(WindowID(0), 0, 0, 800, 600, 1, 0, 0)
Add3DArchive("Data", #PB_3DArchive_FileSystem)
;- ** LOAD MESH **
LoadMesh (#WheelMesh , "wheel2.mesh")
LoadTexture(#WheelTexture, "Image1.jpg")
CopyMesh(#WheelMesh , #WheelMesh2 )
CopyMesh(#WheelMesh2 , #WheelMesh3 )
CopyMesh(#WheelMesh3 , #WheelMesh4 )
;gear = LoadMesh(#PB_Any , "gear1.mesh")
;rod = LoadMesh(#PB_Any , "rod1.mesh")
;mettext = LoadTexture(#PB_Any, "25.bmp")
;CreateMaterial(#METAL, TextureID(mettext))
CreateMaterial(0, TextureID(#WheelTexture))
;- create entity
CreateEntity(#Wheel, MeshID(#WheelMesh), MaterialID(0), 11, 0, 0)
CreateEntity(#Wheel2, MeshID(#WheelMesh2), MaterialID(0), 0, 0, 0)
CreateEntity(#Wheel3, MeshID(#WheelMesh3), MaterialID(0), -11, 0, 0)
CreateEntity(#Wheel4, MeshID(#WheelMesh4), MaterialID(0),-22, 0, 0)
;CreateEntity(#Gear, MeshID(gear), MaterialID(#METAL),-30, 0, 0)
DisableMaterialLighting(0, 0) ; was (0,1)
MaterialAmbientColor(0, RGB(202, 202, 202))
MaterialSpecularColor(0, RGB(28,28,28))
CreateLight(#Sun, RGB(255,255,255), 0, 260, 0) ; 100.0, 0, 0)
LightSpecularColor(#Sun, RGB(128, 128, 128))
CreateCamera(0, 0, 0, 100, 100)
CameraLocate(0,0,0,97)
; *********************
;- **** MAIN LOOP ****
; *********************
Repeat
ClearScreen(RGB(0, 0, 0))
If ExamineKeyboard()
If KeyboardPushed(#PB_Key_Down)
xx + 1
ElseIf KeyboardPushed(#PB_Key_Up)
xx - 1
EndIf
If KeyboardReleased(#PB_Key_Space)
; *** rem values write the data lines for inclusion in program ***
; WriteStringN(#File, "spin("+Str(j)+") = "+Str(xx))
; j = j + 1
EndIf
EndIf
RotateEntity(#Wheel, xx, 0, 0, #PB_Absolute) ;#Wheel, 0, 1, 0, #PB_Relative)
;RotateEntity(#gear, xx, 0, 0, #PB_Absolute) ;#Wheel, 0, 1, 0, #PB_Relative)
xxx = EntityX(#Wheel)
If xx > 359
xx = 0
EndIf
; ###########
; NOW the BIG thing is HOW do I print stuff on the screen???
; ###########
RenderWorld()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
EndIf
Else
MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf
; CloseFile(#File)
End
BTW I am .mesh converting all me b3D models to OGRE... will post a link to the gallery FREE for PBers! (posted very soon!)
