We have a problem where a dynamic mesh is not being drawn the way we want it
to be drawn.

You can see the problem in this image.

http://img329.imageshack.us/img329/8563/texturetest0004xw3.jpg

We use a scripting engine to draw this on the client side.

The draw code goes something like this.

function ent:Draw()
        local m = Mesh("ring/redring")
        m:Begin(Mesh.QUADS, 20)

        local white = Color(255,255,255,255)
        
        for count = 1,20 do
                local v1 = vectorList[count].v1
                local v2 = vectorList[count].v2
                local v3 = vectorList[count].v3
                local v4 = vectorList[count].v4

                local normal = TriNormal(v1,v2,v3)

                m:Color(white)
                m:TexCoord(0, 1)
                m:Normal(normal)
                m:Position(v4)
                m:Advance()

                m:Color(white)
                m:TexCoord(1, 1)
                m:Normal(normal)
                m:Position(v3)
                m:Advance()
                
                m:Color(white)
                m:TexCoord(1, 0)
                m:Normal(normal)
                m:Position(v1)
                m:Advance()

                m:Color(white)
                m:TexCoord(0, 0)
                m:Normal(normal)
                m:Position(v2)
                m:Advance()
        end
        m:End()
end



This is what happens in C++
// Class members
IMesh *m_pMesh;
CMatRenderContextPtr m_RenderContext;
CMeshBuilder m_MeshBuilder;
IMaterial *m_pMat;

// m = Mesh("ring/redring")
m_RenderContext = materials->GetRenderContext();
m_pMat = materials->FindMaterial(mat, TEXTURE_GROUP_CLIENT_EFFECTS );

// m:Begin(Mesh.QUADS, 20)
m_RenderContext->Bind(m_pMat, NULL);
m_pMesh = m_RenderContext->GetDynamicMesh( );
m_MeshBuilder.Begin(m_pMesh,static_cast<MaterialPrimitiveType_t>(primativety
pe), numprimatives);

// m:End()
m_MeshBuilder.End(false, true);

// m:???(???)
Runs code from m_MeshBuilder;

All this code is called from a C_BaseEntity on the client side.

If you have any ideas on what is going wrong I will be very grateful.

With Thanks,
Haza


_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to