Don't call GL functions in OpenGl3Renderer::GetIdent.
GetIdent is called from an UI event callback, at which point there might well not be an active GL context. Before this commit, that would return a NULL pointer and result in a crash.pull/513/head
parent
22525e6515
commit
0501f0c99e
|
@ -87,6 +87,9 @@ public:
|
||||||
Fill *fill;
|
Fill *fill;
|
||||||
std::weak_ptr<const Pixmap> texture;
|
std::weak_ptr<const Pixmap> texture;
|
||||||
} current;
|
} current;
|
||||||
|
const char *vendor = "<uninitialized>";
|
||||||
|
const char *renderer = "<uninitialized>";
|
||||||
|
const char *version = "<uninitialized>";
|
||||||
|
|
||||||
// List-initialize current to work around MSVC bug 746973.
|
// List-initialize current to work around MSVC bug 746973.
|
||||||
OpenGl3Renderer() :
|
OpenGl3Renderer() :
|
||||||
|
@ -440,6 +443,10 @@ void OpenGl3Renderer::Init() {
|
||||||
meshRenderer.Init();
|
meshRenderer.Init();
|
||||||
imeshRenderer.Init();
|
imeshRenderer.Init();
|
||||||
|
|
||||||
|
vendor = (const char *)glGetString(GL_VENDOR);
|
||||||
|
renderer = (const char *)glGetString(GL_RENDERER);
|
||||||
|
version = (const char *)glGetString(GL_VERSION);
|
||||||
|
|
||||||
#if !defined(HAVE_GLES) && !defined(__APPLE__)
|
#if !defined(HAVE_GLES) && !defined(__APPLE__)
|
||||||
GLuint array;
|
GLuint array;
|
||||||
glGenVertexArrays(1, &array);
|
glGenVertexArrays(1, &array);
|
||||||
|
@ -696,9 +703,9 @@ std::shared_ptr<Pixmap> OpenGl3Renderer::ReadFrame() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGl3Renderer::GetIdent(const char **vendor, const char **renderer, const char **version) {
|
void OpenGl3Renderer::GetIdent(const char **vendor, const char **renderer, const char **version) {
|
||||||
*vendor = (const char *)glGetString(GL_VENDOR);
|
*vendor = this->vendor;
|
||||||
*renderer = (const char *)glGetString(GL_RENDERER);
|
*renderer = this->renderer;
|
||||||
*version = (const char *)glGetString(GL_VERSION);
|
*version = this->version;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGl3Renderer::SetCamera(const Camera &c) {
|
void OpenGl3Renderer::SetCamera(const Camera &c) {
|
||||||
|
|
Loading…
Reference in New Issue