Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2012
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. typedef struct _texmodel{
  2.    int numVert;               //number of vertices in the model
  3.    GLuint textureID;          //texture handle
  4.    GLuint vertexID, uvID;     //array buffers specifying vertices/UV coords in modelspace
  5. }texModel;
  6.  
  7. texModel genTexModel(GLfloat *vertices, GLfloat *uv, GLuint texture, int localNumVert){
  8.  
  9.    texModel newModel = {0};
  10.    newModel.numVert = localNumVert;
  11.  
  12.    glGenBuffers(1, &newModel.vertexID);
  13.    glGenBuffers(1, &newModel.uvID);
  14.  
  15.    glBindBuffer(GL_ARRAY_BUFFER, newModel.vertexID);
  16.    glBufferData(GL_ARRAY_BUFFER, sizeof(vect2D)*newModel.numVert, vertices, GL_STATIC_DRAW);
  17.  
  18.    glBindBuffer(GL_ARRAY_BUFFER, newModel.uvID);
  19.    glBufferData(GL_ARRAY_BUFFER, sizeof(vect2D)*newModel.numVert, uv, GL_STATIC_DRAW);
  20.  
  21.    newModel.textureID = texture;
  22.  
  23.    return newModel;
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement