Windows 10 et Ogre 3D

Généralités sur la programmation 3D
Avatar de l’utilisateur
falsam
Messages : 7244
Inscription : dim. 22/août/2010 15:24
Localisation : IDF (Yvelines)
Contact :

Windows 10 et Ogre 3D

Message par falsam »

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
14:05:39: *-*-* OGRE Initialising
14:05:39: *-*-* Version 1.8.2 (Byatis)
14:05:39: D3D9 : Direct3D9 Rendering Subsystem created
Si votre ordinateur est sous Windows 10, l'environnement DirectX9 n'est pas installé et DirectX11 ou DirectX12 n'est pas rétrocompatible avec DirectX9

:!: 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
Si ca fonctionne, c'est que vous avez installé DirectX9c :wink:

Alors comment faire ?
La solution consiste (à ce jour) à forcer le sous-system OpenGL dans les options de compilation.
Configuration : Windows 11 Famille 64-bit - PB 6.03 x64 - AMD Ryzen 7 - 16 GO RAM
Vidéo NVIDIA GeForce GTX 1650 Ti - Résolution 1920x1080 - Mise à l'échelle 125%
Avatar de l’utilisateur
Micoute
Messages : 2522
Inscription : dim. 02/oct./2011 16:17
Localisation : 35520 La Mézière

Re: Windows 10 et Ogre 3D

Message par Micoute »

Merci pour ce partage très explicatif.
Microsoft Windows 10 Famille 64 bits : Carte mère : ASRock 970 Extreme3 R2.0 : Carte Graphique NVIDIA GeForce RTX 3080 : Processeur AMD FX 6300 6 cœurs 12 threads 3,50 GHz PB 5.73 PB 6.00 LTS (x64)
Un homme doit être poli, mais il doit aussi être libre !
Répondre