<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[GMan's Mods & Stuff — Can't AddVertex (BB3D Irrlicht)]]></title>
	<link rel="self" href="https://gprogs.com/extern.php?action=feed&amp;tid=469&amp;type=atom" />
	<updated>2013-01-06T20:40:31Z</updated>
	<generator>PunBB</generator>
	<id>https://gprogs.com/viewtopic.php?id=469</id>
		<entry>
			<title type="html"><![CDATA[Can't AddVertex (BB3D Irrlicht)]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=1749#p1749" />
			<content type="html"><![CDATA[<p>hello together,</p><p>my problem is i want create a triangle like you can see in the following code. But i get an error every time in the surface.bmx. What should i do????</p><p>&nbsp; </p><div class="codebox"><pre><code>SuperStrict
Import irrlicht.b3d

ib3d_Graphics3D(800, 600, 32, 0, True, True, EDT_DIRECT3D8)



Global cam:CAMERA = ib3d_CreateCamera()
ib3d_PositionEntity(cam, 0, 0, -10)

Global light1:LIGHT = ib3d_CreateLight()
ib3d_PositionEntity(light1, 0, 0, 0)
 &#039;SMeshBuffer() 

Global cube:MESH = ib3d_CreateMesh()
Global surf:SURFACE = ib3d_CreateSurface(cube, SF_NORMAL)    
Global v1:Int = ib3d_AddVertex(surf, 0,0 , 0)
Global v2:Int = ib3d_AddVertex(surf, 1, -1, 0)
Global v3:Int = ib3d_AddVertex(surf, -1, -1, 0)
ib3d_AddTriangle(surf, v1, v2, v3)
ib3d_UpdateNormals(cube)

While Not ib3d_KeyDown(KEY_ESCAPE)


    ib3d_UpdateWorld
    ib3d_RenderWorld
WEnd</code></pre></div><p>Surface.bmx<br />The error show that something in this wrong in this Method:</p><p>&nbsp; </p><div class="codebox"><pre><code>    &#039; TODO: dont think this is working right.  need to examine source of addTestSceneNode().
    Method addVertex:Int(x:Float,y:Float,z:Float,nx:Float=0,ny:Float=0,nz:Float=0,u:Float=0,v:Float=0)
        If Not _mbuf Or Not _mbuf.isValid() Then RuntimeError &quot;Surface meshbuffer is invalid&quot;
Rem
        Local vert:S3DVertex=S3DVertexDefault.createFromVals(x,y,z,nx,ny,nz,SColor.createFromVals(255,255,255,255),u,v)
        Local vert_array:S3DVertex[1] = vert
        &#039;DebugLog(&quot;before: &quot;+_mbuf.getVertices().size())
        _mbuf.getVertices().push_back(vert)
        &#039;DebugLog(&quot;after: &quot;+_mbuf.getVertices().size())
EndRem
        RuntimeError &quot;Not Implemented&quot;
        Return _mbuf.getVertexCount()-1
    EndMethod</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Mangoo]]></name>
				<uri>https://gprogs.com/profile.php?id=350</uri>
			</author>
			<updated>2013-01-06T20:40:31Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=1749#p1749</id>
		</entry>
</feed>
