mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Minor pre-emptive fixes for GL3.
--HG-- branch : minor
This commit is contained in:
@@ -56,6 +56,7 @@ namespace opengl
|
||||
Graphics::Graphics()
|
||||
: quadIndices(nullptr)
|
||||
, windowHasStencil(false)
|
||||
, mainVAO(0)
|
||||
{
|
||||
gl = OpenGL();
|
||||
|
||||
@@ -224,9 +225,10 @@ bool Graphics::setMode(int width, int height, int pixelwidth, int pixelheight, b
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
// Auto-generated mipmaps should be the best quality possible
|
||||
glHint(GL_GENERATE_MIPMAP_HINT, GL_NICEST);
|
||||
if (!gl.isCoreProfile())
|
||||
glHint(GL_GENERATE_MIPMAP_HINT, GL_NICEST);
|
||||
|
||||
if (!GLAD_ES_VERSION_2_0)
|
||||
if (!GLAD_ES_VERSION_2_0 && !gl.isCoreProfile())
|
||||
{
|
||||
// Make sure antialiasing works when set elsewhere
|
||||
glEnable(GL_MULTISAMPLE);
|
||||
@@ -235,6 +237,12 @@ bool Graphics::setMode(int width, int height, int pixelwidth, int pixelheight, b
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
if (gl.isCoreProfile())
|
||||
{
|
||||
glGenVertexArrays(1, &mainVAO);
|
||||
glBindVertexArray(mainVAO);
|
||||
}
|
||||
|
||||
gl.setTextureUnit(0);
|
||||
|
||||
// Set pixel row alignment
|
||||
@@ -334,6 +342,12 @@ void Graphics::unSetMode()
|
||||
framebufferObjects.clear();
|
||||
stencilBuffers.clear();
|
||||
|
||||
if (mainVAO != 0)
|
||||
{
|
||||
glDeleteVertexArrays(1, &mainVAO);
|
||||
mainVAO = 0;
|
||||
}
|
||||
|
||||
gl.deInitContext();
|
||||
|
||||
created = false;
|
||||
|
||||
Reference in New Issue
Block a user