case RENDERPATH_GL20:
case RENDERPATH_GLES2:
// fetch current fbo here (default fbo is not 0 on some GLES devices)
- qglGetIntegerv(GL_FRAMEBUFFER_BINDING, &gl_state.defaultframebufferobject);
+ CHECKGLERROR
+ qglGetIntegerv(GL_FRAMEBUFFER_BINDING, &gl_state.defaultframebufferobject);CHECKGLERROR
break;
}
}
{
case RENDERPATH_GL20:
case RENDERPATH_GLES2:
- qglFinish();
+ CHECKGLERROR
+ qglFinish();CHECKGLERROR
break;
}
}
// FIXME: LordHavoc: I think this can be done more efficiently somehow but I can't remember the technique
clipPlane[3] = -DotProduct(v4, clipPlane);
-#if 0
-{
- // testing code for comparing results
- float clipPlane2[4];
- VectorCopy4(clipPlane, clipPlane2);
- R_EntityMatrix(&identitymatrix);
- VectorSet(q, normal[0], normal[1], normal[2], -dist);
- qglClipPlane(GL_CLIP_PLANE0, q);
- qglGetClipPlane(GL_CLIP_PLANE0, q);
- VectorCopy4(q, clipPlane);
-}
-#endif
-
// Calculate the clip-space corner point opposite the clipping plane
// as (sgn(clipPlane.x), sgn(clipPlane.y), 1, 1) and
// transform it into camera space by multiplying it
{
case RENDERPATH_GL20:
case RENDERPATH_GLES2:
+ CHECKGLERROR
qglGenFramebuffers(1, (GLuint*)&temp);CHECKGLERROR
R_Mesh_SetRenderTargets(temp, NULL, NULL, NULL, NULL, NULL);
// GL_ARB_framebuffer_object (GL3-class hardware) - depth stencil attachment
{
Con_Printf("R_Mesh_CreateFramebufferObject: glCheckFramebufferStatus returned %i\n", status);
gl_state.framebufferobject = 0; // GL unbinds it for us
- qglDeleteFramebuffers(1, (GLuint*)&temp);
+ qglDeleteFramebuffers(1, (GLuint*)&temp);CHECKGLERROR
temp = 0;
}
return temp;
// GL clears the binding if we delete something bound
if (gl_state.framebufferobject == fbo)
gl_state.framebufferobject = 0;
- qglDeleteFramebuffers(1, (GLuint*)&fbo);
+ qglDeleteFramebuffers(1, (GLuint*)&fbo);CHECKGLERROR
}
break;
}
if (gl_state.framebufferobject != fbo)
{
gl_state.framebufferobject = fbo;
- qglBindFramebuffer(GL_FRAMEBUFFER, gl_state.framebufferobject ? gl_state.framebufferobject : gl_state.defaultframebufferobject);
+ qglBindFramebuffer(GL_FRAMEBUFFER, gl_state.framebufferobject ? gl_state.framebufferobject : gl_state.defaultframebufferobject);CHECKGLERROR
}
break;
}
case RENDERPATH_GL20:
case RENDERPATH_GLES2:
CHECKGLERROR
- qglActiveTexture(GL_TEXTURE0 + gl_state.unit);
- CHECKGLERROR
+ qglActiveTexture(GL_TEXTURE0 + gl_state.unit);CHECKGLERROR
break;
}
}
{
case RENDERPATH_GL20:
case RENDERPATH_GLES2:
+ CHECKGLERROR
#ifdef USE_GLES2
- qglDepthRangef(gl_state.depthrange[0], gl_state.depthrange[1]);
+ qglDepthRangef(gl_state.depthrange[0], gl_state.depthrange[1]);CHECKGLERROR
#else
- qglDepthRange(gl_state.depthrange[0], gl_state.depthrange[1]);
+ qglDepthRange(gl_state.depthrange[0], gl_state.depthrange[1]);CHECKGLERROR
#endif
break;
}
{
case RENDERPATH_GL20:
case RENDERPATH_GLES2:
- qglPolygonOffset(gl_state.polygonoffset[0], gl_state.polygonoffset[1]);
+ CHECKGLERROR
+ qglPolygonOffset(gl_state.polygonoffset[0], gl_state.polygonoffset[1]);CHECKGLERROR
break;
}
}
{
case RENDERPATH_GL20:
case RENDERPATH_GLES2:
+ CHECKGLERROR
qglCullFace(gl_state.cullface);CHECKGLERROR
break;
}
{
case RENDERPATH_GL20:
case RENDERPATH_GLES2:
- qglVertexAttrib4f(GLSLATTRIB_COLOR, cr, cg, cb, ca);
+ qglVertexAttrib4f(GLSLATTRIB_COLOR, cr, cg, cb, ca);CHECKGLERROR
break;
}
}
case RENDERPATH_GL20:
case RENDERPATH_GLES2:
CHECKGLERROR
- qglScissor(x, y,width,height);
- CHECKGLERROR
+ qglScissor(x, y,width,height);CHECKGLERROR
break;
}
}
if(vid.support.gl20shaders130)
qglBindFragDataLocation(programobject, 0, "dp_FragColor");
#endif
+ CHECKGLERROR
if (vertexstrings_count && !GL_Backend_CompileShader(programobject, GL_VERTEX_SHADER, "vertex", vertexstrings_count, vertexstrings_list))
goto cleanup;
case RENDERPATH_GLES2:
if (!buffer->bufferobject)
qglGenBuffers(1, (GLuint *)&buffer->bufferobject);
+ CHECKGLERROR
if (buffer->isuniformbuffer)
GL_BindUBO(buffer->bufferobject);
else if (buffer->isindexbuffer)
if (buffer->isuniformbuffer)
buffertype = GL_UNIFORM_BUFFER;
#endif
+ CHECKGLERROR
if (subdata)
qglBufferSubData(buffertype, offset, size, data);
else
qglBufferData(buffertype, size, data, buffer->isdynamic ? GL_STREAM_DRAW : GL_STATIC_DRAW);
+ CHECKGLERROR
}
if (buffer->isuniformbuffer)
GL_BindUBO(0);
gl_state.vertexbufferobject = 0;
if (gl_state.elementbufferobject == buffer->bufferobject)
gl_state.elementbufferobject = 0;
- qglDeleteBuffers(1, (GLuint *)&buffer->bufferobject);
+ CHECKGLERROR
+ qglDeleteBuffers(1, (GLuint *)&buffer->bufferobject);CHECKGLERROR
break;
}
Mem_ExpandableArray_FreeRecord(&gl_state.meshbufferarray, (void *)buffer);
void GL_BlendEquationSubtract(qboolean negated)
{
+ CHECKGLERROR
if(negated)
{
switch(vid.renderpath)
{
case RENDERPATH_GL20:
case RENDERPATH_GLES2:
- qglBlendEquationEXT(GL_FUNC_REVERSE_SUBTRACT);
+ qglBlendEquationEXT(GL_FUNC_REVERSE_SUBTRACT);CHECKGLERROR
break;
}
}
{
case RENDERPATH_GL20:
case RENDERPATH_GLES2:
- qglBlendEquationEXT(GL_FUNC_ADD);
+ qglBlendEquationEXT(GL_FUNC_ADD);CHECKGLERROR
break;
}
}
R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
r_refdef.stats[r_stat_bloom_drawpixels] += r_fb.bloomwidth * r_fb.bloomheight;
}
+ CHECKGLERROR
range = r_bloom_blur.integer * r_fb.bloomwidth / 320;
brighten = r_bloom_brighten.value;
// blend on at multiple vertical offsets to achieve a vertical blur
// TODO: do offset blends using GLSL
// TODO instead of changing the texcoords, change the target positions to prevent artifacts at edges
+ CHECKGLERROR
GL_BlendFunc(GL_ONE, GL_ZERO);
+ CHECKGLERROR
R_SetupShader_Generic(prev->colortexture[0], false, true, false);
+ CHECKGLERROR
for (x = -range;x <= range;x++)
{
if (!dir){xoffset = 0;yoffset = x;}
r *= (1 - x*x/(float)((range+1)*(range+1)));
if (r <= 0)
continue;
+ CHECKGLERROR
GL_Color(r, r, r, 1);
+ CHECKGLERROR
R_Mesh_PrepareVertices_Generic_Arrays(4, r_screenvertex3f, NULL, r_fb.offsettexcoord2f);
+ CHECKGLERROR
R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
r_refdef.stats[r_stat_bloom_drawpixels] += r_fb.bloomwidth * r_fb.bloomheight;
+ CHECKGLERROR
GL_BlendFunc(GL_ONE, GL_ONE);
+ CHECKGLERROR
}
}