64
62
glOrtho( 0, 640, 480, 0, -1, 1 );
66
64
glMatrixMode( GL_MODELVIEW );
69
67
// Load the OpenGL texture
71
69
GLuint texture; // Texture object handle
72
70
SDL_Surface *surface; // Gives us the information to make the texture
76
74
// Check that the image's width is a power of 2
77
75
if ( (surface->w & (surface->w - 1)) != 0 ) {
78
76
printf("warning: image.bmp's width is not a power of 2\n");
81
79
// Also check if the height is a power of 2
82
80
if ( (surface->h & (surface->h - 1)) != 0 ) {
83
81
printf("warning: image.bmp's height is not a power of 2\n");
86
84
// Have OpenGL generate a texture object handle for us
87
85
glGenTextures( 1, &texture );
89
87
// Bind the texture object
90
88
glBindTexture( GL_TEXTURE_2D, texture );
92
90
// Set the texture's stretching properties
93
91
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
94
92
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );