diff --git a/GL/framebuffer.c b/GL/framebuffer.c index cd77798..9af7575 100644 --- a/GL/framebuffer.c +++ b/GL/framebuffer.c @@ -206,6 +206,13 @@ void APIENTRY glGenerateMipmapEXT(GLenum target) { TextureObject* tex = _glGetBoundTexture(); + if(tex->width != tex->height) { + fprintf(stderr, "[GL ERROR] Mipmaps cannot be supported on non-square textures\n"); + _glKosThrowError(GL_INVALID_OPERATION, __func__); + _glKosPrintError(); + return; + } + if(!tex || !tex->data || !tex->mipmapCount) { _glKosThrowError(GL_INVALID_OPERATION, __func__); _glKosPrintError(); diff --git a/GL/texture.c b/GL/texture.c index 62bc950..f3a1662 100644 --- a/GL/texture.c +++ b/GL/texture.c @@ -852,6 +852,11 @@ void APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalFormat, _glKosThrowError(GL_INVALID_VALUE, "glTexImage2D"); } + if(level > 0 && width != height) { + fprintf(stderr, "[GL ERROR] Mipmaps cannot be supported on non-square textures\n"); + _glKosThrowError(GL_INVALID_OPERATION, __func__); + } + if(border) { _glKosThrowError(GL_INVALID_VALUE, "glTexImage2D"); }