Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <GL/glew.h>
- #include <GL/glut.h>
- #include "soil-master/src/SOIL/SOIL.h"
- GLuint texID;
- int rep=1;
- void Display(void) {
- glClear(GL_COLOR_BUFFER_BIT);
- glPushMatrix();
- glBindTexture(GL_TEXTURE_2D, texID);
- glBegin(GL_QUADS);
- glTexCoord2f(0.0f, 0.0f); glVertex3f(200, 200, 0);
- glTexCoord2f(rep, 0.0f); glVertex3f(500, 200, 0);
- glTexCoord2f(rep, rep); glVertex3f(500, 500, 0);
- glTexCoord2f(0.0f, rep); glVertex3f(200, 500, 0);
- glEnd();
- glPopMatrix();
- glFlush();
- }
- int main(int argc, char** argr) {
- glutInit(&argc, argr);
- glutInitWindowSize(600, 600);
- glutInitWindowPosition(50, 50);
- glutCreateWindow("Texture 2D");
- glutDisplayFunc(Display);
- glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
- glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
- glEnable(GL_TEXTURE_2D);
- gluOrtho2D(0,600,0,600);
- texID = SOIL_load_OGL_texture("metal.bmp", SOIL_CREATE_NEW_ID, SOIL_LOAD_AUTO, SOIL_FLAG_MIPMAPS);
- glutMainLoop();
- }.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement