Putting Text on to a 3D screen(purebasic)

Started by Pfaber11, November 03, 2019, 12:39:20

Previous topic - Next topic

Pfaber11

Hi guys was wanting to know how to put text onto a 3d screen for score etc . Been looking at the documentation and am using create3dtext then move 3d text . It keeps saying the 3d text has not been initialized . I'll paste a few lines of code that may help.
CreateText3D(6,"score")
Text3DCaption(6,"score")
MoveText3D(6,800,70,200)


Been over it a million times to no avail. The code just stops and I keep getting the #3dtext has not been initialised . I thought I initialised it with createtext3d(6,"score") What am I missing ?

HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz

Naughty Alien



    CreateCube(0, 2); <-------------------------------------This is entity you will attach your text to
    CreateMaterial(0, LoadTexture(0, "bla bla.png"))
    CreateEntity(0, MeshID(0), MaterialID(0))

    CreateText3D(0, "Hello world")
    Text3DColor(0, RGBA(255, 0, 0, 255))
    Text3DAlignment(0, #PB_Text3D_HorizontallyCentered)
    AttachEntityObject(0, "", Text3DID(0))  ; <---------- You are missing this. Text must be attached to a Lib Link "node", "node" or an entity.
    MoveText3D(0, 0, 2, 2)


Pfaber11

Thanks naughty alien got it sorted in the end . You also have to load a font and parse text () .
It wasn't really what I was looking for what I wanted is text on the screen like a high score . Any ideas .?
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz

Naughty Alien

..what you looking for is,

TextGadget
TextGadget3D

SetGadgeText
SetGadgetText3D

Pfaber11

how about
CreateSprite(0, 200, 100)
StartDrawing(SpriteOutput(0))
DrawText(1, 50, "THIS IS TEXT",#Red)
StopDrawing()
TransparentSpriteColor(0,#Black)



how about this
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz

Pfaber11

put these in in this order
  RenderWorld()
            DisplayTransparentSprite(0, 200,60)
      FlipBuffers()



Put this where you would  put your renderworld () flippbuffers()
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz

Pfaber11

Gonna try your method using Gadget got the other code off of someone on purebasic forum. It works fine .
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz

Pfaber11

Hi Alien it appears that the Gadget command only works inside a 3d window I'm using a screen as in openscreen () so was not able to use it I will write it down though as might come in handy in the future . Thanks for giving up your time and reading this . I write down everything I find useful not as a user manual but a way of jogging my memory . Very pleased with PB so far been at it about 3 weeks and have learnt a lot in that time . Bonjour.
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz