Want more features on Pastebin? Sign Up, it's FREE!
Guest

OBJ Render

By: a guest on Aug 28th, 2012  |  syntax: C++  |  size: 0.84 KB  |  views: 23  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data