884 s:= filename + '.png'; |
885 s:= filename + '.png'; |
885 tmpsurf:= IMG_Load(Str2PChar(s)); |
886 tmpsurf:= IMG_Load(Str2PChar(s)); |
886 end; |
887 end; |
887 |
888 |
888 if tmpsurf = nil then |
889 if tmpsurf = nil then |
889 if critical then OutError(msgFailed, true) |
890 begin |
890 else begin |
891 OutError(msgFailed, critical); |
891 WriteLnToConsole(msgFailed); |
892 exit(nil) |
892 exit(nil) |
893 end; |
893 end; |
894 |
|
895 if (tmpsurf^.w > MaxTextureSize) or (tmpsurf^.h > MaxTextureSize) then |
|
896 begin |
|
897 SDL_FreeSurface(tmpsurf); |
|
898 OutError(msgFailedSize, critical); |
|
899 exit(SDL_CreateRGBSurface(SDL_SWSURFACE, 32, 32, 32, RMask, GMask, BMask, AMask)) |
|
900 end; |
894 |
901 |
895 if setTransparent then TryDo(SDL_SetColorKey(tmpsurf, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); |
902 if setTransparent then TryDo(SDL_SetColorKey(tmpsurf, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); |
896 //if hasAlpha then Result:= SDL_DisplayFormatAlpha(tmpsurf) |
903 //if hasAlpha then Result:= SDL_DisplayFormatAlpha(tmpsurf) |
897 // else Result:= SDL_DisplayFormat(tmpsurf); |
904 // else Result:= SDL_DisplayFormat(tmpsurf); |
898 {$IFDEF DEBUGFILE}WriteLnToConsole('(' + inttostr(tmpsurf^.w) + ',' + inttostr(tmpsurf^.h) + ') ');{$ENDIF} |
905 WriteLnToConsole('(' + inttostr(tmpsurf^.w) + ',' + inttostr(tmpsurf^.h) + ') '); |
899 WriteLnToConsole(msgOK); |
906 WriteLnToConsole(msgOK); |
900 LoadImage:= tmpsurf//Result |
907 |
|
908 LoadImage:= tmpsurf //Result |
901 end; |
909 end; |
902 |
910 |
903 procedure SetupOpenGL; |
911 procedure SetupOpenGL; |
904 begin |
912 begin |
905 glLoadIdentity; |
913 glLoadIdentity; |
906 glViewport(0, 0, cScreenWidth, cScreenHeight); |
914 glViewport(0, 0, cScreenWidth, cScreenHeight); |
907 glScalef(2.0 / cScreenWidth, -2.0 / cScreenHeight, 1.0); |
915 glScalef(2.0 / cScreenWidth, -2.0 / cScreenHeight, 1.0); |
908 glTranslatef(-cScreenWidth / 2, -cScreenHeight / 2, 0); |
916 glTranslatef(-cScreenWidth / 2, -cScreenHeight / 2, 0); |
909 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
917 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
910 glMatrixMode(GL_MODELVIEW) |
918 glMatrixMode(GL_MODELVIEW); |
|
919 |
|
920 glGetIntegerv(GL_MAX_TEXTURE_SIZE, @MaxTextureSize); |
|
921 {$IFDEF DEBUGFILE} |
|
922 AddFileLog('GL_MAX_TEXTURE_SIZE: ' + inttostr(MaxTextureSize)); |
|
923 {$ENDIF} |
911 end; |
924 end; |
912 |
925 |
913 //////////////////////////////////////////////////////////////////////////////// |
926 //////////////////////////////////////////////////////////////////////////////// |
914 var ProgrTex: PTexture = nil; |
927 var ProgrTex: PTexture = nil; |
915 Step: integer = 0; |
928 Step: integer = 0; |