It is currently Wed Jun 20, 2018 6:17 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: MeshVertexColor() then MeshVertexPosition()
PostPosted: Thu Feb 01, 2018 9:06 pm 
Online
Addict
Addict
User avatar

Joined: Wed Jun 11, 2003 9:33 pm
Posts: 4418
Location: Spa, relaxing and thinking, and learning...
Program works as expected when do:
Code:
malla.i=CreateMesh(#PB_Any,#PB_Mesh_PointList,#PB_Mesh_Dynamic)
MeshVertexPosition(Random(100)-50,Random(100)-50,Random(100)-50)
MeshVertexColor($EEEE00)
FinishMesh(0)


Program halts (even debugger on) when do:
Code:
malla.i=CreateMesh(#PB_Any,#PB_Mesh_PointList,#PB_Mesh_Dynamic)
MeshVertexColor($EEEE00)
MeshVertexPosition(Random(100)-50,Random(100)-50,Random(100)-50)
FinishMesh(0)

_________________
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
While (world==business) {world+=mafia}


Top
 Profile  
Reply with quote  
 Post subject: Re: MeshVertexColor() then MeshVertexPosition()
PostPosted: Sat Feb 03, 2018 5:39 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Feb 19, 2011 10:06 am
Posts: 712
Location: Denmark
Are you trying to move vertices?

Like this?
Code:
InitEngine3D()
InitSprite()
InitKeyboard()

Declare.i MoveVerticesAtRandom(Mesh.i)
Global el.i

OpenWindow(0, 0, 0, 1024, 768, "Malla", #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 1024, 768)
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 0, 50)

malla.i=CreateMesh(#PB_Any,#PB_Mesh_PointList, #PB_Mesh_Dynamic)
For x = 0 To 1200
  MeshVertexPosition(Random(100)-50, Random(100)-50, Random(100)-50)
Next x
FinishMesh(#True)

CreateEntity(0, MeshID(malla),#PB_Material_None, 0, 0, 0)

el = ElapsedMilliseconds()

Repeat
 
  Repeat
    ev = WindowEvent()
  Until  ev = 0
 
  If ElapsedMilliseconds()- el > 100
    ret.i = MoveVerticesAtRandom(malla)
    el = ElapsedMilliseconds()
  EndIf
 
  RenderWorld()
 
  FlipBuffers()
 
  ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)

Procedure.i MoveVerticesAtRandom(Mesh.i)
  Protected Dim md.PB_MeshVertex(0)
  GetMeshData(Mesh,0, md(), #PB_Mesh_Vertex, 0, MeshVertexCount(Mesh)-1)
  For x = 0 To 1199
    md(x)\x = Random(100)-50
    md(x)\y = Random(100)-50
    md(x)\z = Random(100)-50
  Next x
  SetMeshData(Mesh, 0, md(), #PB_Mesh_Vertex, 0, MeshVertexCount(Mesh)-1)
  ProcedureReturn #True
EndProcedure

_________________
“Tell me and I forget. Teach me and I remember. Involve me and I learn.”
— Benjamin Franklin
Current configurations: Windows 7/10, Intel 6800K, Gtx 970, 32 gb ram.


Top
 Profile  
Reply with quote  
 Post subject: Re: MeshVertexColor() then MeshVertexPosition()
PostPosted: Sun Feb 04, 2018 2:20 pm 
Offline
Addict
Addict

Joined: Sun Jun 25, 2006 7:28 pm
Posts: 1293
Hi Psychophanta, DK_PETER
my own view point is that : MeshVertexColor needs a Vertex created before to apply color to it, this is why MeshVertexPosition should come before MeshVertexColor
in opengl it is different:
glColor3f_(r, g, b)
glVertex3f_ ( x, y,z)
but here the glColor3f_(r, g, b) is not specific to certain vertex but apply to all the graphics below it until changed to other color


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye