mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Added support for creating OpenGL ES 2 and 3 contexts, and updated the OpenGL context creation code to be more robust in general.
If the LOVE_GRAPHICS_USE_OPENGLES environment variable is set, then love will try to create an OpenGL ES context before falling back to regular OpenGL. If it's not set (or set to 0), then the opposite happens except when love is run on backends that should always use OpenGL ES. --HG-- branch : minor
This commit is contained in:
@@ -49,7 +49,6 @@ Graphics::Graphics()
|
||||
, height(0)
|
||||
, created(false)
|
||||
, writingToStencil(false)
|
||||
, displayedMinReqWarning(false)
|
||||
{
|
||||
states.reserve(10);
|
||||
states.push_back(DisplayState());
|
||||
@@ -207,30 +206,8 @@ bool Graphics::setMode(int width, int height, bool &sRGB)
|
||||
this->width = width;
|
||||
this->height = height;
|
||||
|
||||
gl.initContext();
|
||||
|
||||
// Does the system meet LOVE's minimum requirements for graphics?
|
||||
if (!(GLAD_ES_VERSION_2_0 || (GLAD_VERSION_2_0 && Shader::isSupported() && Canvas::isSupported()))
|
||||
&& !displayedMinReqWarning)
|
||||
{
|
||||
love::window::Window::MessageBoxType type = love::window::Window::MESSAGEBOX_ERROR;
|
||||
|
||||
std::string title = "Minimum system requirements not met!";
|
||||
|
||||
std::string message;
|
||||
message += "Detected OpenGL version: ";
|
||||
message += (const char *) glGetString(GL_VERSION);
|
||||
message += "\nRequired OpenGL version: 2.1."; // -ish
|
||||
message += "\nThe program may crash or have graphical issues.";
|
||||
|
||||
::printf("%s\n%s\n", title.c_str(), message.c_str());
|
||||
currentWindow->showMessageBox(title, message, type, true);
|
||||
|
||||
// We should only show the message once, instead of after every setMode.
|
||||
displayedMinReqWarning = true;
|
||||
}
|
||||
|
||||
// Okay, setup OpenGL.
|
||||
gl.initContext();
|
||||
gl.setupContext();
|
||||
|
||||
created = true;
|
||||
|
||||
@@ -487,8 +487,6 @@ private:
|
||||
|
||||
static const size_t MAX_USER_STACK_DEPTH = 64;
|
||||
|
||||
bool displayedMinReqWarning;
|
||||
|
||||
}; // Graphics
|
||||
|
||||
} // opengl
|
||||
|
||||
Reference in New Issue
Block a user