Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm trying to keep a 3D model on the screen by placing my glDrawElement functions inside the draw function with the declarations at the top of .cpp. When I render the model, the model attaches it self to the current vertex buffer object. This is because my whole graphical user interface is in 2D quads except the window frame. Is there a way to avoid this from happening? or any common causes of this?

Creating the file object:

int index = IndexAssigner(1, 1);
//make a fileobject and store list and the index of that list in a c string
ifstream file (list[index].c_str() );
//Make another string
//string line;
points.push_back(Point());
Point p;
int face[4];

Model rendering code:

int numfloats = 4;
float* point=reinterpret_cast<float*>(&points[0]);
int num_bytes=numfloats*sizeof(float);

cout << "Size Of Point" << sizeof(Point) << endl;
GLuint vertexbuffer;
glGenVertexArrays(1, &vao[3]);
glGenBuffers(1, &vertexbuffer);
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
glBufferData(GL_ARRAY_BUFFER, points.size()*sizeof(points), points.data(), GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, num_bytes, &points[0]);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT,  points.size(), &points[0]);
glEnableClientState(GL_INDEX_ARRAY);
glIndexPointer(GL_FLOAT, faces.size(), faces.data());
glEnableVertexAttribArray(0);
glDrawElements(GL_QUADS, points.size(), GL_UNSIGNED_INT, points.data());
glDrawElements(GL_QUADS, faces.size(), GL_UNSIGNED_INT, faces.data());
share|improve this question
1  
Hmm. Maybe a snippet of source code or a screen shot will help clear up this question? It's fairly vague. –  Byte56 Apr 10 '12 at 14:05
    
edited my question :) –  NoobScratcher Apr 10 '12 at 14:21
    
A snippet of code. Not the whole source. Please edit again. –  Byte56 Apr 10 '12 at 14:34
    
edited my question again :) –  NoobScratcher Apr 10 '12 at 14:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.