Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void drawModel(texModel mod, vect2D loc){
- glUseProgram(texture2D);
- GLuint textureID = glGetUniformLocation(texture2D, "Texture");
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D,mod.textureID);
- glUniform1i(textureID,mod.textureID);
- glm::mat3 mvp = glm::mat3(1.0f,0.0f,loc.x,
- 0.0f,1.0f,loc.y,
- 0.0f,0.0f,1.0f);
- GLuint matrixID = glGetUniformLocation(vector2D, "MVP");
- glUniformMatrix3fv(matrixID, 1, GL_TRUE, &mvp[0][0]);
- glEnableVertexAttribArray(0);//enable location 0 for points
- glEnableVertexAttribArray(1);//enable location 1 for uv
- glBindBuffer(GL_ARRAY_BUFFER, mod.vertexID);
- glVertexAttribPointer( ///bind active buffer(polyID) to location
- 0, // attribute location
- 2, // size(of one element)
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- (void*)0 // array buffer offset
- );
- glBindBuffer(GL_ARRAY_BUFFER, mod.uvID);
- glVertexAttribPointer( ///bind active buffer(polyID) to location
- 1, // attribute location
- 2, // size(of one element)
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- (void*)0 // array buffer offset
- );
- glDrawArrays(GL_TRIANGLES,0,mod.numVert);
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement