ARB VBO's working from text file but not on arrays

Hello all,

I have run into a peculiar problem, I have walked through my code many times. In this first post I will only post the portions of the code that are close to my issue. I believe I have isolated my problem down to two functions but I can’t seem to bridge the gap.

First I am on Window7 64bit using GLEW 1.5.8 and OpenGL 3.1.0.
I have VBOs Shaders and Textures all wraped into one class, and this class has a conditional draw function depending on what you want drawn. Now when I read my data from a file (vertices, normals, tex_coordinates) my images appears just fine. However when I pass in arrays of data and try to load them into the VBO I get a black screen. Lets start with the problem so here is my definition of the data:

float vertices[18] = {
-2.1, 0, 2.1,
-2.1, 0, -2.1,
2.1, 0, 2.1,
-2.1, 0, -2.1,
2.1, 0, -2.1,
2.1, 0, 2.1
};
float normals[18] = {
0.0, 0.0, 1.0,
0.0, 0.0, 1.0,
0.0, 0.0, 1.0,
0.0, 0.0, 1.0,
0.0, 0.0, 1.0,
0.0, 0.0, 1.0
};
float tex_coord[12] = {
0.0, 0.0,
1.0, 0.0,
0.0, 1.0,
1.0, 0.0,
1.0, 1.0,
0.0, 1.0
};

Now I call my member function side my class like this

eelse if(!(vbo_shader.loadClientData(vertices,normals,tex_coord,6))){
cout << “ERROR: Could Load Your Clients Content” << endl;
exit(0);
}

The member functions is this:

bool VBOShaderLibrary::loadClientData(float* V, float* N, float* T, int number_of_vertices) {
bool contentLoaded = true;
try {
this->vertices = new Vertex[number_of_vertices];
this->normals = new Normal[number_of_vertices];
this->tex_coord = new TexCoord[number_of_vertices];

	cout &lt;&lt; "Vertices Data " &lt;&lt; endl;
	int vert_index = 0;
	for(int x = 0; x &lt; number_of_vertices*3; x+=3) {
		Vertex v(V[x],V[x+1],V[x+2]);
		this-&gt;vertices[vert_index] = v;
		cout	&lt;&lt; "&lt;" &lt;&lt; this-&gt;vertices[vert_index].coordX &lt;&lt; ", " 
				&lt;&lt; this-&gt;vertices[vert_index].coordY &lt;&lt; ", " 
				&lt;&lt; this-&gt;vertices[vert_index].coordZ 
				&lt;&lt; "&gt;" &lt;&lt; endl;
		vert_index++;
	}
	cout &lt;&lt; "Normal Data" &lt;&lt; endl;
	int norm_index = 0;
	for(int y = 0; y &lt; number_of_vertices*3; y+=3) {
		Normal n(N[y],N[y+1],N[y+2]);
		this-&gt;normals[norm_index] = n;
		cout	&lt;&lt; "&lt;" &lt;&lt; this-&gt;normals[norm_index].compoX &lt;&lt; ", " 
				&lt;&lt; this-&gt;normals[norm_index].compoY &lt;&lt; ", " 
				&lt;&lt; this-&gt;normals[norm_index].compoZ 
				&lt;&lt; "&gt;" &lt;&lt; endl;
		norm_index++;
	}
	cout &lt;&lt; "TexCoord Data " &lt;&lt; endl;
	int tex_coord_index = 0;
	for(int z = 0; z &lt; number_of_vertices*2; z+=2) {
		TexCoord t(T[z],T[z+1]);
		this-&gt;tex_coord[tex_coord_index] = t;
		cout	&lt;&lt; "&lt;" &lt;&lt; tex_coord[tex_coord_index].texcoordS &lt;&lt; ", " 
				&lt;&lt; this-&gt;tex_coord[tex_coord_index].texcoordT 
				&lt;&lt; "&gt;" &lt;&lt; endl;
		tex_coord_index++;
	}
	cout &lt;&lt; endl;

	int SIZE=this-&gt;verticesLoaded;
	this-&gt;pglGenBuffersARB(1,&VBOId);
	this-&gt;pglBindBufferARB(GL_ARRAY_BUFFER_ARB,VBOId);			
	this-&gt;pglBufferDataARB(GL_ARRAY_BUFFER_ARB,SIZE*(sizeof(Vertex)+sizeof(Normal)+sizeof(TexCoord)),0,GL_DYNAMIC_DRAW_ARB );						
	this-&gt;pglBufferSubDataARB(GL_ARRAY_BUFFER_ARB,0,SIZE*sizeof(Vertex),this-&gt;vertices);
	this-&gt;pglBufferSubDataARB(GL_ARRAY_BUFFER_ARB,SIZE*sizeof(Vertex),SIZE*sizeof(Normal),this-&gt;normals);
	this-&gt;pglBufferSubDataARB(GL_ARRAY_BUFFER_ARB,SIZE*(sizeof(Vertex)+sizeof(Normal)),SIZE*sizeof(TexCoord),this-&gt;tex_coord);
	cout &lt;&lt; "VBOs Initialized" &lt;&lt; endl;
	this-&gt;useVBOs = true;
}catch(...){
	cout &lt;&lt; "ERROR: When Loading VBOs" &lt;&lt; endl;
	contentLoaded = false;
	this-&gt;useVBOs = false;
}
if(this-&gt;vertices && this-&gt;normals && this-&gt;tex_coord) {
	delete this-&gt;vertices;
	delete this-&gt;normals;
	delete this-&gt;tex_coord;
}
return contentLoaded;

}

As stated before I have everthing else working if the data I pass in come from a file, I parse the file and then load it into the VBO. I would like to post some more code but I want to see what response I get first

Thank you, Matthew Hoggan

What is the value of this->verticesLoaded ?

Wow thank you. It is the small things that kill you somtimes.