glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA,
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA,
bool Load_texture	(	GLuint *texture,		// Room for 1 texture to be stored.	const char *filename		// File to load (.png).	)	{	GLint max_size;	glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_size);	cout << "Max. texture size is " << max_size << endl;	glGenTextures(1, texture);	// Generate (empty) texture.	glBindTexture(GL_TEXTURE_2D, texture[0]);					// Read in .png.	int width, height, rowbytes, xoff, yoff;	unsigned char *pixels;		// Want last row, first.	if (!Import_png32(filename, width, height, rowbytes, xoff, yoff,							pixels, true))		return false;#if 0	for (int i = 0; i < width*height; i++)		if (pixels[4*i + 3] != 255)			cout << "Alpha detected" << endl;#endif	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA,			GL_UNSIGNED_BYTE, pixels);	delete pixels;#if 0					// Load from a .bmp.	SDL_Surface *image = SDL_LoadBMP(filename);	if (!image)		return false;		// Failed.					// Stick in the data.	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image->w, image->h, 0, GL_RGB,			GL_UNSIGNED_BYTE, image->pixels);	SDL_FreeSurface(image);#endif					// Linear filtering.	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);					// Repeat pattern.	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);	return true;	}