mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Fix crashes on OpenGL ES (thanks xenthral!)
--HG-- branch : minor
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user