Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef struct _texmodel{
- int numVert; //number of vertices in the model
- GLuint textureID; //texture handle
- GLuint vertexID, uvID; //array buffers specifying vertices/UV coords in modelspace
- }texModel;
- texModel genTexModel(GLfloat *vertices, GLfloat *uv, GLuint texture, int localNumVert){
- texModel newModel = {0};
- newModel.numVert = localNumVert;
- glGenBuffers(1, &newModel.vertexID);
- glGenBuffers(1, &newModel.uvID);
- glBindBuffer(GL_ARRAY_BUFFER, newModel.vertexID);
- glBufferData(GL_ARRAY_BUFFER, sizeof(vect2D)*newModel.numVert, vertices, GL_STATIC_DRAW);
- glBindBuffer(GL_ARRAY_BUFFER, newModel.uvID);
- glBufferData(GL_ARRAY_BUFFER, sizeof(vect2D)*newModel.numVert, uv, GL_STATIC_DRAW);
- newModel.textureID = texture;
- return newModel;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement