Fix crashes on OpenGL ES (thanks xenthral!)

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2017-06-08 21:10:17 -03:00
parent e03c763215
commit 30a63b6642
4 changed files with 17 additions and 4 deletions
+2 -2
View File
@@ -68,7 +68,7 @@ static GLenum createFBO(GLuint &framebuffer, TextureType texType, PixelFormat fo
if (isPixelFormatDepthStencil(format))
{
glClearDepth(1.0);
gl.clearDepth(1.0);
glClearStencil(0);
glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
}
@@ -128,7 +128,7 @@ static bool createRenderbuffer(int width, int height, int &samples, PixelFormat
{
if (isPixelFormatDepthStencil(pixelformat))
{
glClearDepth(1.0);
gl.clearDepth(1.0);
glClearStencil(0);
glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
}
+2 -2
View File
@@ -728,7 +728,7 @@ void Graphics::clear(OptionalColorf c, OptionalInt stencil, OptionalDouble depth
if (depth.hasValue)
{
glClearDepth(depth.value);
gl.clearDepth(depth.value);
flags |= GL_DEPTH_BUFFER_BIT;
}
@@ -809,7 +809,7 @@ void Graphics::clear(const std::vector<OptionalColorf> &colors, OptionalInt sten
if (depth.hasValue)
{
glClearDepth(depth.value);
gl.clearDepth(depth.value);
flags |= GL_DEPTH_BUFFER_BIT;
}
+8
View File
@@ -710,6 +710,14 @@ void OpenGL::setVertexPointers(vertex::CommonFormat format, love::graphics::Buff
setVertexPointers(format, stride, offset);
}
void OpenGL::clearDepth(double value)
{
if (GLAD_ES_VERSION_2_0)
glClearDepthf((GLfloat) value);
else
glClearDepth(value);
}
void OpenGL::setViewport(const Rect &v)
{
glViewport(v.x, v.y, v.w, v.h);
+5
View File
@@ -224,6 +224,11 @@ public:
void setVertexPointers(vertex::CommonFormat format, love::graphics::Buffer *buffer, size_t offset);
void setVertexPointers(vertex::CommonFormat format, love::graphics::Buffer *buffer, size_t stride, size_t offset);
/**
* Wrapper for glClearDepth and glClearDepthf.
**/
void clearDepth(double value);
/**
* Sets the OpenGL rendering viewport to the specified rectangle.
* The y-coordinate starts at the top.