- procedure TForm1.LoadTexture(name : string; id : gluInt);
- var
- tex : PSDL_Surface;
- begin
- tex := IMG_Load(PChar(ExtractFileDir(paramStr(0))+'/'+name));
- if assigned(tex) then
- begin
- glGenTextures(1, @ID);
- glBindTexture(GL_TEXTURE_2D, ID);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexImage2D(GL_TEXTURE_2D, 0, 3, tex^.w, tex^.h,0, GL_RGB, GL_UNSIGNED_BYTE, tex^.pixels);
- SDL_FreeSurface(tex);
- end;
- end;