Advertisement
Guest User

OBJ Render

a guest
Aug 28th, 2012
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. void Mesh_handle::DrawTri(){
  2.      glBindBuffer(GL_ARRAY_BUFFER,vertexbufferid);
  3.     glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,elementbufferid);
  4.     int index1=glGetAttribLocation(bound_program,"inputvertex");
  5.     int index2=glGetAttribLocation(bound_program,"inputcolor");
  6.     int index3=glGetAttribLocation(bound_program,"inputtexcoord");
  7.  
  8.     glEnableVertexAttribArray(index1);
  9.     glVertexAttribPointer(index1,3,GL_FLOAT,GL_FALSE,9*sizeof(float),0);
  10.  
  11.     glEnableVertexAttribArray(index2);
  12.     glVertexAttribPointer(index2,4,GL_FLOAT,GL_FALSE,9*sizeof(float),(void*)(3*sizeof(float)));
  13.  
  14.     glEnableVertexAttribArray(index3);
  15.     glVertexAttribPointer(index3,2,GL_FLOAT,GL_FALSE,9*sizeof(float),(void*)(7*sizeof(float)));
  16.  
  17.     glDrawArrays(GL_TRIANGLE_STRIP,0,elementcount);
  18.     //glDrawElements(GL_TRIANGLE_STRIP,elementcount,GL_UNSIGNED_INT,0);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement