354 begin |
356 begin |
355 for t:= 0 to Pred(TeamsCount) do |
357 for t:= 0 to Pred(TeamsCount) do |
356 if TeamsArray[t] <> nil then |
358 if TeamsArray[t] <> nil then |
357 with TeamsArray[t]^ do |
359 with TeamsArray[t]^ do |
358 begin |
360 begin |
359 if GraveName = '' then GraveName:= 'Simple'; |
361 if GraveName = '' then GraveName:= 'Statue'; |
360 texsurf:= LoadImage(Pathz[ptGraves] + '/' + GraveName, ifCritical or ifTransparent); |
362 texsurf:= LoadImage(Pathz[ptGraves] + '/' + GraveName, ifTransparent); |
|
363 if texsurf = nil then texsurf:= LoadImage(Pathz[ptGraves] + '/Statue', ifCritical or ifTransparent); |
361 GraveTex:= Surface2Tex(texsurf, false); |
364 GraveTex:= Surface2Tex(texsurf, false); |
362 SDL_FreeSurface(texsurf) |
365 SDL_FreeSurface(texsurf) |
363 end |
366 end |
364 end; |
367 end; |
365 |
368 |
799 SpritesData[ii].Surface:= nil; |
802 SpritesData[ii].Surface:= nil; |
800 end; |
803 end; |
801 SDL_FreeSurface(MissionIcons); |
804 SDL_FreeSurface(MissionIcons); |
802 FreeTexture(ropeIconTex); |
805 FreeTexture(ropeIconTex); |
803 FreeTexture(HHTexture); |
806 FreeTexture(HHTexture); |
|
807 if isStereoEnabled then |
|
808 begin |
|
809 glDeleteTextures(1, @texl); |
|
810 glDeleteRenderbuffersEXT(1, @depthl); |
|
811 glDeleteFramebuffersEXT(1, @framel); |
|
812 glDeleteTextures(1, @texr); |
|
813 glDeleteRenderbuffersEXT(1, @depthr); |
|
814 glDeleteFramebuffersEXT(1, @framer) |
|
815 end |
804 end; |
816 end; |
805 |
817 |
806 |
818 |
807 function CheckCJKFont(s: ansistring; font: THWFont): THWFont; |
819 function CheckCJKFont(s: ansistring; font: THWFont): THWFont; |
808 var l, i : LongInt; |
820 var l, i : LongInt; |
1168 {$IFDEF DEBUGFILE} |
1180 {$IFDEF DEBUGFILE} |
1169 AddFileLog('OpenGL Warning - driver didn''t provide any valid max texture size; assuming 1024'); |
1181 AddFileLog('OpenGL Warning - driver didn''t provide any valid max texture size; assuming 1024'); |
1170 {$ENDIF} |
1182 {$ENDIF} |
1171 end; |
1183 end; |
1172 |
1184 |
1173 {$IFNDEF IPHONEOS} |
1185 {$IFDEF IPHONEOS} |
|
1186 cGPUVendor:= gvApple; |
|
1187 {$ELSE} |
1174 if StrPos(Str2PChar(vendor), Str2PChar('nvidia')) <> nil then |
1188 if StrPos(Str2PChar(vendor), Str2PChar('nvidia')) <> nil then |
1175 cGPUVendor:= gvNVIDIA |
1189 cGPUVendor:= gvNVIDIA |
1176 else if StrPos(Str2PChar(vendor), Str2PChar('intel')) <> nil then |
1190 else if StrPos(Str2PChar(vendor), Str2PChar('intel')) <> nil then |
1177 cGPUVendor:= gvATI |
1191 cGPUVendor:= gvATI |
1178 else if StrPos(Str2PChar(vendor), Str2PChar('ati')) <> nil then |
1192 else if StrPos(Str2PChar(vendor), Str2PChar('ati')) <> nil then |
1179 cGPUVendor:= gvIntel; |
1193 cGPUVendor:= gvIntel; |
1180 //SupportNPOTT:= glLoadExtension('GL_ARB_texture_non_power_of_two'); |
1194 //SupportNPOTT:= glLoadExtension('GL_ARB_texture_non_power_of_two'); |
1181 {$ELSE} |
1195 |
1182 cGPUVendor:= gvApple; |
1196 if isStereoEnabled then |
|
1197 begin |
|
1198 // prepare left and right frame buffers and associated textures |
|
1199 glLoadExtension('GL_EXT_framebuffer_object'); |
|
1200 |
|
1201 // left |
|
1202 glGenFramebuffersEXT(1, @framel); |
|
1203 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framel); |
|
1204 glGenRenderbuffersEXT(1, @depthl); |
|
1205 glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depthl); |
|
1206 glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, cScreenWidth, cScreenHeight); |
|
1207 glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthl); |
|
1208 glGenTextures(1, @texl); |
|
1209 glBindTexture(GL_TEXTURE_2D, texl); |
|
1210 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, cScreenWidth, cScreenHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nil); |
|
1211 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
|
1212 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
|
1213 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, texl, 0); |
|
1214 |
|
1215 // right |
|
1216 glGenFramebuffersEXT(1, @framer); |
|
1217 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framer); |
|
1218 glGenRenderbuffersEXT(1, @depthr); |
|
1219 glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depthr); |
|
1220 glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, cScreenWidth, cScreenHeight); |
|
1221 glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthr); |
|
1222 glGenTextures(1, @texr); |
|
1223 glBindTexture(GL_TEXTURE_2D, texr); |
|
1224 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, cScreenWidth, cScreenHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nil); |
|
1225 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
|
1226 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
|
1227 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, texr, 0); |
|
1228 |
|
1229 // reset |
|
1230 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0) |
|
1231 end; |
1183 {$ENDIF} |
1232 {$ENDIF} |
1184 |
1233 |
1185 {$IFDEF DEBUGFILE} |
1234 {$IFDEF DEBUGFILE} |
1186 if cGPUVendor = gvUnknown then |
1235 if cGPUVendor = gvUnknown then |
1187 AddFileLog('OpenGL Warning - unknown hardware vendor; please report'); |
1236 AddFileLog('OpenGL Warning - unknown hardware vendor; please report'); |