It is currently Sun Jul 15, 2018 10:20 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Problem with recreating a 3D screen
PostPosted: Tue Sep 26, 2017 5:59 pm 
Offline
User
User

Joined: Wed Dec 31, 2014 1:01 pm
Posts: 69
Hi,
I´m trying to create a small program that can handle a 3D screen in different ways. One problem I have is that if I have an opened 3D screen, add the basic 3D stuff(light, mesh, camera) closes it, and then creates the same screen again, the program crashes. So I need help in figuring out(if possible) how to solve this.

The code below creates a 3D screen and displays a cube. If the users hits "F" I want it to close the screen and then create it again.
Or if the user hits "ALT+TAB" it closes the screen, creates a small window and waits for input. If the users then either TABs back to the program(to the small window) or clicks on it in the active programs list, the small window closes and then creates the screen.

The problem seems to be with the reinitialization of the basic 3D stuff. I have tried to free them up before I close the screen but that doesn´t help. My guess is that something else needs to be done for the new screen to be created properly. My fear is that this is an OGRE issue and can´t be solved. But I have faith in this forum :)

Can anyone solve this for me?

Code:
InitEngine3D()
InitSprite()
InitKeyboard()

ExamineDesktops()

OpenScreen(DesktopWidth(0), DesktopHeight(0), DesktopDepth(0),"3D Test",#PB_Screen_NoSynchronization, DesktopFrequency(0))

AmbientColor(RGB(80, 80, 100))
WorldShadows(#PB_Shadow_Additive)

mesh=CreateCube(#PB_Any,20)
CreateEntity(0, MeshID(mesh), #PB_Material_None)
RotateEntity(0,35,15,0)

light_Sun=CreateLight(#PB_Any, RGB(201, 226, 255), 0, 3000, 0)

cam_Main=CreateCamera(#PB_Any, 0, 0, 100, 100)
MoveCamera(cam_Main,0,0,50)
CameraRange(cam_Main, 0, 5000)
CameraFOV(cam_Main, 90)
CameraBackColor(cam_Main, RGB(70, 100, 182))

Repeat       
 
  ExamineKeyboard()
  If KeyboardPushed(#PB_Key_Escape) ;quit the program
    End
  ElseIf KeyboardReleased(#PB_Key_F)
   
    CloseScreen()
    OpenScreen(DesktopWidth(0), DesktopHeight(0), DesktopDepth(0),"3D Test",#PB_Screen_NoSynchronization, DesktopFrequency(0))
    AmbientColor(RGB(80, 80, 100))
    WorldShadows(#PB_Shadow_Additive)

    mesh=CreateCube(#PB_Any,20)
    CreateEntity(0, MeshID(mesh), #PB_Material_None)
    RotateEntity(0,35,15,0)

    light_Sun=CreateLight(#PB_Any, RGB(201, 226, 255), 0, 3000, 0)

    cam_Main=CreateCamera(#PB_Any, 0, 0, 100, 100)
    MoveCamera(cam_Main,0,0,50)
    CameraRange(cam_Main, 0, 5000)
    CameraFOV(cam_Main, 90)
    CameraBackColor(cam_Main, RGB(70, 100, 182))
  EndIf
 
  If KeyboardPushed(#PB_Key_LeftAlt)
    If KeyboardPushed(#PB_Key_Tab)
      CloseScreen()
      OpenWindow(1,1,1,1,1, "3D Test" , #PB_Window_Minimize )
      Repeat
        Event= WaitWindowEvent(2)
      Until Event= #PB_Event_ActivateWindow
      CloseWindow(1)
     
      OpenScreen(DesktopWidth(0), DesktopHeight(0), DesktopDepth(0),"3D Test",#PB_Screen_NoSynchronization, DesktopFrequency(0))
      AmbientColor(RGB(80, 80, 100))
      WorldShadows(#PB_Shadow_Additive)

      mesh=CreateCube(#PB_Any,20)
      CreateEntity(0, MeshID(mesh), #PB_Material_None)
      RotateEntity(0,35,15,0)

      light_Sun=CreateLight(#PB_Any, RGB(201, 226, 255), 0, 3000, 0)

      cam_Main=CreateCamera(#PB_Any, 0, 0, 100, 100)
      MoveCamera(cam_Main,0,0,50)
      CameraRange(cam_Main, 0, 5000)
      CameraFOV(cam_Main, 90)
      CameraBackColor(cam_Main, RGB(70, 100, 182))
    EndIf   
  EndIf   
 
  RenderWorld()
 
  FlipBuffers()
 
ForEver



Top
 Profile  
Reply with quote  
 Post subject: Re: Problem with recreating a 3D screen
PostPosted: Tue Sep 26, 2017 7:44 pm 
Offline
Addict
Addict
User avatar

Joined: Mon Sep 15, 2003 5:55 am
Posts: 1327
known bug viewtopic.php?f=4&t=32052

c ya,
nco2k

_________________
If OSVersion() = #PB_OS_Windows_ME : End : EndIf


Top
 Profile  
Reply with quote  
 Post subject: Re: Problem with recreating a 3D screen
PostPosted: Wed Sep 27, 2017 11:10 am 
Offline
User
User

Joined: Wed Dec 31, 2014 1:01 pm
Posts: 69
Ah, didnt´t find that post when I searched. Thanks!
But your code in the bugreport is easily worked around if you also close the window and then reopens that before the windowed screen.
Not the best solution ofc since you might not always want to close the window for several reasons. But a workaround nonetheless. And ofc the bug is still a bug.

But I can´t find any workaround when using OpenScreen().
Is there no way around this?

And more importantly why hasn´t this bug been fixed years ago?
Has there been some official statement regarding this? Is this the reason why ALT+TAB is disabled on fullscreens with 3D?
Is it a bug in the OGRE code or in the PB implementation?
If I were the PB developer I would definitely put this bug on the top of the "bugs to fix" list. I don´t think I have played any commercial game that crashes when doing an ALT+TAB so this really stands out. And in a very bad way.


Top
 Profile  
Reply with quote  
 Post subject: Re: Problem with recreating a 3D screen
PostPosted: Thu Nov 09, 2017 8:59 am 
Offline
User
User

Joined: Sun Aug 03, 2003 12:05 am
Posts: 39
Location: Australia
Fred has tried , but failed to fix this. It is a tricky prob in orge closing.
It has forced my video effects program to stay 2d only. :(
You get one 3d window/screen open per program launch. :(
It may never be fixed.

Mentioned in this thread.
viewtopic.php?f=4&t=53166

_________________
Ziltch - http://www.youtube.com/user/OZiltch


Top
 Profile  
Reply with quote  
 Post subject: Re: Problem with recreating a 3D screen
PostPosted: Thu Jan 25, 2018 11:05 am 
Offline
User
User
User avatar

Joined: Mon Jan 31, 2005 11:57 am
Posts: 41
Well, I know that I'm super late with a reply to this one....

But it works (mostly) fine if you use the OpenGL subsystem..


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 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