CreateText3D() - optional parameters? (solved)

Everything related to 3D programming
User avatar
DK_PETER
Addict
Addict
Posts: 898
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

CreateText3D() - optional parameters? (solved)

Post by DK_PETER »

Hey.
Could someone please check the optional parameters in the command CreateText3D()?
Just use some of the examples present in the PB 3D folder:
F.ex Text3D.pb or CheckObjectVisibility2.pb.
add the optional parameters values to CreateText3D() and tell me what's happening.

I'm using PB 5.31 b1. Windows.
TIA
Last edited by DK_PETER on Mon Oct 13, 2014 5:49 pm, edited 1 time in total.
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: CreateText3D() - optional parameters invalid or ?

Post by applePi »

Hi DK_PETER
using example Text3D.pb
1- CreateText3D(0, "Hello world", "Arial", 1, RGB(0,1,0))
will gives an error #Text3D not initialized, the same also with "Verdana" font

2- CreateText3D(0, "Hello world", "", 1, RGB(0,255,0))
1 here display the same size as without using optionals, 2 double size ....
color have no effect, it is Text3DColor who decide the color.
we can use ScaleText3D(), and Text3DColor, but still the font needed.
PB 5.31 b1 windows xp
User avatar
DK_PETER
Addict
Addict
Posts: 898
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: CreateText3D() - optional parameters invalid or ?

Post by DK_PETER »

@applePi

Thanks for testing.
I knew there were something wrong but rather have someone else to verify it.
I'll post a bug report soon or maybe Comtois is already on it? ;-)
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
User avatar
Comtois
Addict
Addict
Posts: 1429
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: CreateText3D() - optional parameters invalid or ?

Post by Comtois »

Examples\3D\Data\fonts\proper-definitions.fontdef
Edit the file 'proper-definitions.fontdef' to see font available or to add a new one.

Color should be RGBA().

Code: Select all

CreateText3D(0, "Hello world","StarWars", 1, RGBA(255,255,0,255))
Please correct my english
http://purebasic.developpez.com/
User avatar
DK_PETER
Addict
Addict
Posts: 898
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: CreateText3D() - optional parameters invalid or ?

Post by DK_PETER »

Comtois wrote:
Examples\3D\Data\fonts\proper-definitions.fontdef
Edit the file 'proper-definitions.fontdef' to see font available or to add a new one.

Color should be RGBA().

Code: Select all

CreateText3D(0, "Hello world","StarWars", 1, RGBA(255,255,0,255))
Yep..That did it. Thank you for a speedy response.
The help file should mention how you access different fonts. I thought it was something like "solo5" or "solo5.ttf".
I didn't think of checking a specific script file. :)

Best regards
Peter
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
User avatar
DK_PETER
Addict
Addict
Posts: 898
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: CreateText3D() - optional parameters? (solved)

Post by DK_PETER »

A little nonsense example for Text3D.

Code: Select all

If InitEngine3D() = 0
  End
EndIf
If InitSprite() = 0
  End
EndIf
If InitKeyboard() = 0
  End
EndIf

