crash this-->vector

Hi!
I have this code that gives me a crash error when I put an object in a vector:

Mesh.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
class Mesh : public object
{
    public:
        Mesh();	//inicializa el mesh
        virtual ~Mesh();

                vector<VertexTextureNormal> vtn;
		vector<GLuint> indices;

		void Draw(void);

		Mesh* Load(const char* filename);

    protected:

    private:
        static GLuint BufferIds[3];

        void Initialize(void);

        void indexVBO(vector<VertexTextureNormal> &in_vtn,
            vector<VertexTextureNormal> &out_vtn,
            vector<GLuint>              &out_indices
            );

        bool getSimilarVertexIndex(
            VertexTextureNormal &packed,
            std::map<VertexTextureNormal,GLuint> &VertexToOutIndex,
            GLuint &result
            );
};


Mesh.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Mesh* Mesh::Load(const char* filename)
{
   [..]
   indexVBO(vectorVertex, this->vtn, this->indices);   //vtn and indices are variables declared in mesh.hpp
   [..]
}

void Mesh::indexVBO(vector<VertexTextureNormal> &in_vtn,

              vector<VertexTextureNormal> &out_vtn,
              vector<GLuint>              &out_indices)
{
   [...]
   out_vtn.push_back(in_vtn[0]);   //Crash here
   [...]
}


Does anyone see the error?
Last edited on
If vtn and indices are global, how come you use this-> to access them?

Are you sure that vectorVertex is not empty?
Yes, I can access without this-> , but the program gives me the same crash error in the line 14.
I am sure that vectorVertex is not empty.
Last edited on
Sorry, I found the error. I forget the dynamic allocation in other part in the code.
Topic archived. No new replies allowed.