Minor pre-emptive fixes for GL3.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2017-01-05 22:33:10 -04:00
parent 656668b8c8
commit 8c204efafb
4 changed files with 47 additions and 4 deletions
+16 -2
View File
@@ -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;