aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/iphone
diff options
context:
space:
mode:
authorOystein Eftevaag2009-05-10 12:01:37 +0000
committerOystein Eftevaag2009-05-10 12:01:37 +0000
commit11ba91b4de3dd0ea5315bd9f3e957e255b16e5fc (patch)
tree96ff974517ce70123d3df6440bc93266d9a0fc2f /backends/platform/iphone
parent3b92b0f583384ce01a988ca453daa416f53559ec (diff)
downloadscummvm-rg350-11ba91b4de3dd0ea5315bd9f3e957e255b16e5fc.tar.gz
scummvm-rg350-11ba91b4de3dd0ea5315bd9f3e957e255b16e5fc.tar.bz2
scummvm-rg350-11ba91b4de3dd0ea5315bd9f3e957e255b16e5fc.zip
Updated xcode project and did some minor iphone optimizations
svn-id: r40418
Diffstat (limited to 'backends/platform/iphone')
-rw-r--r--backends/platform/iphone/iphone_video.m23
1 files changed, 14 insertions, 9 deletions
diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m
index 1e02dd104d..5f6804bc17 100644
--- a/backends/platform/iphone/iphone_video.m
+++ b/backends/platform/iphone/iphone_video.m
@@ -203,7 +203,6 @@ uint getSizeNextPOT(uint size) {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _textureWidth, _textureHeight, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, _textureBuffer);
[_lock unlock];
- glClear(GL_COLOR_BUFFER_BIT);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer);
[_context presentRenderbuffer:GL_RENDERBUFFER_OES];
@@ -266,26 +265,32 @@ uint getSizeNextPOT(uint size) {
glOrthof(0, _backingWidth, 0, _backingHeight, 0, 1);
- if (_screenTexture > 0)
+ if (_screenTexture > 0) {
glDeleteTextures(1, &_screenTexture);
+ }
glGenTextures(1, &_screenTexture);
glBindTexture(GL_TEXTURE_2D, _screenTexture);
glEnable(GL_TEXTURE_2D);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- if (_textureBuffer)
+ if (_textureBuffer) {
free(_textureBuffer);
-
+ }
+
int textureSize = _textureWidth * _textureHeight * 2;
_textureBuffer = (char*)malloc(textureSize);
memset(_textureBuffer, 0, textureSize);
-
- glClear(GL_COLOR_BUFFER_BIT);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer);
- [_context presentRenderbuffer:GL_RENDERBUFFER_OES];
-
+
+ // The color buffer is triple-buffered, so we clear it multiple times right away to avid doing any glClears later.
+ int clearCount = 3;
+ while (clearCount-- > 0) {
+ glClear(GL_COLOR_BUFFER_BIT);
+ [_context presentRenderbuffer:GL_RENDERBUFFER_OES];
+ }
+
if (_keyboardView != nil) {
[_keyboardView removeFromSuperview];
[[_keyboardView inputView] removeFromSuperview];