It is currently Thu Jun 20, 2013 7:37 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: Cannot put text on screen in 3D
PostPosted: Fri Jan 21, 2011 5:26 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Jan 02, 2007 8:16 pm
Posts: 4328
Location: Cypress TX
I have the follwoing program (models can be found on topic:

viewtopic.php?f=16&t=45061

and I want to be able t print on the 3D window... no technique I have attempted has allowed me to do this. I had thought of setting the text as texture on a billboard or something but I am confused as to how that would be possible.

The 3D text gadget seems to be broken...

Code:
;
; ------------------------------------------------------------
;
;   PureBasic - Mesh (Skeleton Animation)
;
;    (c) 2002 - Fantaisie Software
;
; ------------------------------------------------------------
;
; Modified by Rook Zimbabwe
;             and DarkDragon (in order to help Rook Zimbabwe)


InitSprite()
InitKeyboard()
InitMouse()

Define.f KeyX, KeyY

#WheelMesh = 0
#WheelMesh2 = 1
#WheelMesh3 = 2
#WheelMesh4 = 3
#WheelTexture = 0
#METAL = 1
#Wheel = 0
#Wheel2 = 1
#Wheel3 = 2
#Wheel4 = 3
#Gear = 4
#Rod = 5
#Sun = 6
#a3Dtext = 7
#File = 8
#Sprite = 9
#Sprite3D = 10

; DATA OUTPUT
;OpenFile(#File, "wheeldrop.txt")

Dim spin(9)

spin(0) = 254
spin(1) = 292
spin(2) = 324
spin(3) = 0
spin(4) = 38
spin(5) = 74
spin(6) = 108
spin(7) = 144
spin(8) = 180
spin(9) = 216

If InitEngine3D()
 
  OpenWindow(0, #PB_Ignore, #PB_Ignore, 800, 600, "Test", #PB_Window_SystemMenu)
 
  If OpenWindowedScreen(WindowID(0), 0, 0, 800, 600, 1, 0, 0)
   
    Add3DArchive("Data", #PB_3DArchive_FileSystem)
   
    ;- ** LOAD MESH **
    LoadMesh   (#WheelMesh   , "wheel2.mesh")
    LoadTexture(#WheelTexture, "Image1.jpg")
    CopyMesh(#WheelMesh , #WheelMesh2 )
    CopyMesh(#WheelMesh2 , #WheelMesh3 )
    CopyMesh(#WheelMesh3 , #WheelMesh4 )
   
    ;gear = LoadMesh(#PB_Any   , "gear1.mesh")
    ;rod = LoadMesh(#PB_Any   , "rod1.mesh")
    ;mettext = LoadTexture(#PB_Any, "25.bmp")
    ;CreateMaterial(#METAL, TextureID(mettext))
   
    CreateMaterial(0, TextureID(#WheelTexture))
    ;- create entity
    CreateEntity(#Wheel, MeshID(#WheelMesh), MaterialID(0), 11, 0, 0)
    CreateEntity(#Wheel2, MeshID(#WheelMesh2), MaterialID(0), 0, 0, 0)
    CreateEntity(#Wheel3, MeshID(#WheelMesh3), MaterialID(0), -11, 0, 0)
    CreateEntity(#Wheel4, MeshID(#WheelMesh4), MaterialID(0),-22, 0, 0)
   
    ;CreateEntity(#Gear, MeshID(gear), MaterialID(#METAL),-30, 0, 0)
   
    DisableMaterialLighting(0, 0) ; was (0,1)
   
    MaterialAmbientColor(0, RGB(202, 202, 202))
    MaterialSpecularColor(0, RGB(28,28,28))
   
    CreateLight(#Sun, RGB(255,255,255), 0, 260, 0) ; 100.0, 0, 0)
    LightSpecularColor(#Sun, RGB(128, 128, 128))
   
    CreateCamera(0, 0, 0, 100, 100)
    CameraLocate(0,0,0,97)
   
;   *********************   
;- ****    MAIN LOOP   ****
;   *********************

    Repeat
     
      ClearScreen(RGB(0, 0, 0))
     
      If ExamineKeyboard()
       
        If KeyboardPushed(#PB_Key_Down)
          xx + 1
        ElseIf KeyboardPushed(#PB_Key_Up)
          xx - 1
        EndIf
       
        If KeyboardReleased(#PB_Key_Space)
          ; *** rem values write the data lines for inclusion in program ***
          ; WriteStringN(#File, "spin("+Str(j)+") = "+Str(xx))
          ; j = j + 1
         
        EndIf
       
      EndIf
     
      RotateEntity(#Wheel, xx, 0, 0, #PB_Absolute) ;#Wheel, 0, 1, 0, #PB_Relative)
      ;RotateEntity(#gear, xx, 0, 0, #PB_Absolute) ;#Wheel, 0, 1, 0, #PB_Relative)
     
      xxx = EntityX(#Wheel)
     
      If xx > 359
        xx = 0
   EndIf
   
   ; ###########
   ; NOW the BIG thing is HOW do I print stuff on the screen???
   ; ###########
   
      RenderWorld()
      FlipBuffers()
    Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
  EndIf
 
Else
  MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf
; CloseFile(#File)
End


How can I print info on the screen?

BTW I am .mesh converting all me b3D models to OGRE... will post a link to the gallery FREE for PBers! (posted very soon!)

_________________
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/


Top
 Profile  
 
 Post subject: Re: Cannot put text on screen in 3D
PostPosted: Fri Jan 21, 2011 6:05 pm 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2919
Location: Wales, UK
Lots going on in your code there Rook. firstly, I'd separate it out into logical procedures - set-up the window in it's own procedure, the Mesh loading does not really belong there.

Given that you are using a windowed screen, you can use regular gadgets on the window, just not on the screen area. For me, that's preferable, but if your app needs to write text on the screen instead, how about using a screen rather than windowed screen? I suspect the issue of the 3D gadgets is the use of a windowed screen, that is where I fell into troubled water myself.

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
 
 Post subject: Re: Cannot put text on screen in 3D
PostPosted: Fri Jan 21, 2011 6:33 pm 
Offline
Addict
Addict
User avatar

Joined: Mon Jun 02, 2003 9:16 am
Posts: 1917
Location: Germany
I answered to your problem in the other thread you've linked.

_________________
bye,
Daniel

http://www.bradan.eu/


Top
 Profile  
 
 Post subject: Re: Cannot put text on screen in 3D
PostPosted: Sat Jan 22, 2011 6:57 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Jan 02, 2007 8:16 pm
Posts: 4328
Location: Cypress TX
well I can put a 3d WINDOW on the screen with CEGUI but only the basic one... seems OGRE didn't update to the newer version either yet... cannot print text direct to screen!!! still... if I disable the mouse I suppose I can work it into a funky HUD...

prelim screenpic...
(cannot use PSP9 to get screenshot in PB when program runs so used wifes cam... the little red blob near bottom is flash shining THROUGH finger!!! Buy your wife a Panasonic LUMIX with the Leica lens set... is GOOD!)

Image

numbers to be replaced by graphics in release version... :D
Now to add sounds, pull handle animation, betting controls, win information and a start screen!

I do wish textures could be SPHERE MAPPED so my metal textures would show up SHINY!

_________________
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/


Top
 Profile  
 
 Post subject: Re: Cannot put text on screen in 3D
PostPosted: Sun Jan 23, 2011 9:05 am 
Offline
Addict
Addict
User avatar

Joined: Mon Jun 02, 2003 9:16 am
Posts: 1917
Location: Germany
Rook Zimbabwe wrote:
I do wish textures could be SPHERE MAPPED so my metal textures would show up SHINY!


Nothing easier than that:
http://www.bradan.eu/files/rook.zip

Look at the material script changes and I wonder why you didn't use the material script instead of defining a new material.

_________________
bye,
Daniel

http://www.bradan.eu/


Top
 Profile  
 
 Post subject: Re: Cannot put text on screen in 3D
PostPosted: Sun Jan 23, 2011 11:27 am 
Offline
Addict
Addict
User avatar

Joined: Tue Aug 19, 2003 11:36 am
Posts: 1107
Location: Doubs - France
Quote:
cannot print text direct to screen!!!


You can use a TransparentSprite, see example here :

http://www.purebasic.fr/english/viewtopic.php?f=16&t=34593

_________________
Please correct my english
http://purebasic.developpez.com/


Top
 Profile  
 
 Post subject: Re: Cannot put text on screen in 3D
PostPosted: Sun Jan 23, 2011 11:33 am 
Offline
Addict
Addict
User avatar

Joined: Mon Jun 02, 2003 9:16 am
Posts: 1917
Location: Germany
Comtois wrote:
Quote:
cannot print text direct to screen!!!


You can use a TransparentSprite, see example here :

http://www.purebasic.fr/english/viewtopic.php?f=16&t=34593


I've already posted an example in his other thread, but he doesn't seem to see it :lol: :
viewtopic.php?p=344446#p344446

Maybe he generally wanted to use the CEGUI and didn't respond because its not with CEGUI.

_________________
bye,
Daniel

http://www.bradan.eu/


Top
 Profile  
 
 Post subject: Re: Cannot put text on screen in 3D
PostPosted: Sun Jan 23, 2011 5:33 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Jan 02, 2007 8:16 pm
Posts: 4328
Location: Cypress TX
Nope... he didn't see it... the glasses ae not working! I am looking again! :D

_________________
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/


Top
 Profile  
 
 Post subject: Re: Cannot put text on screen in 3D
PostPosted: Sun Jan 23, 2011 7:07 pm 
Offline
Addict
Addict
User avatar

Joined: Mon Jun 02, 2003 9:16 am
Posts: 1917
Location: Germany
Rook Zimbabwe wrote:
Nope... he didn't see it... the glasses ae not working! I am looking again! :D


So, to summarize it for you :wink: :
Draw text on screen (Comtois) viewtopic.php?f=16&t=34593
Draw text on screen (DarkDragon) viewtopic.php?p=344446#p344446
Spheremapping (DarkDragon) http://www.bradan.eu/files/rook.zip

_________________
bye,
Daniel

http://www.bradan.eu/


Top
 Profile  
 
 Post subject: Re: Cannot put text on screen in 3D
PostPosted: Mon Jan 24, 2011 4:51 am 
Offline
Addict
Addict
User avatar

Joined: Tue Jan 02, 2007 8:16 pm
Posts: 4328
Location: Cypress TX
Danke Daniel!!!
I am still having issues with the spheremapping but I think that might be my model! The Test.pb looks like the original code with no changes! I am rebuilding meshes now!

_________________
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/


Top
 Profile  
 
 Post subject: Re: Cannot put text on screen in 3D
PostPosted: Mon Jan 24, 2011 8:21 am 
Offline
Addict
Addict
User avatar

Joined: Mon Jun 02, 2003 9:16 am
Posts: 1917
Location: Germany
Rook Zimbabwe wrote:
Danke Daniel!!!
I am still having issues with the spheremapping but I think that might be my model! The Test.pb looks like the original code with no changes! I am rebuilding meshes now!


You have to look at the "wheel2.material" file (open it with notepad or such). It gets parsed through calling "Parse3DScripts()" in the "Test.pb" file and you don't need to create the material manually inside the PureBasic Code.

Its linked with your mesh through the material name:
Code:
[...]
material mat0
{
   [...]
Open the "wheel2_mesh.xml" to read this line:
Code:
[...]
<submesh material="mat0" usesharedvertices="false" use32bitindexes="false" operationtype="triangle_list">
[...]


As you can see the materialname mat0 is responsible for identifying the right material script for your mesh.

_________________
bye,
Daniel

http://www.bradan.eu/


Top
 Profile  
 
 Post subject: Re: Cannot put text on screen in 3D
PostPosted: Tue Jan 25, 2011 9:47 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Jan 02, 2007 8:16 pm
Posts: 4328
Location: Cypress TX
Sorry... had to go to hospital with acute blood poisoning... I guess it is ugly blood poisoning now as they let me go!

I had wondered about that. I attach the images to the mesh objects in UU3d or in Rhino3D and unless we can actually specify each MAT texture with OGRE it is gonna get ugly!

:mrgreen:

_________________
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/


Top
 Profile  
 
 Post subject: Re: Cannot put text on screen in 3D
PostPosted: Wed Jan 26, 2011 8:05 am 
Offline
Addict
Addict
User avatar

Joined: Mon Jun 02, 2003 9:16 am
Posts: 1917
Location: Germany
Rook Zimbabwe wrote:
Sorry... had to go to hospital with acute blood poisoning... I guess it is ugly blood poisoning now as they let me go!

I had wondered about that. I attach the images to the mesh objects in UU3d or in Rhino3D and unless we can actually specify each MAT texture with OGRE it is gonna get ugly!

:mrgreen:
Hmm using " :mrgreen: " with blood poisoning?
You can specify it inside the "wheel2.material". It is a OGRE feature to have those scripts externally. I don't understand your problem with it. I don't understand why it should get ugly?!

_________________
bye,
Daniel

http://www.bradan.eu/


Top
 Profile  
 
 Post subject: Re: Cannot put text on screen in 3D
PostPosted: Wed Jan 26, 2011 5:33 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Jan 02, 2007 8:16 pm
Posts: 4328
Location: Cypress TX
My toe was green for a while... ALL BETTER!

I will post an example of my attempt at using internal images on MESH in a bit!

_________________
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/


Top
 Profile  
 
 Post subject: Re: Cannot put text on screen in 3D
PostPosted: Wed Jan 26, 2011 5:46 pm 
Offline
Addict
Addict
User avatar

Joined: Mon Jun 02, 2003 9:16 am
Posts: 1917
Location: Germany
Rook Zimbabwe wrote:
My toe was green for a while... ALL BETTER!
Get well soon! My toe is dark red all over the year. In a while I will let them amputate my toe nail so it will never come again.

Rook Zimbabwe wrote:
I will post an example of my attempt at using internal images on MESH in a bit!
You should use shaders for this. PureBasic images and all modifications to it are stored on the normal CPU connected RAM and not inside the GPU connected RAM, so it would always send those images through the bottleneck if you're modifying textures with the CPU.

_________________
bye,
Daniel

http://www.bradan.eu/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye