1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-03 11:30:02 +00:00

This now uploads only a portion of the source buffer if possible. Which is usually possible.

This commit is contained in:
Thomas Harte 2015-07-27 20:58:51 -04:00
parent 1f229ee6f7
commit 1cbebdafcc

View File

@ -21,6 +21,7 @@
GLint _textureCoordinatesAttribute;
GLuint _textureName;
CRTSize _textureSize;
}
- (void)prepareOpenGL
@ -114,7 +115,14 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
glBufferData(GL_ARRAY_BUFFER, _crtFrame->number_of_runs * sizeof(GLushort) * 24, _crtFrame->runs, GL_DYNAMIC_DRAW);
glBindTexture(GL_TEXTURE_2D, _textureName);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _crtFrame->size.width, _crtFrame->size.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, _crtFrame->buffers[0].data);
if(_textureSize.width != _crtFrame->size.width || _textureSize.height != _crtFrame->size.height)
{
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _crtFrame->size.width, _crtFrame->size.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, _crtFrame->buffers[0].data);
_textureSize = _crtFrame->size;
}
else
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _crtFrame->size.width, _crtFrame->dirty_size.height, GL_RGBA, GL_UNSIGNED_BYTE, _crtFrame->buffers[0].data);
}
}