A question about polygons.

Blitz3D Forums/Blitz3D Beginners Area/A question about polygons.

See if this helps.


Graphics3D 640,480,16,2
SetBuffer BackBuffer()

Camera=CreateCamera()
PositionEntity camera,0,0,-5

;Create Square with 4 vertices and 2 triangles.
Mesh1=CreateMesh()
surface=CreateSurface(mesh1)
 
 Vertex0=AddVertex(surface,-1,+1,0)
 Vertex1=AddVertex(surface,+1,+1,0)
 Vertex2=AddVertex(surface,+1,-1,0)
 Vertex3=AddVertex(surface,-1,-1,0)

 AddTriangle surface,vertex0,vertex1,vertex2
 AddTriangle surface,vertex0,vertex2,vertex3

 EntityColor Mesh1,255,0,0

;Create Square with 6 vertices and 2 triangles.
Mesh2=CreateMesh()
surface=CreateSurface(mesh2)
 
 Vertex0=AddVertex(surface,-1,+1,0)
 Vertex1=AddVertex(surface,+1,+1,0)
 Vertex2=AddVertex(surface,+1,-1,0)

 Vertex3=AddVertex(surface,-1,+1,0)
 Vertex4=AddVertex(surface,+1,-1,0)
 Vertex5=AddVertex(surface,-1,-1,0)

 AddTriangle surface,vertex0,vertex1,vertex2
 AddTriangle surface,vertex3,vertex4,vertex5
 
 EntityColor Mesh2,0,255,0

;Now move them to left & right so we can see them.
PositionEntity Mesh1,-2,0,0
PositionEntity Mesh2,+2,0,0

Repeat
If KeyHit(57) wire=1-wire
WireFrame wire
RenderWorld
Text 10,10,"Press SpaceBar to See wire frame outline.
Text 10,30,"Press esc to exit"
Flip
Until KeyHit(1) 
End 



To answer your question,
3 vertices per triangle.
One square(quad) can uses 4 or 6 vertices ,depending on there use.Most commonly it would be 4.Made up of....
4 vertices \ 2 triangles \ 1 surface(your texture)