802 SpritesData[ii].Surface:= nil; |
800 SpritesData[ii].Surface:= nil; |
803 end; |
801 end; |
804 SDL_FreeSurface(MissionIcons); |
802 SDL_FreeSurface(MissionIcons); |
805 FreeTexture(ropeIconTex); |
803 FreeTexture(ropeIconTex); |
806 FreeTexture(HHTexture); |
804 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 |
|
816 end; |
805 end; |
817 |
806 |
818 |
807 |
819 function CheckCJKFont(s: ansistring; font: THWFont): THWFont; |
808 function CheckCJKFont(s: ansistring; font: THWFont): THWFont; |
820 var l, i : LongInt; |
809 var l, i : LongInt; |
1180 {$IFDEF DEBUGFILE} |
1169 {$IFDEF DEBUGFILE} |
1181 AddFileLog('OpenGL Warning - driver didn''t provide any valid max texture size; assuming 1024'); |
1170 AddFileLog('OpenGL Warning - driver didn''t provide any valid max texture size; assuming 1024'); |
1182 {$ENDIF} |
1171 {$ENDIF} |
1183 end; |
1172 end; |
1184 |
1173 |
1185 {$IFDEF IPHONEOS} |
1174 {$IFNDEF IPHONEOS} |
1186 cGPUVendor:= gvApple; |
|
1187 {$ELSE} |
|
1188 if StrPos(Str2PChar(vendor), Str2PChar('nvidia')) <> nil then |
1175 if StrPos(Str2PChar(vendor), Str2PChar('nvidia')) <> nil then |
1189 cGPUVendor:= gvNVIDIA |
1176 cGPUVendor:= gvNVIDIA |
1190 else if StrPos(Str2PChar(vendor), Str2PChar('intel')) <> nil then |
1177 else if StrPos(Str2PChar(vendor), Str2PChar('intel')) <> nil then |
1191 cGPUVendor:= gvATI |
1178 cGPUVendor:= gvATI |
1192 else if StrPos(Str2PChar(vendor), Str2PChar('ati')) <> nil then |
1179 else if StrPos(Str2PChar(vendor), Str2PChar('ati')) <> nil then |
1193 cGPUVendor:= gvIntel; |
1180 cGPUVendor:= gvIntel; |
1194 //SupportNPOTT:= glLoadExtension('GL_ARB_texture_non_power_of_two'); |
1181 //SupportNPOTT:= glLoadExtension('GL_ARB_texture_non_power_of_two'); |
1195 |
1182 {$ELSE} |
1196 if isStereoEnabled then |
1183 cGPUVendor:= gvApple; |
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; |
|
1232 {$ENDIF} |
1184 {$ENDIF} |
1233 |
1185 |
1234 {$IFDEF DEBUGFILE} |
1186 {$IFDEF DEBUGFILE} |
1235 if cGPUVendor = gvUnknown then |
1187 if cGPUVendor = gvUnknown then |
1236 AddFileLog('OpenGL Warning - unknown hardware vendor; please report'); |
1188 AddFileLog('OpenGL Warning - unknown hardware vendor; please report'); |