Thanks for the quick answer.
The vertices array is not NULL.
Here’s about the rest of the code:
I have a renderer class. In it’s constructor the members
GLuint vao;
GLuint buffer[3];
GLuint tex;
are initialized:
glGenVertexArrays(1 ,&vao);
glBindVertexArray( vao );
glGenBuffers(3, buffer);
glBindBuffer( GL_ARRAY_BUFFER, buffer[0]);//vertices
glBindBuffer( GL_ARRAY_BUFFER, buffer[1]);//normals
glBindBuffer( GL_ARRAY_BUFFER, buffer[2]);//tex coords
glActiveTexture(GL_TEXTURE0);
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
There’s an “init” method which runs 1 time before all the application for compiling the shaders, making a program, linking and using the program.
Each render of all objects call in a loop a method of the renderer which handles a single object. The code of this method is mainly:
glBindBuffer( GL_ARRAY_BUFFER, buffer[0]);
glBufferData( GL_ARRAY_BUFFER, pvertices->size()*sizeof(vec4), &((*pvertices)[0]),GL_STREAM_DRAW);
glBindBuffer( GL_ARRAY_BUFFER, buffer[1]);
glBufferData( GL_ARRAY_BUFFER, pveretexNormals->size()*sizeof(vec4), &((*pveretexNormals)[0]), GL_STREAM_DRAW);
glBindBuffer( GL_ARRAY_BUFFER, buffer[2]);
glBufferData( GL_ARRAY_BUFFER, texCoords->size()*sizeof(vec2), &((*texCoords)[0]), GL_STATIC_DRAW);
glBindTexture(GL_TEXTURE_2D, tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, imWidth, imHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, textureIm);
glGenerateMipmap(GL_TEXTURE_2D);
//Then uniforms are passed (…)
glEnable(GL_TEXTURE_2D);
glUniform1i(texMap_buffLoc,0);//this one of the uniforms fir texture 0
Here is the call for glDrawArrays
glEnable(GL_VERTEX_ARRAY);
glDrawArrays( GL_TRIANGLES, 0, pvertices->size());
glDisable(GL_VERTEX_ARRAY);
glDisable(GL_TEXTURE_2D);
Thanks again