Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: TV3D 6.5 Open Prerelease - Delphi - DrawText  (Read 965 times)
FillOrKill
Community Member
*
Posts: 5


« on: November 01, 2007, 09:22:21 AM »

Hello,

please excuse me my not perfect english. I am a German and i start to use the TV3D SDK with Delphi 6.0.

The template is run without problems. But i have a problem with the class "scene". I don't find there anywhere the ".drawtext()" procedure. A bug? Or only a mistake by me?

Also i looking for some sources for Delphi, because the documentation is not descriping how to program mesh's, scenes, objects and so on...

I hope, i will find here an user what also is coding with Delphi and he/she gives me a little bit help to start programming with the TV3D SDK.  Grin

Regards,
FillOrKill


 
Logged
WEst
Community Member
*
Posts: 813

Daniel Martinek


WWW
« Reply #1 on: November 01, 2007, 10:28:23 AM »

Scene.DrawText was removed from the TVScene class as it wasn't a good place for it. In 6.5 you have to use the Screen2DText class to draw your text onto the screen.
For example:
Code:
TVScreen2DText.NormalFont_DrawText( text As String, x As Long, Y As Long, Color As Long, UserFont As String)
Logged

Greetings

Daniel Martinek
Lead Programmer
Roaming Nova Studios
FillOrKill
Community Member
*
Posts: 5


« Reply #2 on: November 01, 2007, 11:21:54 AM »

Hi,

thanks a lot. But i can only read the text for a short second, if i resize the window:

Code:
unit uMain;

interface

// Add the TV3D65 Type Library into the uses clause. (TV3D65_TLB).
uses
  Windows, Messages, SysUtils, Classes, Forms, Dialogs, TV3D65_TLB;

type
  TfrmMain = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }

    // Declare the TV Variables:
    TV             : TVEngine;
    Scene          : TVScene;
    MyMesh         : TVMesh;
    Screen2DText   : TVScreen2DText;
    Input          : TVInputEngine;
    Globals        : TVGlobals;
    RenderSurfaceA : TVRenderSurface;
    RenderSurfaceB : TVRenderSurface;


    Procedure AppIdle(sender : TObject; var done : boolean);
  end;

var
 frmMain: TfrmMain;

implementation

{$R *.dfm}

var

 T : Integer;

procedure TfrmMain.FormCreate(Sender: TObject);
begin
  // Create the TV Interface first:
  TV := CoTVEngine.Create;
  TV.SetDebugMode(true, true, true, true);
  TV.SetDebugFile(ExtractFilePath(Application.ExeName) + 'debugfile.txt');
  TV.Init3DWindowed(frmMain.Handle, true);
  TV.GetViewport.SetAutoResize(true);
  TV.DisplayFPS(true, -1);
  TV.SetAngleSystem(TV_ANGLE_DEGREE);


  Scene    := CoTVScene.Create;
  Globals  := CoTVGlobals.Create;

  Input    := CoTVInputEngine.Create;
  Input.Initialize(true, true);

  Screen2DText := CoTVScreen2DText.Create;
  T            := Screen2DText.TextureFont_Create('font', 'Arial', 32, True, False, False, False);

  Application.OnIdle := AppIdle;
end;

procedure TfrmMain.AppIdle(sender : TObject; var done : boolean);
begin
  // Check if the application has focus, if yes thats when we process the loop.
  if frmMain.Focused then
  begin
    // This tells Windows it isnt done, so it will continue to loop.
    done := false;

    // The actual render loop:

    TV.Clear(False);

     Screen2DText.Action_BeginText(True);
     Screen2DText.TextureFont_DrawBillboardText('Hello', 5, 5, 40, $FFFFFF, T, 5, 5);
     Screen2DText.Action_EndText;

    // Scene.RenderAll(true, true);
    // Scene.RenderAllMeshes(true);

    TV.RenderToScreen;

    // Lets check if the user presses ESC key, if yes we will quit the app.
    If Input.IsKeyPressed(TV_KEY_ESCAPE) then Close();

    // Process any messages Windows has for the application, do this last:
    Application.ProcessMessages;
  end;

