diff --git a/src/modules/graphics/Image.cpp b/src/modules/graphics/Image.cpp index 016194a49..7655ba8a5 100644 --- a/src/modules/graphics/Image.cpp +++ b/src/modules/graphics/Image.cpp @@ -94,7 +94,7 @@ void Image::init(PixelFormat fmt, int w, int h, const Settings &settings) if (getMipmapCount() > 1) filter.mipmap = defaultMipmapFilter; - + initQuad(); } diff --git a/src/modules/graphics/opengl/Canvas.cpp b/src/modules/graphics/opengl/Canvas.cpp index afd7593a4..34eab614c 100644 --- a/src/modules/graphics/opengl/Canvas.cpp +++ b/src/modules/graphics/opengl/Canvas.cpp @@ -186,8 +186,7 @@ bool Canvas::loadVolatile() // getMaxRenderbufferSamples will be 0 on systems that don't support // multisampled renderbuffers / don't export FBO multisample extensions. - actualSamples = getRequestedMSAA(); - actualSamples = std::min(actualSamples, gl.getMaxRenderbufferSamples()); + actualSamples = std::min(getRequestedMSAA(), gl.getMaxRenderbufferSamples()); actualSamples = std::max(actualSamples, 0); actualSamples = actualSamples == 1 ? 0 : actualSamples; diff --git a/src/modules/graphics/opengl/Mesh.cpp b/src/modules/graphics/opengl/Mesh.cpp index a80bc96c5..2fc564f4f 100644 --- a/src/modules/graphics/opengl/Mesh.cpp +++ b/src/modules/graphics/opengl/Mesh.cpp @@ -81,9 +81,22 @@ int Mesh::bindAttributeToShaderInput(int attributeindex, const std::string &inpu vbo->unmap(); gl.bindBuffer(BUFFER_VERTEX, (GLuint) vbo->getHandle()); + + GLenum datatype = 0; + switch (format.type) + { + case DATA_BYTE: + datatype = GL_UNSIGNED_BYTE; + break; + case DATA_FLOAT: + datatype = GL_FLOAT; + break; + default: + datatype = 0; + break; + } const void *gloffset = BUFFER_OFFSET(getAttributeOffset(attributeindex)); - GLenum datatype = getGLDataType(format.type); GLboolean normalized = (datatype == GL_UNSIGNED_BYTE); glVertexAttribPointer(attriblocation, format.components, datatype, normalized, (GLsizei) vertexStride, gloffset); @@ -98,8 +111,24 @@ void Mesh::drawInternal(int start, int count, int instancecount, bool useindexbu gl.useVertexAttribArrays(attribflags, instancedattribflags); gl.bindTextureToUnit(texture, 0, false); gl.prepareDraw(); - - GLenum gldrawmode = getGLDrawMode(drawMode); + + GLenum gldrawmode = GL_TRIANGLES; + switch (drawMode) + { + case DRAWMODE_FAN: + gldrawmode = GL_TRIANGLE_FAN; + break; + case DRAWMODE_STRIP: + gldrawmode = GL_TRIANGLE_STRIP; + break; + case DRAWMODE_TRIANGLES: + default: + gldrawmode = GL_TRIANGLES; + break; + case DRAWMODE_POINTS: + gldrawmode = GL_POINTS; + break; + } if (useindexbuffer) { @@ -116,35 +145,6 @@ void Mesh::drawInternal(int start, int count, int instancecount, bool useindexbu } } -GLenum Mesh::getGLDrawMode(DrawMode mode) -{ - switch (mode) - { - case DRAWMODE_FAN: - return GL_TRIANGLE_FAN; - case DRAWMODE_STRIP: - return GL_TRIANGLE_STRIP; - case DRAWMODE_TRIANGLES: - default: - return GL_TRIANGLES; - case DRAWMODE_POINTS: - return GL_POINTS; - } -} - -GLenum Mesh::getGLDataType(DataType type) -{ - switch (type) - { - case DATA_BYTE: - return GL_UNSIGNED_BYTE; - case DATA_FLOAT: - return GL_FLOAT; - default: - return 0; - } -} - } // opengl } // graphics } // love diff --git a/src/modules/graphics/opengl/Mesh.h b/src/modules/graphics/opengl/Mesh.h index ec1395193..018e1a4ca 100644 --- a/src/modules/graphics/opengl/Mesh.h +++ b/src/modules/graphics/opengl/Mesh.h @@ -49,11 +49,6 @@ protected: void drawInternal(int start, int count, int instancecount, bool useindexbuffer, uint32 attribflags, uint32 instancedattribflags) const override; -private: - - static GLenum getGLDrawMode(DrawMode mode); - static GLenum getGLDataType(DataType type); - }; // Mesh } // opengl