Now I just get a blank quad... I tried figuring it out, but it just won't work.

Here's my image loading code:

[pascal]
function TPJPImage.LoadImage(filename: PChar): Boolean;
var
surface: PSDL_Surface;
nOfColors: GLint;
begin
//Load the texture into memory
surface := IMG_Load(filename);
if (surface = nil) then
begin
Result := False;
Exit;
end;

//Process the surface
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);

glGenTextures(1, @texture);
glBindTexture(GL_TEXTURE_2D, texture);

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R, GL_NEAREST);

nOfColors := surface^.format^.BitsPerPixel;
if (nOfColors = 4) then //Texture has alpha channel
begin
glTexImage2D(GL_TEXTURE_2D, 0, 4, surface^.w, surface^.h, 0, GL_RGBA,
GL_UNSIGNED_BYTE, surface^.pixels);
gluBuild2DMipmaps(GL_TEXTURE_2D, 4, surface^.w, surface^.h, GL_RGBA,
GL_UNSIGNED_BYTE, surface^.pixels);
end
else if (nOfColors = 3) then //No alpha channel
begin
glTexImage2D(GL_TEXTURE_2D, 0, 3, surface^.w, surface^.h, 0, GL_RGB,
GL_UNSIGNED_BYTE, surface^.pixels);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, surface^.w, surface^.h, GL_RGB,
GL_UNSIGNED_BYTE, surface^.pixels);
end;

fWidth := surface^.w;
fHeight := surface^.h;

SDL_FreeSurface(surface);
Result := True;
end;
[/pascal]

The texture variable belongs to the TPJPImage class and is a GLuint.