From b478440dda274961bfaf5bd44a5ccafe66b3cd44 Mon Sep 17 00:00:00 2001 From: havoc Date: Wed, 1 Aug 2012 05:30:31 +0000 Subject: [PATCH] fix some compile errors and warnings with USE_GLES2 git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11838 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=c339b8a90e42379439d1f9f9c3e4b9a0bd84c0d1 --- gl_backend.c | 9 +++++++++ glquake.h | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/gl_backend.c b/gl_backend.c index bb20a109..e5231070 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -1264,7 +1264,12 @@ int R_Mesh_CreateFramebufferObject(rtexture_t *depthtexture, rtexture_t *colorte qglGenFramebuffers(1, (GLuint*)&temp);CHECKGLERROR R_Mesh_SetRenderTargets(temp, NULL, NULL, NULL, NULL, NULL); // GL_ARB_framebuffer_object (GL3-class hardware) - depth stencil attachment +#ifdef USE_GLES2 + // FIXME: separate stencil attachment on GLES + if (depthtexture && depthtexture->texnum ) qglFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT , depthtexture->gltexturetypeenum , depthtexture->texnum , 0);CHECKGLERROR +#else if (depthtexture && depthtexture->texnum ) qglFramebufferTexture2D(GL_FRAMEBUFFER, depthtexture->glisdepthstencil ? GL_DEPTH_STENCIL_ATTACHMENT : GL_DEPTH_ATTACHMENT , depthtexture->gltexturetypeenum , depthtexture->texnum , 0);CHECKGLERROR +#endif if (depthtexture && depthtexture->renderbuffernum ) qglFramebufferRenderbuffer(GL_FRAMEBUFFER, depthtexture->glisdepthstencil ? GL_DEPTH_STENCIL_ATTACHMENT : GL_DEPTH_ATTACHMENT , GL_RENDERBUFFER, depthtexture->renderbuffernum );CHECKGLERROR if (colortexture && colortexture->texnum ) qglFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 , colortexture->gltexturetypeenum , colortexture->texnum , 0);CHECKGLERROR if (colortexture2 && colortexture2->texnum) qglFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1 , colortexture2->gltexturetypeenum, colortexture2->texnum, 0);CHECKGLERROR @@ -1275,6 +1280,7 @@ int R_Mesh_CreateFramebufferObject(rtexture_t *depthtexture, rtexture_t *colorte if (colortexture3 && colortexture3->renderbuffernum) qglFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2 , GL_RENDERBUFFER, colortexture3->renderbuffernum);CHECKGLERROR if (colortexture4 && colortexture4->renderbuffernum) qglFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT3 , GL_RENDERBUFFER, colortexture4->renderbuffernum);CHECKGLERROR +#ifndef USE_GLES2 if (colortexture4 && qglDrawBuffersARB) { qglDrawBuffersARB(4, drawbuffers);CHECKGLERROR @@ -1300,6 +1306,7 @@ int R_Mesh_CreateFramebufferObject(rtexture_t *depthtexture, rtexture_t *colorte qglDrawBuffer(GL_NONE);CHECKGLERROR qglReadBuffer(GL_NONE);CHECKGLERROR } +#endif status = qglCheckFramebufferStatus(GL_FRAMEBUFFER);CHECKGLERROR if (status != GL_FRAMEBUFFER_COMPLETE) { @@ -1327,6 +1334,7 @@ int R_Mesh_CreateFramebufferObject(rtexture_t *depthtexture, rtexture_t *colorte if (colortexture3 && colortexture3->renderbuffernum) qglFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2 , GL_RENDERBUFFER, colortexture3->renderbuffernum);CHECKGLERROR if (colortexture4 && colortexture4->renderbuffernum) qglFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT3 , GL_RENDERBUFFER, colortexture4->renderbuffernum);CHECKGLERROR +#ifndef USE_GLES2 if (colortexture4 && qglDrawBuffersARB) { qglDrawBuffersARB(4, drawbuffers);CHECKGLERROR @@ -1352,6 +1360,7 @@ int R_Mesh_CreateFramebufferObject(rtexture_t *depthtexture, rtexture_t *colorte qglDrawBuffer(GL_NONE);CHECKGLERROR qglReadBuffer(GL_NONE);CHECKGLERROR } +#endif status = qglCheckFramebufferStatus(GL_FRAMEBUFFER);CHECKGLERROR if (status != GL_FRAMEBUFFER_COMPLETE) { diff --git a/glquake.h b/glquake.h index 9686dc59..30b2512d 100644 --- a/glquake.h +++ b/glquake.h @@ -1056,7 +1056,11 @@ extern void (GLAPIENTRY *qglPointSize)(GLfloat size); #define DEBUGGL #ifdef DEBUGGL +#ifdef USE_GLES2 +#define CHECKGLERROR {if (gl_paranoid.integer){if (gl_printcheckerror.integer) Con_Printf("CHECKGLERROR at %s:%d\n", __FILE__, __LINE__);errornumber = glGetError();if (errornumber) GL_PrintError(errornumber, __FILE__, __LINE__);}} +#else #define CHECKGLERROR {if (gl_paranoid.integer){if (gl_printcheckerror.integer) Con_Printf("CHECKGLERROR at %s:%d\n", __FILE__, __LINE__);errornumber = qglGetError ? qglGetError() : 0;if (errornumber) GL_PrintError(errornumber, __FILE__, __LINE__);}} +#endif extern int errornumber; void GL_PrintError(int errornumber, const char *filename, int linenumber); #else -- 2.39.2