그냥 텍스쳐 사각형으로 입히려는데 전혀 뜨질 않네요..
뭐가 문제인지 봐주실수 있으신가요..?
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <glut.h>
#include <glu.h>
#include <gl.h>
#include <glaux.h>
#define TEXTURE_NUM 3
GLuint texture[TEXTURE_NUM];
char texture_name[TEXTURE_NUM][20] = { "cloud(1).png" ,"cloud(2).bmp" ,"cloud(3).bmp" };
void MyDis() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glPushMatrix();
glBindTexture(GL_TEXTURE_2D, texture[0]);
glBegin(GL_POLYGON);
glTexCoord2f(0.0f, 0.0f); glVertex3f(0.0f,0.0f, 0.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f(1.0f,0.0f, 0.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f(1.0f,1.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(0.0f,1.0f, 0.0f);
glEnd();
glPopMatrix();
glutSwapBuffers();
}
void ReDis(int w, int h) {
glClearColor(0.19f, 0.37f, 0.615f, 1.0f);
if (h <= 0)h = 1;
fAspect = (GLfloat)w / (GLfloat)h;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-10.0, 10.0, -10.0, 10.0, -10.0, 10.0);
}
void MouFunc(GLint Button, GLint State, GLint x, GLint y) {}
void MouseMoveFunc(int x, int y) {}
void KeyFunc(unsigned char keypress, int x, int y) {
}
void SpFunc(int spPress, int x, int y) {
}
void main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitWindowPosition(100, 100);
glutInitWindowSize(800, 800);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("20150307");
glutSetWindowTitle("20150307");
glutDisplayFunc(MyDis);
glutReshapeFunc(ReDis);
glutKeyboardFunc(KeyFunc);
glutSpecialFunc(SpFunc);
glutMouseFunc(MouFunc);
glutMotionFunc(MouseMoveFunc);
glutMainLoop();
}