Ooops
January 27, 2021, 06:20:26 AM

Author Topic: Text ( OpenB3dMax )  (Read 484 times)

Offline _PJ_

  • Jr. Member
  • **
  • Posts: 96
Text ( OpenB3dMax )
« on: July 26, 2020, 04:54:55 PM »
I am using BlitzMax NG with "vanilla" mods, (I've not even begun to look at the "Brucey's Mods" at all )
However, for 3D I do Import "B3DOpenGLMax"

The intention is for simplsitic 3D simialr to the capabiltiies of Blitz3D .

In Blitz3D, it was possible to use Text command to write to a Texture Buffer and then this texture can be applied to a quad etc. before the camera to simulate the text written on 2D screen.

So far I am unsuccessful in this endeavour due to:

I find that (unless I need to Import some other specifc framewrok etc.) the "SetFont" command is not exposed (Maybe an alternative TFont.Set method or something???

There are a number of available "Font" related functoinalities now present, FreeTypeFonts and BitMap fonts, but no clear documentation as to how they should be used or how they differ - nor which solution is most appropriate for my needs ( to display text in a given font within a 3D camera render )

I am not  sure how to set a texture 'buffer' as a 'graphics object' for drawing.

And this aspect which is particularly problematic:
Use of 2D Commands such as "DrawText" appears to override something with the current (i.e. 3D) graphics object and therefore whatever is "Rendered" on calling RenderWorld is no longer visible on the screen.

Code: [Select]
SuperStrict

Import OpenB3DMax.B3DGLGraphics

Graphics3D DesktopWidth(),DesktopHeight(),0

Local c:TCamera=CreateCamera()
Local s:TEntity = CreateSphere()
MoveEntity(c,0,0,-10)

Local l:TLight = CreateLight()

AmbientLight(128,128,128)

Local RV:Byte

While Not KeyDown(key_escape)

If KeyHit(KEY_SPACE) Then RV = ~RV

RenderWorld


If RV
 DrawText("TEST",0,0)
End If

Flip


Wend

I have looked through the available documentation, but couldn't really find anything to help in resolving these issues.

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 480
Re: Text ( OpenB3dMax )
« Reply #1 on: August 01, 2020, 12:51:18 AM »
It sounds like you haven't seen the examples at openb3dmax.docs. See blitz3d/CreateTexture.bmx.

Offline _PJ_

  • Jr. Member
  • **
  • Posts: 96
Re: Text ( OpenB3dMax )
« Reply #2 on: December 26, 2020, 09:01:13 PM »
I found this:

Function BackBufferToTex( tex:TTexture,mipmap_no:Int=0,frame:Int=0,fastinvert:Int=True )
Description Copy the contents of the backbuffer to a texture.
Information OpenB3DMax does not have the same buffer commands as Blitz3D. The region copied from the backbuffer will start at 0,0 and end at the texture's width and height. So if you want to copy a 3D scene to a texture, first resize the camera viewport to the texture size, use RenderWorld to render the camera, then use this command. Back buffer is upside-down so set fastinvert to True to invert texture uvs, False to flip texture data (slower).

However, this is not useful if the intention is to draw text onto an existing texture.
I appreciate, having red the information that there may not be a direct analogue to SetBuffer TextureBufffer(Textureinstance) but surely there is a means to achieve this?

The purpsose here specifically, (although a general capability will always be advantageous) is because I am devising a user-interface which should eb comprised of various gadgets, some of which include labels / text values which will need to be dynamically applied (( for example, if an option is changed from OFF to ON or, more immediately, the various screen resolution options which are determined by user's hardware and configuration ))


Offline angros47

  • Jr. Member
  • **
  • Posts: 51
Re: Text ( OpenB3dMax )
« Reply #3 on: December 27, 2020, 12:09:15 AM »
Perhaps BufferToTex is what you need?

Offline _PJ_

  • Jr. Member
  • **
  • Posts: 96
Re: Text ( OpenB3dMax )
« Reply #4 on: December 27, 2020, 11:57:10 AM »
Perhaps BufferToTex is what you need?

Presumably this would copy ANY buffer (not exclusively the Back Buffer) to a texture buffer?
The issue is actually writing text to that buffer in thee first place, not the copying it to a texture.

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal