MeshFace() with 4 parameters does not work here

Everything related to 3D programming
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

MeshFace() with 4 parameters does not work here

Post by Psychophanta »

This tip shows that MeshFace() with 4 parameters does not work:

Code: Select all

InitEngine3D():InitSprite():InitKeyboard():InitMouse()
OpenWindowedScreen(OpenWindow(0,0,0,1024,768,"no va cara de 4 vertices",#PB_Window_BorderLess|#PB_Window_ScreenCentered),0,0,1024,768,1,0,0,#PB_Screen_WaitSynchronization)

CreateLight(0,$EEEEEE,-1,1,6,#PB_Light_Point)
CreateCamera(0,0,0,100,100)
MoveCamera(0,0,0,4,#PB_Absolute)
CreateMaterial(0,0,$55DDEE)
CreateSphere(1,0.02)
          
CreateMesh(0,#PB_Mesh_TriangleList,#PB_Mesh_Static)
MeshVertex(-1,1,0,0,0,$EEEEEE,0,0,1)
MeshVertex(-1,-1,0,1,0,$EEEEEE,0,0,1)
MeshVertex(1,-1,0,0,1,$EEEEEE,0,0,1)
MeshVertex(1,1,0,0,1,$EEEEEE,0,0,1)
MeshFace(0,1,3):MeshFace(1,2,3); <- this one does work but MeshFace(0,1,2,3) does not work !!!!!!! (O_O)
MeshFace(3,1,0):MeshFace(3,2,1)
FinishMesh(1)
CreateEntity(0,MeshID(0),MaterialID(0),0,0,0)
Repeat:While WindowEvent()<>#PB_Event_None:Wend
  ExamineMouse():ExamineKeyboard()
  RotateEntity(0,MouseDeltaY(),MouseDeltaX(),MouseWheel(),#PB_Relative)
  RenderWorld()
  FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
STARGÅTE
Addict
Addict
Posts: 2232
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: MeshFace() with 4 parameters does not work here

Post by STARGÅTE »

Why should it work with 4 vertices if you create a mesh based on a list of triangles (#PB_Mesh_TriangleList, 3 vertices)?
You need then a quad list or quad stripe.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Re: MeshFace() with 4 parameters does not work here

Post by Psychophanta »

Aha, an what is the appropiate flag then?
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
pf shadoko
Enthusiast
Enthusiast
Posts: 386
Joined: Thu Jul 09, 2015 9:07 am

Re: MeshFace() with 4 parameters does not work here

Post by pf shadoko »

it works
pay attention to the vertex order

Code: Select all

InitEngine3D():InitSprite():InitKeyboard():InitMouse()
OpenWindowedScreen(OpenWindow(0,0,0,1024,768,"no va cara de 4 vertices",#PB_Window_BorderLess|#PB_Window_ScreenCentered),0,0,1024,768,1,0,0,#PB_Screen_WaitSynchronization)

CreateLight(0,$EEEEEE,-1,1,6,#PB_Light_Point)
CreateCamera(0,0,0,100,100)
MoveCamera(0,0,0,4,#PB_Absolute)
CreateMaterial(0,0,$55DDEE)
CreateSphere(1,0.02)
          
CreateMesh(0,#PB_Mesh_TriangleList,#PB_Mesh_Static)
MeshVertex(-1,1,0,0,0,$EEEEEE,0,0,1)
MeshVertex(-1,-1,0,1,0,$EEEEEE,0,0,1)
MeshVertex(1,-1,0,0,1,$EEEEEE,0,0,1)
MeshVertex(1,1,0,0,1,$EEEEEE,0,0,1)
MeshFace(0,1,2,3)
MeshFace(3,2,1,0)
FinishMesh(1)
CreateEntity(0,MeshID(0),MaterialID(0),0,0,0)
Repeat:While WindowEvent()<>#PB_Event_None:Wend
  ExamineMouse():ExamineKeyboard()
  RotateEntity(0,MouseDeltaY(),MouseDeltaX(),MouseWheel(),#PB_Relative)
  RenderWorld()
  FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or MouseButton(3)
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Re: MeshFace() with 4 parameters does not work here

Post by Psychophanta »

@pf shadoko, your tip does not work here. It tries to write at address 0 in the first 'MeshFace()' sentence. The same as my code.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
pf shadoko
Enthusiast
Enthusiast
Posts: 386
Joined: Thu Jul 09, 2015 9:07 am

Re: MeshFace() with 4 parameters does not work here

Post by pf shadoko »

@Psychophanta
What is your configuration ?

others have this problem ?
User avatar
Caronte3D
Addict
Addict
Posts: 1361
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: MeshFace() with 4 parameters does not work here

Post by Caronte3D »

For me, it works without problems
User avatar
SPH
Enthusiast
Enthusiast
Posts: 571
Joined: Tue Jan 04, 2011 6:21 pm

Re: MeshFace() with 4 parameters does not work here

Post by SPH »

It's ok here (pb 6.00LTS)

!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 6.12LTS - 64 bits
User avatar
SPH
Enthusiast
Enthusiast
Posts: 571
Joined: Tue Jan 04, 2011 6:21 pm

Re: MeshFace() with 4 parameters does not work here

Post by SPH »

It's ok here (pb 6.00LTS)

!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 6.12LTS - 64 bits
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Re: MeshFace() with 4 parameters does not work here

Post by Psychophanta »

@pf shadoko:

With debugger enabled: message is the typical "try to write in address 0".
Without debugger it just hangs.
PB 6.01LTS 64bit in win 8.1 on a AMD A8-7410 radeon R5. 4k screen desktop resolution.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
Caronte3D
Addict
Addict
Posts: 1361
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: MeshFace() with 4 parameters does not work here

Post by Caronte3D »

The only case I get this error, is when I try to compile with a different compiler version, in example, inside PB 6.01 I try to compile with 6.02 compiler.
Fred
Administrator
Administrator
Posts: 18220
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: MeshFace() with 4 parameters does not work here

Post by Fred »

Works as well
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Re: MeshFace() with 4 parameters does not work here

Post by Psychophanta »

Damn!
With the PB6.02B1 x86
I found it is not able to pass this line:

Code: Select all

If InitEngine3D()=0:MessageRequester("Error","The 3D Engine can't be initialized",0):End:EndIf
It Returns the error :shock:
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Re: MeshFace() with 4 parameters does not work here

Post by Psychophanta »

Now it works with PB602beta2 x86
@pf shadoko, your tip with 4 vertex face already works, buuuuuut
i must do:
InitEngine3D(#PB_Engine3D_DebugOutput,"C:\Program Files (x86)\PureBasic\Compilers\Engine3d.dll")
instead of:
InitEngine3D()

And I must say another thing: the 4 vertex face is a fake because there is builded 2 triangles instead a squared face.
Look yourself:

Code: Select all

InitEngine3D(#PB_Engine3D_DebugOutput,"C:\Program Files (x86)\PureBasic\Compilers\Engine3d.dll"):InitSprite():InitKeyboard():InitMouse()
OpenWindowedScreen(OpenWindow(0,0,0,1024,768,"no va cara de 4 vertices",#PB_Window_BorderLess|#PB_Window_ScreenCentered),0,0,1024,768,1,0,0,#PB_Screen_WaitSynchronization)

CreateLight(0,$EEEEEE,-1,1,6,#PB_Light_Point)
CreateCamera(0,0,0,100,100)
CameraRenderMode(0,#PB_Camera_Wireframe)
MoveCamera(0,0,0,4,#PB_Absolute)
CreateMaterial(0,0,$55DDEE)
CreateSphere(1,0.02)
          
CreateMesh(0,#PB_Mesh_TriangleList,#PB_Mesh_Static)
MeshVertex(-1,1,0,0,0,$EEEEEE,0,0,1)
MeshVertex(-1,-1,0,1,0,$EEEEEE,0,0,1)
MeshVertex(1,-1,0,0,1,$EEEEEE,0,0,1)
MeshVertex(1,1,0,0,1,$EEEEEE,0,0,1)
MeshFace(0,1,2,3)
FinishMesh(1)
CreateEntity(0,MeshID(0),MaterialID(0),0,0,0)
Repeat:While WindowEvent()<>#PB_Event_None:Wend
  ExamineMouse():ExamineKeyboard()
  RotateEntity(0,MouseDeltaY(),MouseDeltaX(),MouseWheel(),#PB_Relative)
  RenderWorld()
  FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or MouseButton(3)
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
pf shadoko
Enthusiast
Enthusiast
Posts: 386
Joined: Thu Jul 09, 2015 9:07 am

Re: MeshFace() with 4 parameters does not work here

Post by pf shadoko »

it seems to me that it is clear, InitEngine3D loads an old DLL
look in the folder where the unsaved codes are executed

of course, the faces with 4 parameters are made of 2 triangles (the 3d engine only eat triangles)
I had specified it when I made the doc, but it has been deleted...
MeshFace(t1, t2, t3 [, t4])
t4 : optional parameter to create 2 triangles (quad)
same as:
MeshFace(t1,t2,t3)
MeshFace(t1,t3,t4)
Post Reply