03-04-2005, 01:32 PM
v1c: I know allocate does that but it behaves like malloc. I'm experimenting with Vertax buffers and NEW/DELETE are better suited for them instead of malloc as I wan't to do this:
I wan't to do this:
That would be easier to read and more coder friendly ;*)
With allocate I would define VA as:
And :
Then index it like
l337 but Cumbersome. :*(
Code:
Type vertex3d
x as glfloat
y as glfloat
z as glfloat
End type
Type VA
m_nNumverts as gluint
m_pVerts as vertex3d ptr
End type
dim vb as VA ptr
vb = Allocate(Len(vb)) 'Okay
vb->m_nNumverts = 1000
Code:
vb->m_pVerts = New vertex3d(vb->m_nNumverts)
x = vb->m_pVerts[index].x
y = vb->m_pVerts[index].y
z = vb->m_pVerts[index].z
That would be easier to read and more coder friendly ;*)
With allocate I would define VA as:
Code:
Type VA
m_nNumverts as gluint
m_pVerts as Glfloat ptr
End type
Code:
vb->m_pVerts = Allocate(Len(vertex3d) *vb->m_nNumverts))
Code:
x = vb->m_pVerts[index* 3 + 0]
y = vb->m_pVerts[index* 3 + 1]
z = vb->m_pVerts[index* 3 + 2]