end;

I don't know why  Sad

Greetings
Logged
FillOrKill
Community Member
*
Posts: 5


« Reply #3 on: November 02, 2007, 01:27:44 AM »

Hi,

I have test the code with a lot of various options, but it don't work correctly. Then I have slow down the frames per second to 1 - 2.

If I start the render loop, you will only see a black window:



Then I resize the window manually, now you can read for 1 sec (1 fps) the text:



After 1 second the windows is black again.

What and why is cleaning up the window? Why I can see the text only after a resize?

Code:
TV.Clear(False);

     Screen2DText.Action_BeginText(True);
     Screen2DText.TextureFont_DrawBillboardText('Hello', 5, 5, 40, $FFFFFF, T, 5, 5);
     Screen2DText.Action_EndText;

    // Scene.RenderAll(true, true);
    // Scene.RenderAllMeshes(true);

    TV.RenderToScreen;

See above code.

P.S:

If I create a mesh, for example a box, I see only a black window. I can not create any visible objects with this different render loops, like "renderall()", "renderallmeshes()".


Greetings




 
« Last Edit: November 02, 2007, 01:42:04 AM by FillOrKill » Logged
WEst
Community Member
*
Posts: 813

Daniel Martinek


WWW
« Reply #4 on: November 02, 2007, 03:50:14 AM »

Try this one:


Code:
TV.Clear(False);

    // Scene.RenderAll(true, true);
    // Scene.RenderAllMeshes(true);

     //Do your 2D Stuff always after your 3D
     Screen2DText.Action_BeginText(false); // use this boolean value only if you want to draw the text withing a TVScreen2DImmediate block!
     Screen2DText.TextureFont_DrawBillboardText('Hello', 5, 5, 40, $FFFFFF, T, 5, 5);
     Screen2DText.Action_EndText;

    TV.RenderToScreen;
Logged

Greetings

Daniel Martinek
Lead Programmer
Roaming Nova Studios
FillOrKill
Community Member
*
Posts: 5


« Reply #5 on: November 02, 2007, 05:19:57 AM »

Hi,

no , it isn't run. I think it isn't an error by me in the source code. Meanwhile I have start to create a terrain (a easy hill) with a texture. That's is run immediately:



Next I will test it with a mesh plus texture. But i can't view a text Smiley

Greetings
Logged
WEst
Community Member
*
Posts: 813

Daniel Martinek


WWW
« Reply #6 on: November 02, 2007, 07:10:34 AM »

Hm, I could have sworn that this is caused by the Action_BeginText Boolean, I had the same problem in my game engine about half an hour ago, and it was solved by using the right parameter.

You can also try to use True as the parameter and enclose the whole text block by a TVScreen2DImmediate.Action_Begin and Action_End.

Oh, and I just realized you are using a billboard text, be sure then, that you can actually see the billboard.
Logged

Greetings

Daniel Martinek
Lead Programmer
Roaming Nova Studios
SylvainTV
Administrator
Community Member
*****
Posts: 4479


WWW
« Reply #7 on: November 02, 2007, 06:11:22 PM »

Yes the camera should be setup so that you can see it !

And btw :

     Screen2DText.TextureFont_DrawBillboardText('Hello', 5, 5, 40, $FFFFFF, T, 5, 5);

If I'm seeing well you're using $FFFFFF as color, this means that Alpha = 0, and it should be totally transparent.

Try -1 or $FFFFFFFF to get a fully opaque color.
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
FillOrKill
Community Member
*
Posts: 5


« Reply #8 on: November 03, 2007, 08:16:00 PM »

Hi SylvainTV,

thank you very much! That was it! That's going with a camera set and a correct text trancparency:



Ok.. you will become a new licend user in the next days Grin 
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks