Ooops
September 23, 2020, 07:46:15 AM

Author Topic: Putting Text on to a 3D screen(purebasic)  (Read 1025 times)

Offline Pfaber11

  • Hero Member
  • *****
  • Posts: 549
  • Bonjour
    • FABERSGAMES
Putting Text on to a 3D screen(purebasic)
« on: November 03, 2019, 12:39:20 PM »
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.
Code: [Select]
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 ?

Celeron N3060 1.6 ghz duel core  4 Gb ram 32 gig storage  HD400 Graphics 160 gig external hard drive....

Offline Naughty Alien

  • Hero Member
  • *****
  • Posts: 701
Re: Putting Text on to a 3D screen(purebasic)
« Reply #1 on: November 03, 2019, 02:53:08 PM »
Code: [Select]

    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)


Offline Pfaber11

  • Hero Member
  • *****
  • Posts: 549
  • Bonjour
    • FABERSGAMES
Re: Putting Text on to a 3D screen(purebasic)
« Reply #2 on: November 03, 2019, 03:46:26 PM »
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 .?
Celeron N3060 1.6 ghz duel core  4 Gb ram 32 gig storage  HD400 Graphics 160 gig external hard drive....

Offline Naughty Alien

  • Hero Member
  • *****
  • Posts: 701
Re: Putting Text on to a 3D screen(purebasic)
« Reply #3 on: November 03, 2019, 11:43:31 PM »
..what you looking for is,

TextGadget
TextGadget3D

SetGadgeText
SetGadgetText3D

Offline Pfaber11

  • Hero Member
  • *****
  • Posts: 549
  • Bonjour
    • FABERSGAMES
Re: Putting Text on to a 3D screen(purebasic)
« Reply #4 on: November 04, 2019, 12:33:49 AM »
how about
Code: [Select]
CreateSprite(0, 200, 100)
StartDrawing(SpriteOutput(0))
DrawText(1, 50, "THIS IS TEXT",#Red)
StopDrawing()
TransparentSpriteColor(0,#Black)


how about this
Celeron N3060 1.6 ghz duel core  4 Gb ram 32 gig storage  HD400 Graphics 160 gig external hard drive....

Offline Pfaber11

  • Hero Member
  • *****
  • Posts: 549
  • Bonjour
    • FABERSGAMES
Re: Putting Text on to a 3D screen(purebasic)
« Reply #5 on: November 04, 2019, 01:04:20 AM »
put these in in this order
Code: [Select]
  RenderWorld()
            DisplayTransparentSprite(0, 200,60)
      FlipBuffers()



Put this where you would  put your renderworld () flippbuffers()
Celeron N3060 1.6 ghz duel core  4 Gb ram 32 gig storage  HD400 Graphics 160 gig external hard drive....

Offline Pfaber11

  • Hero Member
  • *****
  • Posts: 549
  • Bonjour
    • FABERSGAMES
Re: Putting Text on to a 3D screen(purebasic)
« Reply #6 on: November 04, 2019, 10:08:44 AM »
Gonna try your method using Gadget got the other code off of someone on purebasic forum. It works fine .
Celeron N3060 1.6 ghz duel core  4 Gb ram 32 gig storage  HD400 Graphics 160 gig external hard drive....

Offline Pfaber11

  • Hero Member
  • *****
  • Posts: 549
  • Bonjour
    • FABERSGAMES
Re: Putting Text on to a 3D screen(purebasic)
« Reply #7 on: November 04, 2019, 10:25:31 AM »
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.
Celeron N3060 1.6 ghz duel core  4 Gb ram 32 gig storage  HD400 Graphics 160 gig external hard drive....

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal