| @@ -73,8 +73,13 @@ FrameBuffer::FrameBuffer(ivec2 size) | |||||
| GLenum wrapmode = GL_REPEAT; | GLenum wrapmode = GL_REPEAT; | ||||
| GLenum filtering = GL_NEAREST; | GLenum filtering = GL_NEAREST; | ||||
| # if GL_VERSION_1_1 || GL_ES_VERSION_2_0 | |||||
| glGenFramebuffers(1, &m_data->m_fbo); | glGenFramebuffers(1, &m_data->m_fbo); | ||||
| glBindFramebuffer(GL_FRAMEBUFFER, m_data->m_fbo); | glBindFramebuffer(GL_FRAMEBUFFER, m_data->m_fbo); | ||||
| # else | |||||
| glGenFramebuffersOES(1, &m_data->m_fbo); | |||||
| glBindFramebufferOES(GL_FRAMEBUFFER_OES, m_data->m_fbo); | |||||
| # endif | |||||
| glGenTextures(1, &m_data->m_texture); | glGenTextures(1, &m_data->m_texture); | ||||
| glActiveTexture(GL_TEXTURE0); | glActiveTexture(GL_TEXTURE0); | ||||
| @@ -86,8 +91,14 @@ FrameBuffer::FrameBuffer(ivec2 size) | |||||
| glTexImage2D(GL_TEXTURE_2D, 0, internal_format, size.x, size.y, 0, | glTexImage2D(GL_TEXTURE_2D, 0, internal_format, size.x, size.y, 0, | ||||
| format, GL_UNSIGNED_BYTE, NULL); | format, GL_UNSIGNED_BYTE, NULL); | ||||
| # if GL_VERSION_1_1 || GL_ES_VERSION_2_0 | |||||
| glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | ||||
| GL_TEXTURE_2D, m_data->m_texture, 0); | GL_TEXTURE_2D, m_data->m_texture, 0); | ||||
| # else | |||||
| glFramebufferTexture2DOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_EXT, | |||||
| GL_TEXTURE_2D, m_data->m_texture, 0); | |||||
| # endif | |||||
| m_data->m_depth = GL_INVALID_ENUM; | m_data->m_depth = GL_INVALID_ENUM; | ||||
| # if GL_VERSION_1_1 | # if GL_VERSION_1_1 | ||||
| /* FIXME: not implemented on GL ES, see | /* FIXME: not implemented on GL ES, see | ||||
| @@ -101,7 +112,10 @@ FrameBuffer::FrameBuffer(ivec2 size) | |||||
| GL_RENDERBUFFER, m_data->m_depth); | GL_RENDERBUFFER, m_data->m_depth); | ||||
| } | } | ||||
| # endif | # endif | ||||
| # if GL_VERSION_1_1 || GL_ES_VERSION_2_0 | |||||
| glCheckFramebufferStatus(GL_FRAMEBUFFER); | glCheckFramebufferStatus(GL_FRAMEBUFFER); | ||||
| # endif | |||||
| Unbind(); | Unbind(); | ||||
| #endif | #endif | ||||
| @@ -111,7 +125,11 @@ FrameBuffer::~FrameBuffer() | |||||
| { | { | ||||
| #if defined USE_D3D9 || defined _XBOX | #if defined USE_D3D9 || defined _XBOX | ||||
| #else | #else | ||||
| # if GL_VERSION_1_1 || GL_ES_VERSION_2_0 | |||||
| glDeleteFramebuffers(1, &m_data->m_fbo); | glDeleteFramebuffers(1, &m_data->m_fbo); | ||||
| # else | |||||
| glDeleteFramebuffersOES(1, &m_data->m_fbo); | |||||
| # endif | |||||
| glDeleteTextures(1, &m_data->m_texture); | glDeleteTextures(1, &m_data->m_texture); | ||||
| # if GL_VERSION_1_1 | # if GL_VERSION_1_1 | ||||
| if (m_data->m_depth != GL_INVALID_ENUM) | if (m_data->m_depth != GL_INVALID_ENUM) | ||||
| @@ -134,7 +152,11 @@ void FrameBuffer::Bind() | |||||
| { | { | ||||
| #if defined USE_D3D9 || defined _XBOX | #if defined USE_D3D9 || defined _XBOX | ||||
| #else | #else | ||||
| # if GL_VERSION_1_1 || GL_ES_VERSION_2_0 | |||||
| glBindFramebuffer(GL_FRAMEBUFFER, m_data->m_fbo); | glBindFramebuffer(GL_FRAMEBUFFER, m_data->m_fbo); | ||||
| # else | |||||
| glBindFramebufferOES(GL_FRAMEBUFFER_OES, m_data->m_fbo); | |||||
| # endif | |||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -142,7 +164,11 @@ void FrameBuffer::Unbind() | |||||
| { | { | ||||
| #if defined USE_D3D9 || defined _XBOX | #if defined USE_D3D9 || defined _XBOX | ||||
| #else | #else | ||||
| # if GL_VERSION_1_1 || GL_ES_VERSION_2_0 | |||||
| glBindFramebuffer(GL_FRAMEBUFFER, NULL); | glBindFramebuffer(GL_FRAMEBUFFER, NULL); | ||||
| # else | |||||
| glBindFramebufferOES(GL_FRAMEBUFFER_OES, NULL); | |||||
| # endif | |||||
| #endif | #endif | ||||
| } | } | ||||