Windows 10 et Ogre 3D
Publié : jeu. 23/janv./2020 14:18
Par défaut il semble que ce soit le rendu DirectX9 qui soit initialisé avec un code 3D comme on peut le voir sur cet extrait d'un fichier log
Si vous utilisez un system d'ombrage ce sera un crash assuré de votre code.
Testez ce simple exempleSi ca fonctionne, c'est que vous avez installé DirectX9c
Alors comment faire ?
La solution consiste (à ce jour) à forcer le sous-system OpenGL dans les options de compilation.
Si votre ordinateur est sous Windows 10, l'environnement DirectX9 n'est pas installé et DirectX11 ou DirectX12 n'est pas rétrocompatible avec DirectX914:05:39: *-*-* OGRE Initialising
14:05:39: *-*-* Version 1.8.2 (Byatis)
14:05:39: D3D9 : Direct3D9 Rendering Subsystem created
Si vous utilisez un system d'ombrage ce sera un crash assuré de votre code.
Testez ce simple exemple
Code : Tout sélectionner
EnableExplicit
Global window, event, camera, texture, material, mesh, ground, box
InitEngine3D(#PB_Engine3D_DebugLog)
InitKeyboard()
InitSprite()
window = OpenWindow(#PB_Any, 0, 0, 1024, 768, "Test Shadow")
OpenWindowedScreen(WindowID(window),0,0,1024,768)
; Entities
mesh = CreateCube(#PB_Any, 1)
texture = CreateTexture(#PB_Any, 512,512)
StartDrawing(TextureOutput(texture))
Box(0, 0, 512, 512, RGB(0, 0, 0))
Box(10, 10, 492, 492, RGB(210, 180, 140))
StopDrawing()
material = CreateMaterial(#PB_Any,TextureID(texture))
MaterialFilteringMode(material, #PB_Material_Anisotropic, 6)
ground = CreateEntity(#PB_Any, MeshID(mesh), MaterialID(material), 0, 0, 0)
ScaleEntity(ground, 50, 0.1, 50)
box = CreateEntity(#PB_Any, MeshID(mesh), MaterialID(material), 0, 2.5, 0)
ScaleEntity(box, 5, 5, 5)
RotateEntity(box, 0, 45, 0)
; Light
CreateLight(#PB_Any,RGB(255, 218, 185), 500, 1000, -1000)
WorldShadows(#PB_Shadow_Additive)
; Camera
camera = CreateCamera(#PB_Any, 0, 0, 100, 100)
MoveCamera(camera, 0, 10, 40)
CameraLookAt(camera, 0, 0, 0)
; Render
While #True
event = WindowEvent()
ExamineKeyboard()
If event = #PB_Event_CloseWindow Or KeyboardPushed(#PB_Key_Escape)
Break
EndIf
RenderWorld()
FlipBuffers()
Wend
Alors comment faire ?
La solution consiste (à ce jour) à forcer le sous-system OpenGL dans les options de compilation.