equal
deleted
inserted
replaced
78 procedure FreeWeaponTooltip; |
78 procedure FreeWeaponTooltip; |
79 procedure Tint(r, g, b, a: Byte); inline; |
79 procedure Tint(r, g, b, a: Byte); inline; |
80 procedure Tint(c: Longword); inline; |
80 procedure Tint(c: Longword); inline; |
81 |
81 |
82 implementation |
82 implementation |
83 uses uMisc, uConsole, uLocale; |
83 uses uMisc, uConsole, uLocale, uMobile; |
84 |
84 |
85 type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel, gvApple); |
85 type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel, gvApple); |
86 |
86 |
87 var HHTexture: PTexture; |
87 var HHTexture: PTexture; |
88 MaxTextureSize: LongInt; |
88 MaxTextureSize: LongInt; |
1136 {$ENDIF} |
1136 {$ENDIF} |
1137 {$ENDIF} |
1137 {$ENDIF} |
1138 end; |
1138 end; |
1139 |
1139 |
1140 procedure SetupOpenGL; |
1140 procedure SetupOpenGL; |
|
1141 {$IFNDEF IPHONEOS} |
1141 var vendor: shortstring; |
1142 var vendor: shortstring; |
1142 {$IFDEF DARWIN} |
1143 {$IFDEF DARWIN} |
1143 one: LongInt; |
1144 one: LongInt; |
|
1145 {$ENDIF} |
1144 {$ENDIF} |
1146 {$ENDIF} |
1145 begin |
1147 begin |
1146 |
1148 |
1147 {$IFDEF IPHONEOS} |
1149 {$IFDEF IPHONEOS} |
1148 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 0); // no double buffering |
1150 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 0); // no double buffering |
1149 SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 1); |
1151 SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 1); |
1150 {$ELSE} |
1152 {$ELSE} |
1151 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); |
1153 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); |
|
1154 vendor:= LowerCase(shortstring(pchar(glGetString(GL_VENDOR)))); |
1152 {$IFNDEF SDL13} |
1155 {$IFNDEF SDL13} |
1153 // this attribute is default in 1.3 and must be enabled in MacOSX |
1156 // this attribute is default in 1.3 and must be enabled in MacOSX |
1154 if (cReducedQuality and rqDesyncVBlank) <> 0 then |
1157 if (cReducedQuality and rqDesyncVBlank) <> 0 then |
1155 SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 0) |
1158 SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 0) |
1156 else |
1159 else |
1170 SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 16); // buffer has to be 16 bit only |
1173 SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 16); // buffer has to be 16 bit only |
1171 SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); // try to prefer hardware rendering |
1174 SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); // try to prefer hardware rendering |
1172 |
1175 |
1173 glGetIntegerv(GL_MAX_TEXTURE_SIZE, @MaxTextureSize); |
1176 glGetIntegerv(GL_MAX_TEXTURE_SIZE, @MaxTextureSize); |
1174 |
1177 |
1175 vendor:= LowerCase(shortstring(pchar(glGetString(GL_VENDOR)))); |
|
1176 {$IFDEF DEBUGFILE} |
1178 {$IFDEF DEBUGFILE} |
1177 AddFileLog('OpenGL-- Renderer: ' + shortstring(pchar(glGetString(GL_RENDERER)))); |
1179 AddFileLog('OpenGL-- Renderer: ' + shortstring(pchar(glGetString(GL_RENDERER)))); |
1178 AddFileLog(' |----- Vendor: ' + shortstring(pchar(glGetString(GL_VENDOR)))); |
1180 AddFileLog(' |----- Vendor: ' + shortstring(pchar(glGetString(GL_VENDOR)))); |
1179 AddFileLog(' |----- Version: ' + shortstring(pchar(glGetString(GL_VERSION)))); |
1181 AddFileLog(' |----- Version: ' + shortstring(pchar(glGetString(GL_VERSION)))); |
1180 AddFileLog(' \----- GL_MAX_TEXTURE_SIZE: ' + inttostr(MaxTextureSize)); |
1182 AddFileLog(' \----- GL_MAX_TEXTURE_SIZE: ' + inttostr(MaxTextureSize)); |
1266 ProgrTex:= Surface2Tex(texsurf, false); |
1268 ProgrTex:= Surface2Tex(texsurf, false); |
1267 |
1269 |
1268 squaresize:= texsurf^.w shr 1; |
1270 squaresize:= texsurf^.w shr 1; |
1269 numsquares:= texsurf^.h div squaresize; |
1271 numsquares:= texsurf^.h div squaresize; |
1270 SDL_FreeSurface(texsurf); |
1272 SDL_FreeSurface(texsurf); |
1271 {$IFDEF IPHONEOS} |
1273 |
1272 startSpinning(); |
1274 doSomethingWhen_AddProgress(); |
1273 {$ENDIF} |
|
1274 end; |
1275 end; |
1275 |
1276 |
1276 TryDo(ProgrTex <> nil, 'Error - Progress Texure is nil!', true); |
1277 TryDo(ProgrTex <> nil, 'Error - Progress Texure is nil!', true); |
1277 |
1278 |
1278 glClear(GL_COLOR_BUFFER_BIT); |
1279 glClear(GL_COLOR_BUFFER_BIT); |
1295 |
1296 |
1296 procedure FinishProgress; |
1297 procedure FinishProgress; |
1297 begin |
1298 begin |
1298 WriteLnToConsole('Freeing progress surface... '); |
1299 WriteLnToConsole('Freeing progress surface... '); |
1299 FreeTexture(ProgrTex); |
1300 FreeTexture(ProgrTex); |
1300 {$IFDEF IPHONEOS} |
1301 doSomethingWhen_FinishProgress(); |
1301 stopSpinning(); |
|
1302 {$ENDIF} |
|
1303 end; |
1302 end; |
1304 |
1303 |
1305 procedure flipSurface(Surface: PSDL_Surface; Vertical: Boolean); |
1304 procedure flipSurface(Surface: PSDL_Surface; Vertical: Boolean); |
1306 var y, x, i, j: LongInt; |
1305 var y, x, i, j: LongInt; |
1307 tmpPixel: Longword; |
1306 tmpPixel: Longword; |