Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5200: Move context setup code to wxutil::GLContext. Remove widget re…
…gistration methods from OpenGLModule.
- Loading branch information
1 parent
564f6c3
commit 6311959
Showing
11 changed files
with
127 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#pragma once | ||
|
||
#include "igl.h" | ||
#include "imodule.h" | ||
|
||
namespace wxutil { class GLWidget; } | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#pragma once | ||
|
||
#include "igl.h" | ||
#include "itextstream.h" | ||
#include <wx/glcanvas.h> | ||
|
||
namespace wxutil | ||
{ | ||
|
||
// IGLContext implementation based on wxGLContext | ||
class GLContext : | ||
public gl::IGLContext | ||
{ | ||
private: | ||
wxGLContext* _context; | ||
|
||
public: | ||
GLContext(wxutil::GLWidget* hostWidget) : | ||
_context(new wxGLContext(hostWidget)) | ||
{ | ||
hostWidget->SetCurrent(*_context); | ||
|
||
// report OpenGL information | ||
rMessage() << "GL_VENDOR: " | ||
<< reinterpret_cast<const char*>(glGetString(GL_VENDOR)) << std::endl; | ||
rMessage() << "GL_RENDERER: " | ||
<< reinterpret_cast<const char*>(glGetString(GL_RENDERER)) << std::endl; | ||
rMessage() << "GL_VERSION: " | ||
<< reinterpret_cast<const char*>(glGetString(GL_VERSION)) << std::endl; | ||
rMessage() << "GL_EXTENSIONS: " | ||
<< reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)) << std::endl; | ||
|
||
GLenum err = glewInit(); | ||
|
||
if (err != GLEW_OK) | ||
{ | ||
// glewInit failed | ||
rError() << "GLEW error: " << | ||
reinterpret_cast<const char*>(glewGetErrorString(err)); | ||
} | ||
} | ||
|
||
~GLContext() | ||
{ | ||
delete _context; | ||
} | ||
|
||
wxGLContext& get() | ||
{ | ||
return *_context; | ||
} | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.