Add3DArchive(#PB_Compiler_Home + "Examples\3D\Data\fonts", #PB_3DArchive_FileSystem)
Parse3DScripts()

Structure _mesh
  id.i
  ms.i
  ma.i
  tx.i
EndStructure

Declare DoWin()  
Declare DoWheel()
Declare DoTeeth()
Declare DoText()

Global Dim tx.i(5), nod.i, nod2.i, cam.i, light.i
Global base._mesh
Global Dim Teeths._mesh(8)

Procedure DoWin()
  OpenWindow(0, 0, 0, 1024, 768, "3D text",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
  OpenWindowedScreen(WindowID(0), 0, 0, 1024, 768, #False, 0, 0, #PB_Screen_WaitSynchronization)
  light = CreateLight(#PB_Any, $FFFFFF,0,10,-100,#PB_Light_Directional)
  nod = CreateNode(#PB_Any, 0, 0, 0)
EndProcedure

Procedure DoWheel()
  Protected gval.i = 64
  base\ms = CreateCylinder(#PB_Any, 1, 0.2, 50, 1, 0)
  base\tx = CreateTexture(#PB_Any, 256, 256)
  StartDrawing(TextureOutput(base\tx))
  For x = 0 To 256
    LineXY(x, 0, x, 256, RGB(gval,gval,gval))
    If gval + 8 > 255
      gval = 64
    Else
      gval + 8
    EndIf
  Next x
  StopDrawing()
  base\ma = CreateMaterial(#PB_Any, TextureID(base\tx))
  base\id = CreateEntity(#PB_Any, MeshID(base\ms), MaterialID(base\ma), 0, 0, 0)
  RotateEntity(base\id, 90,0,0)
  AttachNodeObject(nod, EntityID(base\id))
EndProcedure

Procedure DoTeeth()
  Protected count.i
  For count = 0 To 7
    With Teeths(count)
      \ms = CreateCube(#PB_Any, 0.2)
      \ma = CopyMaterial(base\ma,#PB_Any)
      \id = CreateEntity(#PB_Any, MeshID(\ms), MaterialID(\ma), 0, 0, 0)
      ScaleEntity(\id, 11, 0.8, 0.8)
      RotateEntity(\id, 0, 0, count * 45,#PB_Absolute)
      AttachNodeObject(nod, EntityID(\id))
    EndWith
  Next count
EndProcedure

Procedure DoText()
  Protected count.i
  
  For count = 0 To 4
    If Random(100,1) < 50
      tx(count) = CreateText3D(#PB_Any, "Text num " + Str(count+1),"StarWars",0.6,RGBA(155,100,0,255))
    Else
      tx(count) = CreateText3D(#PB_Any, "Text num " + Str(count+1),"BlueHighway-16",0.6,RGBA(100,144,200,255))
    EndIf
  Next Count
  
  MoveText3D(tx(0), 3,3,1)
  MoveText3D(tx(1), 0,3,1)
  MoveText3D(tx(2), 3,0,1)
  MoveText3D(tx(3), -3,3,1)
  MoveText3D(tx(4), 3,-3,1)
  AttachNodeObject(nod, Text3DID(tx(0)))
  AttachNodeObject(nod, Text3DID(tx(1)))
  AttachNodeObject(nod, Text3DID(tx(2)))
  AttachNodeObject(nod, Text3DID(tx(3)))
  AttachNodeObject(nod, Text3DID(tx(4)))
  
EndProcedure

DoWin()
DoWheel()
DoTeeth()
DoText()

cam = CreateCamera(#PB_Any, 0, 0, 100, 100)
MoveCamera(cam, 0, 0, 16)

Repeat
  
  Repeat
    ev = WindowEvent()
  Until ev = 0

  RotateNode(nod, 0, 0, -0.8, #PB_Relative)

  RenderWorld()
  
  ExamineKeyboard()
  
  FlipBuffers()
  
Until KeyboardPushed(#PB_Key_Escape)
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: CreateText3D() - optional parameters? (solved)

Post by applePi »

DK_Peter, i know little about the fonts , i have tried the fonts from windows\fonts , but each font seems needs special values, i have used Font_Xplorer_122_Free utility to browse the fonts installed and to know its names. in windows xp i have this font "harlow solid italic" installed

add for "PureBasic\Examples\3D\Text3D.pb"

Code: Select all

Add3DArchive("C:/windows/fonts", #PB_3DArchive_FileSystem)
CreateText3D(0, "Hello World", "HARLOWSI", 1, RGBA(0,255,0,255))
and in proper-definitions.fontdef file add this to the end of the file:

Code: Select all

HARLOWSI
{
	type 		truetype
	source 		HARLOWSI.ttf
	size 		18
	resolution 	96
}
Image
but some fonts does not displayed correctly such as Informal Roman, INFROMAN.ttf it contains extra dots, changing resolution increase the extra dots and lines.
INFROMAN
{
type truetype
source INFROMAN.ttf
size 18
resolution 96
}

jokerman font are great :
Image

Code: Select all

Add3DArchive("C:/windows/fonts", #PB_3DArchive_FileSystem)
  CreateText3D(0, "Hello World", "JOKERMAN", 1, RGBA(0,255,0,255))

Code: Select all

JOKERMAN
{
        type    	truetype
	source 		JOKERMAN.ttf
	size 		24
	resolution 	96
}
User avatar
DK_PETER
Addict
Addict
Posts: 898
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: CreateText3D() - optional parameters? (solved)

Post by DK_PETER »

@applePi.
Sorry for not replying..I seldom visit the forum anymore, unless I find bugs or a new update of PB arrives.
I'm doing a lot of 3D coding, though. :-)
applePi wrote:DK_Peter, i know little about the fonts , i have tried the fonts from windows\fonts , but each font seems needs special values, i have used Font_Xplorer_122_Free utility
I know it. Personally I prefer these two font viewers (freeware):

http://us.fontviewer.de/Download/

http://members.ozemail.com.au/~scef/tftdl.html
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
Philippe-felixer76-3
User
User
Posts: 45
Joined: Mon Dec 30, 2013 10:12 pm

Re: CreateText3D() - optional parameters invalid or ?

Post by Philippe-felixer76-3 »

Comtois wrote:
Examples\3D\Data\fonts\proper-definitions.fontdef
Edit the file 'proper-definitions.fontdef' to see font available or to add a new one.

Color should be RGBA().

Code: Select all

CreateText3D(0, "Hello world","StarWars", 1, RGBA(255,255,0,255))
Why isn't this mentioned in the PB help file, or why doen't PB give a error a la "Font not found" or something... took me a long time to find this out.. :(
Post Reply