It is currently Wed Nov 20, 2019 11:41 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: 3dtext
PostPosted: Sun Nov 03, 2019 3:28 pm 
Offline
User
User

Joined: Sat Apr 13, 2019 12:17 pm
Posts: 43
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: 3dtext
PostPosted: Sun Nov 03, 2019 4:27 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Feb 19, 2011 10:06 am
Posts: 796
Location: Denmark
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.

_________________
“Tell me and I forget. Teach me and I remember. Involve me and I learn.”
— Benjamin Franklin
Current configurations: Windows 7/10, Intel 6800K, Gtx 970, 32 gb ram.


Top
 Profile  
Reply with quote  
 Post subject: Re: 3dtext
PostPosted: Sun Nov 03, 2019 5:36 pm 
Offline
User
User

Joined: Sat Apr 13, 2019 12:17 pm
Posts: 43
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: 3dtext
PostPosted: Sun Nov 03, 2019 6:12 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Feb 19, 2011 10:06 am
Posts: 796
Location: Denmark
Use ordinary sprites to display text.

_________________
“Tell me and I forget. Teach me and I remember. Involve me and I learn.”
— Benjamin Franklin
Current configurations: Windows 7/10, Intel 6800K, Gtx 970, 32 gb ram.


Top
 Profile  
Reply with quote  
 Post subject: Re: 3dtext
PostPosted: Sun Nov 03, 2019 6:18 pm 
Offline
User
User

Joined: Sat Apr 13, 2019 12:17 pm
Posts: 43
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 .


Top
 Profile  
Reply with quote  
 Post subject: Re: 3dtext
PostPosted: Sun Nov 03, 2019 6:21 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Feb 19, 2011 10:06 am
Posts: 796
Location: Denmark
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)

_________________
“Tell me and I forget. Teach me and I remember. Involve me and I learn.”
— Benjamin Franklin
Current configurations: Windows 7/10, Intel 6800K, Gtx 970, 32 gb ram.


Top
 Profile  
Reply with quote  
 Post subject: Re: 3dtext
PostPosted: Mon Nov 04, 2019 10:48 am 
Offline
User
User

Joined: Sat Apr 13, 2019 12:17 pm
Posts: 43
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: 3dtext
PostPosted: Mon Nov 04, 2019 1:45 pm 
Offline
User
User

Joined: Sat Apr 13, 2019 12:17 pm
Posts: 43
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 .


Top
 Profile  
Reply with quote  
 Post subject: Re: 3dtext
PostPosted: Mon Nov 04, 2019 6:59 pm 
Offline
User
User

Joined: Sat Apr 13, 2019 12:17 pm
Posts: 43
Found out how to increase the size of the text with loadfont() . Thanks for your help.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye