I have made a class that looks like this:
Code:
class DLLIMPORT Object
{
private:
float x, y, z;
public:
LPDIRECT3DVERTEXBUFFER9 vertexbuffer; //Main point here
Object();
void AddVertexBuffer(VERTEXBUFFER buf);
};
Than I made the STL list and iterator:
Code:
list<Object> objects;
list<Object>::iterator iter;
Than I tried to use the iter to get the vertexbuffer from the class and use it:
Code:
for (iter = objects.begin(); iter != objects.end(); iter++)
{
device->SetStreamSource(0, iter->vertexbuffer, 0, sizeof(CUSTOMVERTEX)); //Main point here
}
device->SetFVF(D3DFVF_CUSTOMVERTEX);
device->DrawPrimitive(D3DPT_TRIANGLELIST, 0, objects.size());
It compiles fine but when I run it, it gives a windows error saying the program had to close. Am I not alowed to use a varaible from the class or is there a better way? I can not use STL vectors or stacks/deques for certain reasons I already looked over.