3d examples in PB 5.00 not working
3d examples in PB 5.00 not working
In PB 4.61 the 3d examples are just working fine, with PB 5.00 nothing happens on screen. Microsoft .dll's, 3d-engine, etc. are in the right directory. Anyone else who have the same problem?
			
			
									
									
						Re: 3d examples in PB 5.00 not working
Seem to work ok here.
Which one(s)?
cheers
			
			
									
									
						Which one(s)?
cheers
Re: 3d examples in PB 5.00 not working
you need to install this
if it still dont work , post your ogre.log file. You have to add constants at InitEngine3D().
			
			
									
									if it still dont work , post your ogre.log file. You have to add constants at InitEngine3D().
Code: Select all
InitEngine3D(#PB_Engine3D_DebugLog | #PB_Engine3D_DebugOutput) Please correct my english
http://purebasic.developpez.com/
						http://purebasic.developpez.com/
Re: 3d examples in PB 5.00 not working
Thank you for your reply. I have checked already if the directx is up-to-date. I am not experienced with 3d and Ogre. At least I know now that there should be no problem. I will try to find the ogre.log file.Comtois wrote:you need to install this
if it still dont work , post your ogre.log file. You have to add constants at InitEngine3D().Code: Select all
InitEngine3D(#PB_Engine3D_DebugLog | #PB_Engine3D_DebugOutput)
All examples don't work. With USB I tried 2 other computers as well, same result (all windows 7, one computer says: 3d engine is not initialized, other computer says problem with memory address, and the first computer gives no error-message at all).
Re: 3d examples in PB 5.00 not working
It will be where your executable is created.
MFG PMV
			
			
									
									
						MFG PMV
Re: 3d examples in PB 5.00 not working
Thank you all guys.PMV wrote:It will be where your executable is created.
MFG PMV
It seems to be an Ogre problem, or not.
Last part of the log:
18:42:05: D3D9RenderSystem::_createRenderWindow "PureBasic Ogre", 800x600 windowed miscParams: FSAA=2 displayFrequency=0 externalWindowHandle=853240 vsync=true
18:42:05: D3D9 : Created D3D9 Rendering Window 'PureBasic Ogre' : 800x600, 32bpp
18:42:05: OGRE EXCEPTION(3:RenderingAPIException): Cannot create device! in D3D9Device::createD3D9Device at OgreD3D9Device.cpp (line 729)
					Last edited by Hadrian on Sat Nov 10, 2012 12:25 am, edited 1 time in total.
									
			
									
						Re: 3d examples in PB 5.00 not working
You should put the log into a quote-block 
http://www.purebasic.fr/english/viewtop ... =5&t=51937
And in the past Intel Chips had always problems with DX and 3D-games.
 
MFG PMV
			
			
									
									
						Intel Chips are a problem from OGRE ...Hadrian wrote:18:42:03: * CPU ID: GenuineIntel: Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz
[...]
18:42:05: D3D9RenderSystem::_createRenderWindow "PureBasic Ogre", 800x600 windowed miscParams: FSAA=2 displayFrequency=0 externalWindowHandle=853240 vsync=true
18:42:05: D3D9 : Created D3D9 Rendering Window 'PureBasic Ogre' : 800x600, 32bpp
18:42:05: OGRE EXCEPTION(3:RenderingAPIException): Cannot create device! in D3D9Device::createD3D9Device at OgreD3D9Device.cpp (line 729)
http://www.purebasic.fr/english/viewtop ... =5&t=51937
And in the past Intel Chips had always problems with DX and 3D-games.
MFG PMV
Re: 3d examples in PB 5.00 not working
You can try with the 'opengl' subsystem.
			
			
									
									
						Re: 3d examples in PB 5.00 not working
Thank you, I will look into.Fred wrote:You can try with the 'opengl' subsystem.
Sorry about the quote-block. It's my very first post. I did not know about the Intel problem. Thanks for the help.PMV wrote:You should put the log into a quote-block
And in the past Intel Chips had always problems with DX and 3D-games.![]()
MFG PMV
Re: 3d examples in PB 5.00 not working
I got similar problem with PB5.0, none of the examples would run. 
After some experimenting, I found if I don't use "Screen3DRequester.pb" and setup the windowedscreen myself, I can get "EntityAnimation.pb" to run.
It seems some settings in "Screen3DRequester.pb" need to be changed?
			
			
									
									
						After some experimenting, I found if I don't use "Screen3DRequester.pb" and setup the windowedscreen myself, I can get "EntityAnimation.pb" to run.
Code: Select all
;
; ------------------------------------------------------------
;
;   PureBasic - EntityAnimation
;
;    (c) 2012 - Fantaisie Software
;
; ------------------------------------------------------------
;
;Speed animation = PageUp and PageDown 
Enumeration     
#Win_Main
EndEnumeration
;IncludeFile "Screen3DRequester.pb"
Define.f KeyX, KeyY, MouseX, MouseY, Speed = 0.3
ExamineDesktops()
Desk_Width  = DesktopWidth(0)
Desk_Height = DesktopHeight(0)
  
Win_Width   = Desk_Width*5/6
Win_Height  = Desk_Height*5/6
Scrn_Width  = Win_Width *5/6-50 
Scrn_Height = Win_Height-50
If InitEngine3D()
  
   
  InitSprite()
  InitKeyboard()
  InitMouse()   
  
  Add3DArchive("Data/Textures", #PB_3DArchive_FileSystem)
  Add3DArchive("Data/Models", #PB_3DArchive_FileSystem)
  Add3DArchive("Data/Scripts", #PB_3DArchive_FileSystem)
  Add3DArchive("Data/Packs/Desert.zip", #PB_3DArchive_Zip)
  Parse3DScripts()
  
 ; MessageRequester("info", "before the Screen3DRequester",0)
  OpenWindow(#Win_Main, 0, 0, Win_Width, Win_Height, "Robot", #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget )
;  If Screen3DRequester()
    OpenWindowedScreen( WindowID(#Win_Main), 2,15, Scrn_Width-2,Win_Height-12, #False, 0, 0 ,#PB_Screen_NoSynchronization  )
 
    WorldShadows(#PB_Shadow_Modulative, -1, RGB(175, 175, 175))
    
    ;Ground
    ;
    CreateMaterial(0, LoadTexture(0, "Dirt.jpg"))
    CreatePlane(0, 1500, 1500, 40, 40, 15, 15)
    CreateEntity(0,MeshID(0),MaterialID(0))
    EntityRenderMode(0, 0)
    
    ;Mesh
    ;
    LoadMesh(1, "robot.mesh")
    
    ; Entity
    ;
    CreateEntity(1, MeshID(1), #PB_Material_None)
    
    ; Animation
    ;
    StartEntityAnimation(1, "Walk", #PB_EntityAnimation_Manual)
     
    ; SkyBox
    ;
    SkyBox("Desert07.jpg")
    
    ; Camera
    ;
    CreateCamera(0, 0, 0, 100, 100)
    CameraLocate(0, 50, 100, 80)
    CameraLookAt(0, EntityX(1), EntityY(1) + 40, EntityZ(1))
    
    CreateLight(0, RGB(255, 255, 255), -40, 100, 80)
    AmbientColor(RGB(80, 80, 80))
    KeyboardMode(#PB_Keyboard_International)
        
    Repeat
   ;   Screen3DEvents()
      
      If ExamineMouse()
        MouseX = -MouseDeltaX()/10 
        MouseY = -MouseDeltaY()/10
      EndIf
      
          
      If ExamineKeyboard()
      
        If KeyboardPushed(#PB_Key_Left)
          KeyX = -1
        ElseIf KeyboardPushed(#PB_Key_Right)
          KeyX = 1
        Else
          KeyX = 0
        EndIf
        
        If KeyboardPushed(#PB_Key_Up)
          KeyY = -1
        ElseIf KeyboardPushed(#PB_Key_Down)
          KeyY = 1
        Else
          KeyY = 0
        EndIf
        
        If KeyboardPushed(#PB_Key_PageUp) And Speed < 2.0
          Speed + 0.05
        ElseIf KeyboardPushed(#PB_Key_PageDown) And Speed > 0.1 
          Speed - 0.05
        EndIf
                
      EndIf
      AddEntityAnimationTime(1, "Walk", TimeSinceLastFrame * Speed)
                
      RotateCamera(0, MouseY, MouseX, 0, #PB_Relative)
      MoveCamera  (0, KeyX, 0, KeyY)
      
      TimeSinceLastFrame = RenderWorld()
      FlipBuffers()
    Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
;  Else
;    MessageRequester("Error", "Screen3DRequester can't be initialized",0)
;  EndIf
    
Else
  MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf
  
End
Re: 3d examples in PB 5.00 not working
This is wonderful news ! Thank you ! I will try also.Pureabc wrote:I got similar problem with PB5.0, none of the examples would run.
After some experimenting, I found if I don't use "Screen3DRequester.pb" and setup the windowedscreen myself, I can get "EntityAnimation.pb" to run.
It seems some settings in "Screen3DRequester.pb" need to be changed?
Re: 3d examples in PB 5.00 not working
There is a bug in the function AntialiasingMode(), even if you choose none, you have FSAA = 2 (see your log) !
AntialiasingMode() is fixed for the next release.
			
			
									
									So removes these lines in 'Screen3DRequester.pb' :Seems pptech has noticed that setting FSAA != 0 on some Intel cards yields cannot create Device. In pptech's case, it may be related to going from Ogre 1.6.3 to 1.7.3. Again, this'll take some time before I can test...
Code: Select all
    Select AAMode
      Case 0:
        AntialiasingMode(#PB_AntialiasingMode_None)
      Case 1:
        AntialiasingMode(#PB_AntialiasingMode_x2)
      Case 2:
        AntialiasingMode(#PB_AntialiasingMode_x4)
      Case 3:
        AntialiasingMode(#PB_AntialiasingMode_x6)
    EndSelectAntialiasingMode() is fixed for the next release.
Please correct my english
http://purebasic.developpez.com/
						http://purebasic.developpez.com/
Re: 3d examples in PB 5.00 not working
We could try to recreate the device with FSAA off if it fails the first time, to workaround this issue.
			
			
									
									
						- Michael Vogel
 - Addict

 - Posts: 2821
 - Joined: Thu Feb 09, 2006 11:27 pm
 - Contact:
 
Re: 3d examples in PB 5.00 not working
When doing changes in the example files (or in the PB IDE dialogs 
), please add some keyboard shortcuts as well -- or just copy and paste the code below.
			
			
									
									
						Code: Select all
;
; ------------------------------------------------------------
;
;   PureBasic - Common 3D functions
;
;    (c) 2003 - Fantaisie Software
;
; ------------------------------------------------------------
;
#OgreAntialiasingBug=1
#WINDOW_Screen3DRequester=0
Enumeration
	#GADGET_FullScreen
	#GADGET_Windowed
	#GADGET_ScreenModesLabel
	#GADGET_WindowedModes
	#GADGET_Launch
	#GADGET_Cancel
	#GADGET_Logo
	#GADGET_Frame
	#GADGET_ScreenModes
	#GADGET_Antialiasing
	#GADGET_AntialiasingModes
EndEnumeration
Global Screen3DRequester_FullScreen, Screen3DRequester_ShowStats
UsePNGImageDecoder()
Procedure Screen3DRequester()
	OpenPreferences(GetHomeDirectory()+"PureBasicDemos3D.prefs")
	FullScreen          = ReadPreferenceLong  ("FullScreen"        , 0)
	FullScreenMode$     = ReadPreferenceString("FullScreenMode"    , "800x600")
	WindowedScreenMode$ = ReadPreferenceString("WindowedScreenMode", "800x600")
	AAMode              = ReadPreferenceLong  ("Antialiasing"      , 0)
	If ExamineDesktops()
		ScreenX = DesktopWidth(0)
		ScreenY = DesktopHeight(0)
		ScreenD = DesktopDepth(0)
		ScreenF = DesktopFrequency(0)
	EndIf
	If OpenWindow(#WINDOW_Screen3DRequester, 0, 0, 396, 230, "PureBasic - 3D Demos", #PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_Invisible)
		Top = 6
		ImageGadget  (#GADGET_Logo, 6, Top, 0, 0, LoadImage(0,"Data/PureBasic3DLogo.png"), #PB_Image_Border) : Top+76
		Frame3DGadget(#GADGET_Frame, 6, Top, 384, 105, "", 0) : Top+20
		OptionGadget(#GADGET_FullScreen, 70, Top, 100, 20, "&Fullscreen")        : Top+25
		OptionGadget(#GADGET_Windowed  , 70, Top, 100, 20, "&Windowed")          : Top+25
		TextGadget(#GADGET_Antialiasing, 70, Top+5, 100, 20, "&Antialiasing mode",#SS_NOTIFY) : Top - 50
		ComboBoxGadget (#GADGET_ScreenModes  , 190, Top, 150, 21)     : Top+25
		ComboBoxGadget (#GADGET_WindowedModes, 190, Top, 150, 21)     : Top+25
		ComboBoxGadget (#GADGET_AntialiasingModes, 190, Top, 150, 21) : Top+45
		ButtonGadget (#GADGET_Launch,   6, Top, 180, 25, "&Launch", #PB_Button_Default)
		ButtonGadget (#GADGET_Cancel, 200, Top, 190, 25, "&Cancel")
		AddGadgetItem(#GADGET_AntialiasingModes,-1,"None")
		AddGadgetItem(#GADGET_AntialiasingModes,-1,"FSAA x2")
		AddGadgetItem(#GADGET_AntialiasingModes,-1,"FSAA x4")
		AddGadgetItem(#GADGET_AntialiasingModes,-1,"FSAA x6")
		SetGadgetState(#GADGET_AntialiasingModes,AAMode)
		AddKeyboardShortcut(#WINDOW_Screen3DRequester,#PB_Shortcut_L,#GADGET_Launch)
		AddKeyboardShortcut(#WINDOW_Screen3DRequester,#PB_Shortcut_Return,#GADGET_Launch)
		AddKeyboardShortcut(#WINDOW_Screen3DRequester,#PB_Shortcut_C,#GADGET_Cancel)
		AddKeyboardShortcut(#WINDOW_Screen3DRequester,#PB_Shortcut_Escape,#GADGET_Cancel)
		AddKeyboardShortcut(#WINDOW_Screen3DRequester,#PB_Shortcut_F,#GADGET_FullScreen)
		AddKeyboardShortcut(#WINDOW_Screen3DRequester,#PB_Shortcut_W,#GADGET_Windowed)
		AddKeyboardShortcut(#WINDOW_Screen3DRequester,#PB_Shortcut_A,#GADGET_Antialiasing)
		If ExamineScreenModes()
			Position = 0
			While NextScreenMode()
				Position + 1
				Width       = ScreenModeWidth()
				Height      = ScreenModeHeight()
				Depth       = ScreenModeDepth()
				RefreshRate = ScreenModeRefreshRate()
				If Depth > 8
					AddGadgetItem(#GADGET_ScreenModes, -1, Str(Width)+"x"+Str(Height)+"x"+Str(Depth)+"@"+Str(RefreshRate))
					If ScreenX = Width And ScreenY = Height And ScreenD = Depth And ScreenF = RefreshRate
						SetGadgetState(#GADGET_ScreenModes, Position)
						FullScreenMode$ = Str(Width)+"x"+Str(Height)+"x"+Str(Depth)+"@"+Str(RefreshRate)
					EndIf
				EndIf
			Wend
		EndIf
		ExamineDesktops()
		NbScreenModes = 7
		Restore WindowedScreenDimensions
		Repeat
			Read.l CurrentWidth
			Read.l CurrentHeight
			If CurrentWidth < DesktopWidth(0) And CurrentHeight < DesktopHeight(0)
				AddGadgetItem(#GADGET_WindowedModes, -1, Str(CurrentWidth)+ "x"+Str(CurrentHeight))
				NbScreenModes - 1
			Else
				NbScreenModes = 0
			EndIf
		Until NbScreenModes = 0
		SetGadgetState(#GADGET_FullScreen, FullScreen)
		SetGadgetState(#GADGET_Windowed  , 1-FullScreen)
		SetGadgetText (#GADGET_ScreenModes  , FullScreenMode$)
		SetGadgetText (#GADGET_WindowedModes, WindowedScreenMode$)
		DisableGadget (#GADGET_ScreenModes  , 1-FullScreen)
		DisableGadget (#GADGET_WindowedModes, FullScreen)
		HideWindow(#WINDOW_Screen3DRequester, 0)
		Repeat
			Event = WaitWindowEvent()
			Select Event
			Case #PB_Event_Gadget,#PB_Event_Menu
				Select EventGadget()
				Case #GADGET_Launch
					Quit = 2
				Case #GADGET_Cancel
					Quit = 1
				Case #GADGET_FullScreen
					DisableGadget(#GADGET_ScreenModes  , 0)
					DisableGadget(#GADGET_WindowedModes, 1)
					SetGadgetState(#GADGET_FullScreen,1)
					SetActiveGadget(#GADGET_ScreenModes)
				Case #GADGET_Windowed
					DisableGadget(#GADGET_ScreenModes  , 1)
					DisableGadget(#GADGET_WindowedModes, 0)
					SetGadgetState(#GADGET_Windowed,1)
					SetActiveGadget(#GADGET_WindowedModes)
				Case #GADGET_Antialiasing
					SetActiveGadget(#GADGET_AntialiasingModes)
				EndSelect
			Case #PB_Event_CloseWindow
				Quit = 1
			EndSelect
		Until Quit > 0
		FullScreen          = GetGadgetState(#GADGET_FullScreen)
		FullScreenMode$     = GetGadgetText (#GADGET_ScreenModes)
		WindowedScreenMode$ = GetGadgetText (#GADGET_WindowedModes)
		AAMode              = GetGadgetState(#GADGET_AntialiasingModes)
		CloseWindow(#WINDOW_Screen3DRequester)
	EndIf
	If Quit = 2 ; Launch button has been pressed
		CreatePreferences(GetHomeDirectory()+"PureBasicDemos3D.prefs")
		WritePreferenceLong  ("FullScreen"        , FullScreen)
		WritePreferenceString("FullScreenMode"    , FullScreenMode$)
		WritePreferenceString("WindowedScreenMode", WindowedScreenMode$)
		WritePreferenceLong  ("Antialiasing"      , AAMode)
		If FullScreen
			ScreenMode$ = FullScreenMode$
		Else
			ScreenMode$ = WindowedScreenMode$
		EndIf
		RefreshRate = Val(StringField(ScreenMode$, 2, "@"))
		ScreenMode$ = StringField(ScreenMode$, 1, "@") ; Remove the refresh rate info, so we can parse it easily
		ScreenWidth  = Val(StringField(ScreenMode$, 1, "x"))
		ScreenHeight = Val(StringField(ScreenMode$, 2, "x"))
		ScreenDepth  = Val(StringField(ScreenMode$, 3, "x"))
		Screen3DRequester_FullScreen = FullScreen ; Global variable, for the Screen3DEvents
		Select AAMode
		Case 0:
			CompilerIf Defined(OgreAntialiasingBug,#PB_Constant)=#False
				AntialiasingMode(#PB_AntialiasingMode_None)
			CompilerEndIf
		Case 1:
			AntialiasingMode(#PB_AntialiasingMode_x2)
		Case 2:
			AntialiasingMode(#PB_AntialiasingMode_x4)
		Case 3:
			AntialiasingMode(#PB_AntialiasingMode_x6)
		EndSelect
		If FullScreen
			Result = OpenScreen(ScreenWidth, ScreenHeight, ScreenDepth, "3D Demos", #PB_Screen_WaitSynchronization, RefreshRate)
		Else
			If OpenWindow(0, 0, 0, ScreenWidth, ScreenHeight+MenuHeight(), "PureBasic - 3D Demos", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
				CreateMenu(0, WindowID(#WINDOW_Screen3DRequester))
				MenuTitle("Project")
				MenuItem(0, "Quit")
				MenuTitle("About")
				MenuItem(1, "About...")
				Result = OpenWindowedScreen(WindowID(#WINDOW_Screen3DRequester), 0, 0, ScreenWidth, ScreenHeight, 0, 0, 0)
			EndIf
		EndIf
	EndIf
	ProcedureReturn Result
EndProcedure
Procedure Screen3DEvents()
	If Screen3DRequester_FullScreen = 0 ; Handle all the events relatives to the window..
		Repeat
			Event = WindowEvent()
			Select Event
			Case #PB_Event_Menu
				Select EventMenu()
				Case 0
					Quit = 1
				Case 2
					MessageRequester("Info", "Windowed 3D in PureBasic !", 0)
				EndSelect
			Case #PB_Event_CloseWindow
				Quit = 1
			EndSelect
			If Quit = 1 : End : EndIf  ; Quit the app immediately
		Until Event = 0
	EndIf
	If ExamineKeyboard()
		If KeyboardReleased(#PB_Key_F1)
			Screen3DRequester_ShowStats = 1-Screen3DRequester_ShowStats ; Switch the ShowStats on/off
		EndIf
	EndIf
EndProcedure
Procedure Screen3DStats()
	If Screen3DRequester_ShowStats
		; Nothing printed for now
	EndIf
EndProcedure
DataSection
	WindowedScreenDimensions:
	Data.l  320, 240
	Data.l  512, 384
	Data.l  640, 480
	Data.l  800, 600
	Data.l 1024, 768
	Data.l 1280, 1024
	Data.l 1600, 1200
EndDataSectionRe: 3d examples in PB 5.00 not working
As this error is reflected by OpenScreen() .. it returns zero, thisFred wrote:We could try to recreate the device with FSAA off if it fails the first time, to workaround this issue.
behavior should be done by us and not by PB.
But it would be good, to have this problem explained in the help file
In future, maybe some other settings could lead to that error ...
would you want to workaround all of them?
Especially the gamer would report that as a bug from the
final game "I have set FSAA but i always have no FSAA active!"
If PB do not have a workaround, but we do that ... we could
write a message such as: "Your current settings are not supported
by your hardware. If you have an Intel Chip, please turn off FSAA."
or just retry by deactivating FSAA. It would be up to us
MFG PMV


