glgsg: fix texture extraction of MRTs in OpenGL ES

Fixes #815
This commit is contained in:
rdb 2019-12-29 17:47:36 +01:00
parent 2d11f36c9e
commit fccffb4932
2 changed files with 27 additions and 3 deletions

View File

@ -2523,6 +2523,20 @@ reset() {
}
#endif
#if defined(OPENGLES) && !defined(OPENGLES_1)
if (is_at_least_gles_version(3, 0)) {
_glReadBuffer = (PFNGLREADBUFFERPROC)
get_extension_func("glReadBuffer");
} else if (has_extension("GL_NV_read_buffer")) {
_glReadBuffer = (PFNGLREADBUFFERPROC)
get_extension_func("glReadBufferNV");
} else {
_glReadBuffer = nullptr;
}
#endif
#ifndef OPENGLES_1
_max_color_targets = 1;
if (_glDrawBuffers != nullptr) {
@ -8868,7 +8882,7 @@ set_draw_buffer(int rbtype) {
*/
void CLP(GraphicsStateGuardian)::
set_read_buffer(int rbtype) {
#ifndef OPENGLES // Draw buffers not supported by OpenGL ES. (TODO!)
#ifndef OPENGLES_1 // Draw buffers not supported by OpenGL ES 1.
if (rbtype & (RenderBuffer::T_depth | RenderBuffer::T_stencil)) {
// Special case: don't have to call ReadBuffer for these.
return;
@ -8901,10 +8915,14 @@ set_read_buffer(int rbtype) {
}
++index;
}
#ifdef OPENGLES
_glReadBuffer(buffer);
#else
glReadBuffer(buffer);
#endif
} else {
#ifndef OPENGLES
switch (rbtype & RenderBuffer::T_color) {
case RenderBuffer::T_front:
glReadBuffer(GL_FRONT);
@ -8941,10 +8959,11 @@ set_read_buffer(int rbtype) {
default:
break;
}
#endif // OPENGLES
}
report_my_gl_errors();
#endif // OPENGLES
#endif // OPENGLES_1
}
/**

View File

@ -92,6 +92,7 @@ typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs);
typedef void (APIENTRYP PFNGLREADBUFFERPROC) (GLenum src);
typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value);
typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
@ -935,6 +936,10 @@ public:
PFNGLBLITFRAMEBUFFEREXTPROC _glBlitFramebuffer;
PFNGLDRAWBUFFERSPROC _glDrawBuffers;
#if defined(OPENGLES) && !defined(OPENGLES_1)
PFNGLREADBUFFERPROC _glReadBuffer;
#endif
#ifndef OPENGLES_1
PFNGLCLEARBUFFERFVPROC _glClearBufferfv;
PFNGLCLEARBUFFERIVPROC _glClearBufferiv;