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