PureBasic Forum
https://www.purebasic.fr/english/

3dtext
https://www.purebasic.fr/english/viewtopic.php?f=36&t=73930
Page 1 of 1

Author:  pfaber11 [ Sun Nov 03, 2019 3:28 pm ]
Post subject:  3dtext

I am trying to use the 3d text command but it keeps saying #3dtext not initialised I've looked at the documentation and example but I can't find the answer . Any help would be most appreciated . Thanks for reading .
Code:
 CreateText3D(0, "Hello world")
    Text3DColor(0, RGBA(255, 0, 0, 255))
    Text3DAlignment(0, #PB_Text3D_HorizontallyCentered)
    MoveText3D(0, 0, 2, 2)


This is the offending code.

Author:  DK_PETER [ Sun Nov 03, 2019 4:27 pm ]
Post subject:  Re: 3dtext

Take a look at the 3Dtext example provided in PureBasic and the proper-definitions.fontdef file pointed to by
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/fonts", #PB_3DArchive_FileSystem)
Without it, it can't access a font.

Author:  pfaber11 [ Sun Nov 03, 2019 5:36 pm ]
Post subject:  Re: 3dtext

Yes thanks for that got it working had to use parse script() too. This is not really what I wanted . What I would like to know is how to put ordinary text on the screen while using 3D . At least I've learnt something today. like a high score.

Author:  DK_PETER [ Sun Nov 03, 2019 6:12 pm ]
Post subject:  Re: 3dtext

Use ordinary sprites to display text.

Author:  pfaber11 [ Sun Nov 03, 2019 6:18 pm ]
Post subject:  Re: 3dtext

ok thanks that sounds like a good solution. I'll go and give it a try thanks . I didn't think you could mix 2d and 3d code . Thanks for your time .

Author:  DK_PETER [ Sun Nov 03, 2019 6:21 pm ]
Post subject:  Re: 3dtext

Code:
InitEngine3D()
InitSprite()
InitKeyboard()

OpenWindow(0, 0, 0, 800, 600, "text", #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 800,600)
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 0, 1)
CreateCube(0, 0.1)
CreateTexture(0, 100, 100, "Lines")
StartDrawing(TextureOutput(0))
Box(0, 0, 100, 100, $00FF16)
Box(3, 3, 94, 94, $0)
StopDrawing()
CreateMaterial(0, TextureID(0))
MaterialBlendingMode(0, #PB_Material_Add)
MaterialCullingMode(0, #PB_Material_NoCulling)
CreateEntity(0, MeshID(0), MaterialID(0), 0, 0, 0)
CreateSprite(0, 200, 100)
StartDrawing(SpriteOutput(0))
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(1, 50, "THIS IS TEXT", $00FF16)
StopDrawing()
TransparentSpriteColor(0, $0)

Repeat
 
  Repeat: ev = WindowEvent() : Until ev = 0
 
  RotateEntity(0, 0.3, 0.1, 0.3, #PB_Relative)
  RenderWorld()
  DisplayTransparentSprite(0, ScreenWidth()/2-50, ScreenHeight()/2 )
  FlipBuffers()
 
  ExamineKeyboard()
 
Until KeyboardPushed(#PB_Key_Escape)

Author:  pfaber11 [ Mon Nov 04, 2019 10:48 am ]
Post subject:  Re: 3dtext

Thanks for that the answer I was looking for was in there somewhere. Thanks for the excellent reply . Understood how it works too which is a bonus.

Author:  pfaber11 [ Mon Nov 04, 2019 1:45 pm ]
Post subject:  Re: 3dtext

I have another question using this method
Code:
DrawText(100, 20, "THIS IS TEXT",#Green,#Black)


what do I need to do to increase the size of the text?
Looked through the documentation and can't find the answer so thought I would ask .

Author:  pfaber11 [ Mon Nov 04, 2019 6:59 pm ]
Post subject:  Re: 3dtext

Found out how to increase the size of the text with loadfont() . Thanks for your help.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/