Needed engine3d internals info to build own SetMeshData() fu

Just starting out? Need help? Post your questions and find answers here.
User avatar
Psychophanta
Addict
Addict
Posts: 4958
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: Needed engine3d internals info to build own SetMeshData(

Post by Psychophanta »

Still can't test (those 2 lines does not change a thing respect your original code). Tried on 2 different PCs, PB 4.60RC1.
Same behaviour in both machines: full graphic screen does not appear and debugger does not complain.
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
DarkDragon
Addict
Addict
Posts: 2215
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: Needed engine3d internals info to build own SetMeshData(

Post by DarkDragon »

Psychophanta wrote:Still can't test (those 2 lines does not change a thing respect your original code).
Have you changed what I told you to? Set fixed resolution instead of those 2 lines.
Psychophanta wrote:Tried on 2 different PCs, PB 4.60RC1.
Same behaviour in both machines: full graphic screen does not appear and debugger does not complain.
How about this?

Code: Select all

Macro Check(Status, Error, EndProgram = 1)
  If Not Status
    MessageRequester("ERROR", Error)
    CompilerIf EndProgram
      End
    CompilerEndIf
  EndIf
EndMacro

Structure MeshVertex
  X.f
  Y.f
  Z.f
EndStructure

Structure MeshNormal
  X.f
  Y.f
  Z.f
EndStructure

Structure MeshColor
  RGB.l
EndStructure

Structure MeshUV
  U.f
  V.f
EndStructure

Structure MeshFace
  V1.i
  V2.i
  V3.i
EndStructure

Procedure.i CreateMeshEx(Mesh.i, *PointerVertex.MeshVertex, *PointerColor.MeshColor, *PointerNormal.MeshNormal, *PointerUV.MeshUV, *PointerFace.MeshFace, Vertices.i, Faces.i)
  Protected K.i
  Protected MeshNumber.i
  Protected Result.i = 0
  
  If *PointerVertex = #Null Or *PointerFace = #Null
    ProcedureReturn Result
  EndIf
  
  If Mesh = #PB_Any
    MeshNumber = CreateMesh(Mesh)
    Result = MeshNumber
  Else
    Result = CreateMesh(Mesh)
    MeshNumber = Mesh
  EndIf
  
  If Result <> 0
    AddSubMesh()
    
    For K = 1 To Vertices
      AddMeshVertex(*PointerVertex\X, *PointerVertex\Y, *PointerVertex\Z)
      
      If *PointerColor <> #Null
        MeshVertexColor(*PointerColor\RGB)
        *PointerColor + SizeOf(MeshColor)
      EndIf
      
      If *PointerNormal <> #Null
        MeshVertexNormal(*PointerNormal\X, *PointerNormal\Y, *PointerNormal\Z)
        *PointerNormal + SizeOf(MeshNormal)
      EndIf
      
      If *PointerUV <> #Null
        MeshVertexTextureCoordinate(*PointerUV\U, *PointerUV\V)
        *PointerUV + SizeOf(MeshUV)
      EndIf
      
      *PointerVertex + SizeOf(MeshVertex)
    Next K
    
    For K = 1 To Faces
      AddMeshFace(*PointerFace\V1, *PointerFace\V2, *PointerFace\V3)
      *PointerFace + SizeOf(MeshFace)
    Next K
    
    FinishMesh()
  EndIf
  
  ProcedureReturn Result
EndProcedure

Check(InitEngine3D(), "InitEngine3D failed.")
Check(InitSprite(), "InitSprite failed.")
Check(InitKeyboard(), "InitKeyboard failed.")

OpenWindow(0, 0, 0, 800, 600, "", #PB_Window_SystemMenu)
Check(OpenWindowedScreen(WindowID(0), 0, 0, 800, 600, 1, 0, 0), "OpenWindowedScreen failed.")

WorldShadows(#PB_Shadow_Modulative)

CreateTexture(0, 64, 64)
StartDrawing(TextureOutput(0))
Box(0, 0, 32, 32, RGB(0, 0, 255))
Box(32, 0, 32, 32, RGB(0, 255, 0))
Box(32, 32, 32, 32, RGB(255, 0, 0))
Box(0, 32, 32, 32, RGB(255, 255, 0))
StopDrawing()

CreateMaterial(0, TextureID(0))

CreateMeshEx(0, ?DataVertices, #Null, ?DataNormal, ?DataUV, ?DataFaces, 4, 2)
Check(CreateEntity(0, MeshID(0), MaterialID(0)), "CreateEntity failed")

CreateLight(0, RGB(255, 255, 255), 100.0, 0, 0)
LightSpecularColor(0, RGB(255, 0, 0))

Check(CreateCamera(0, 0, 0, 100, 100), "CreateCamera failed")

CameraLocate(0, 5, 5, -10)
CameraLookAt(0, 0, 0, 0)

Define Timer = ElapsedMilliseconds()
Define Mode = 0

Repeat
  ClearScreen(0)
  RenderWorld()
  FlipBuffers()
  
  If ElapsedMilliseconds() - Timer > 1000
    If Mode = 0
      CreateMeshEx(0, ?DataVertices2, #Null, ?DataNormal, ?DataUV2, ?DataFaces, 3, 1)
      Check(CreateEntity(0, MeshID(0), MaterialID(0)), "CreateEntity failed")
      Mode = 1
    Else
      CreateMeshEx(0, ?DataVertices, #Null, ?DataNormal, ?DataUV, ?DataFaces, 4, 2)
      Check(CreateEntity(0, MeshID(0), MaterialID(0)), "CreateEntity failed")
      Mode = 0
    EndIf
    Timer = ElapsedMilliseconds()
  EndIf
  
  ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape) Or WindowEvent() = #PB_Event_CloseWindow
End

DataSection
  DataVertices:
    Data.f -0.5,  0.5,  0.0
    Data.f  0.5,  0.5,  0.0
    Data.f  0.5, -0.5,  0.0
    Data.f -0.5, -0.5,  0.0
    
  DataVertices2:
    Data.f -0.75,  0.75,  0.0
    Data.f  0.75,  0.75,  0.0
    Data.f  0.75, -0.75,  0.0
    Data.f -0.75, -0.75,  0.0
    
  DataNormal:
    Data.f  0.0,  0.0,  1.0
    Data.f  0.0,  0.0,  1.0
    Data.f  0.0,  0.0,  1.0
    Data.f  0.0,  0.0,  1.0
    
  DataUV:
    Data.f  0.0,  0.0
    Data.f  1.0,  0.0
    Data.f  1.0,  1.0
    Data.f  0.0,  1.0
    
  DataUV2:
    Data.f  1.0,  1.0
    Data.f  0.0,  1.0
    Data.f  0.0,  0.0
    Data.f  1.0,  0.0
    
  DataFaces:
    Data.i 0, 1, 2
    Data.i 0, 2, 3
EndDataSection
bye,
Daniel
User avatar
Psychophanta
Addict
Addict
Posts: 4958
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: Needed engine3d internals info to build own SetMeshData(

Post by Psychophanta »

DarkDragon wrote: Have you changed what I told you to? Set fixed resolution instead of those 2 lines.
Of course.
DarkDragon wrote:How about this?
Same, but windowed. The window appears halted, nothing is displayed there.
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
User avatar
Comtois
Addict
Addict
Posts: 1429
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: Needed engine3d internals info to build own SetMeshData(

Post by Comtois »

And your ogre.log say what ?
Please correct my english
http://purebasic.developpez.com/
User avatar
Psychophanta
Addict
Addict
Posts: 4958
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: Needed engine3d internals info to build own SetMeshData(

Post by Psychophanta »

Comtois wrote:And your ogre.log say what ?
13:21:48: DefaultWorkQueue('Root') initialising on thread main.
13:21:48: Particle Renderer Type 'billboard' registered
13:21:48: Can't assign material none to SubEntity of E0 because this Material does not exist. Have you forgotten to define it in a .material script?
13:21:48: Texture: spot_shadow_fade.png: Loading 1 faces(PF_R8G8B8,128x128x1) with hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
13:21:48: OGRE EXCEPTION(7:InternalErrorException): Cannot create D3D9 vertex declaration: An undetermined error occurred in Direct3D9VertexDeclaration::getD3DVertexDeclaration at OgreD3D9VertexDeclaration.cpp (line 162)
13:21:48: OGRE EXCEPTION(3:RenderingAPIException): Error Presenting surfaces in D3D9Device::present at OgreD3D9Device.cpp (line 991)
13:21:48: OGRE EXCEPTION(3:RenderingAPIException): Error beginning frame :Invalid call in D3D9RenderSystem::_beginFrame at OgreD3D9RenderSystem.cpp (line 2818)
13:21:48: OGRE EXCEPTION(3:RenderingAPIException): Error Presenting surfaces in D3D9Device::present at OgreD3D9Device.cpp (line 991)
13:21:48: OGRE EXCEPTION(3:RenderingAPIException): Error beginning frame :Invalid call in D3D9RenderSystem::_beginFrame at OgreD3D9RenderSystem.cpp (line 2818)
13:21:48: OGRE EXCEPTION(3:RenderingAPIException): Error Presenting surfaces in D3D9Device::present at OgreD3D9Device.cpp (line 991)
13:21:48: OGRE EXCEPTION(3:RenderingAPIException): Error beginning frame :Invalid call in D3D9RenderSystem::_beginFrame at OgreD3D9RenderSystem.cpp (line 2818)
13:21:48: OGRE EXCEPTION(3:RenderingAPIException): Error Presenting surfaces in D3D9Device::present at OgreD3D9Device.cpp (line 991)
13:21:48: OGRE EXCEPTION(3:RenderingAPIException): Error beginning frame :Invalid call in D3D9RenderSystem::_beginFrame at OgreD3D9RenderSystem.cpp (line 2818)
13:21:48: OGRE EXCEPTION(3:RenderingAPIException): Error Presenting surfaces in D3D9Device::present at OgreD3D9Device.cpp (line 991)
13:21:48: OGRE EXCEPTION(3:RenderingAPIException): Error beginning frame :Invalid call in D3D9RenderSystem::_beginFrame at OgreD3D9RenderSystem.cpp (line 2818)
13:21:48: OGRE EXCEPTION(3:RenderingAPIException): Error Presenting surfaces in D3D9Device::present at OgreD3D9Device.cpp (line 991)
...
...
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
User avatar
Comtois
Addict
Addict
Posts: 1429
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: Needed engine3d internals info to build own SetMeshData(

Post by Comtois »

does MeshManual.pb or MeshManualFred.pb work for you ? or you get the same ogre.log ?
Please correct my english
http://purebasic.developpez.com/
User avatar
Psychophanta
Addict
Addict
Posts: 4958
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: Needed engine3d internals info to build own SetMeshData(

Post by Psychophanta »

Comtois wrote:does MeshManual.pb or MeshManualFred.pb work for you ? or you get the same ogre.log ?
With MeshManualFred.pb
17:31:24: Can't assign material none to SubEntity of E0 because this Material does not exist. Have you forgotten to define it in a .material script?
17:31:24: OGRE EXCEPTION(7:InternalErrorException): Cannot create D3D9 vertex declaration: An undetermined error occurred in Direct3D9VertexDeclaration::getD3DVertexDeclaration at OgreD3D9VertexDeclaration.cpp (line 162)
17:31:24: OGRE EXCEPTION(3:RenderingAPIException): Error Presenting surfaces in D3D9Device::present at OgreD3D9Device.cpp (line 991)
17:31:24: OGRE EXCEPTION(3:RenderingAPIException): Error beginning frame :Invalid call in D3D9RenderSystem::_beginFrame at OgreD3D9RenderSystem.cpp (line 2818)
17:31:24: OGRE EXCEPTION(3:RenderingAPIException): Error Presenting surfaces in D3D9Device::present at OgreD3D9Device.cpp (line 991)
17:31:24: OGRE EXCEPTION(3:RenderingAPIException): Error beginning frame :Invalid call in D3D9RenderSystem::_beginFrame at OgreD3D9RenderSystem.cpp (line 2818)
17:31:24: OGRE EXCEPTION(3:RenderingAPIException): Error Presenting surfaces in D3D9Device::present at OgreD3D9Device.cpp (line 991)
17:31:24: OGRE EXCEPTION(3:RenderingAPIException): Error beginning frame :Invalid call in D3D9RenderSystem::_beginFrame at OgreD3D9RenderSystem.cpp (line 2818)
...
...
In both computers.
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
DarkDragon
Addict
Addict
Posts: 2215
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: Needed engine3d internals info to build own SetMeshData(

Post by DarkDragon »

Did you try with a clean install of PB 4.60RC1 or did you install it over a previous release?
bye,
Daniel
User avatar
Psychophanta
Addict
Addict
Posts: 4958
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: Needed engine3d internals info to build own SetMeshData(

Post by Psychophanta »

DarkDragon wrote:Did you try with a clean install of PB 4.60RC1 or did you install it over a previous release?
Clean,
but anyway i have had problems whenever i dealed with PB in 3D, since 3.xx versions... so i used other 3d libs with PB, but i found quickly some obstacle which avoid me to continue...
Damn! and still things are an obstacle itself when referring to 3D with PB.
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
PMV
Enthusiast
Enthusiast
Posts: 727
Joined: Sat Feb 24, 2007 3:15 pm
Location: Germany

Re: Needed engine3d internals info to build own SetMeshData(

Post by PMV »

You need DX9 ... it doesn't come up with Vista or 7.
It is needed to be installed manually. And by the way,
can you post the whole log? :)
User avatar
Psychophanta
Addict
Addict
Posts: 4958
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: Needed engine3d internals info to build own SetMeshData(

Post by Psychophanta »

PMV wrote:You need DX9 ... it doesn't come up with Vista or 7.
It is needed to be installed manually. And by the way,
can you post the whole log? :)
I installed dx9 version which is posted in the PB4.6B1 announcement.
I use Win XP
The log is all full of these 2 lines until the end:
17:31:24: OGRE EXCEPTION(3:RenderingAPIException): Error Presenting surfaces in D3D9Device::present at OgreD3D9Device.cpp (line 991)
17:31:24: OGRE EXCEPTION(3:RenderingAPIException): Error beginning frame :Invalid call in D3D9RenderSystem::_beginFrame at OgreD3D9RenderSystem.cpp (line 2818)
nothing more.
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
PMV
Enthusiast
Enthusiast
Posts: 727
Joined: Sat Feb 24, 2007 3:15 pm
Location: Germany

Re: Needed engine3d internals info to build own SetMeshData(

Post by PMV »

I know what is inside of the log ... and there is much more
then errors. Just copy the whole file. I will see with my own
eyes, if there is nothing else important :wink:
User avatar
Psychophanta
Addict
Addict
Posts: 4958
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: Needed engine3d internals info to build own SetMeshData(

Post by Psychophanta »

MeshManual.pb and MeshManualFred.pb examples has the same behaviour with PB4.60RC2, i.e. halted screen.
The ogre.log
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
User avatar
Psychophanta
Addict
Addict
Posts: 4958
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: Needed engine3d internals info to build own SetMeshData(

Post by Psychophanta »

Very curious; 2 issues:
Last example from Darkdragon works in PB4.60 final with do not anything and without any kind of problem, so the only thing can be though is that it is pure luck it worked for you all in 4.60RC.
The example is frightenly slow (far to be a real time mesh modification), just as i figured out. So then i must continue to search the way how DX9 internals do to perform a mesh data real time modification.
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
DarkDragon
Addict
Addict
Posts: 2215
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: Needed engine3d internals info to build own SetMeshData(

Post by DarkDragon »

Psychophanta wrote:Very curious; 2 issues:
Last example from Darkdragon works in PB4.60 final with do not anything and without any kind of problem, so the only thing can be though is that it is pure luck it worked for you all in 4.60RC.
The example is frightenly slow (far to be a real time mesh modification), just as i figured out. So then i must continue to search the way how DX9 internals do to perform a mesh data real time modification.
Its not because of my solution, as it only can be about 2x slower than it would be with an internal solution. But this constant factor isn't of any matter. I think there must be something wrong with the PB OGRE bindings in general as some people are having runtime errors, you have some weird output and bugs, ... .
bye,
Daniel
Post Reply