Fix an OpenGL initialization glitch.
Before this commit, the first time NewFrame() is called, the background color would not be filled, leading to interference with whatever the GUI toolkit decided to put there.pull/168/head
parent
5c34b3f6ef
commit
6931979b8e
|
@ -829,9 +829,9 @@ void GraphicsWindow::Paint() {
|
||||||
|
|
||||||
auto renderStartTime = std::chrono::high_resolution_clock::now();
|
auto renderStartTime = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
canvas->NewFrame();
|
|
||||||
canvas->SetCamera(camera);
|
|
||||||
canvas->SetLighting(lighting);
|
canvas->SetLighting(lighting);
|
||||||
|
canvas->SetCamera(camera);
|
||||||
|
canvas->NewFrame();
|
||||||
Draw(canvas.get());
|
Draw(canvas.get());
|
||||||
canvas->FlushFrame();
|
canvas->FlushFrame();
|
||||||
|
|
||||||
|
|
|
@ -433,6 +433,7 @@ void OpenGl2Renderer::Init() {
|
||||||
glGenVertexArrays(1, &array);
|
glGenVertexArrays(1, &array);
|
||||||
glBindVertexArray(array);
|
glBindVertexArray(array);
|
||||||
#endif
|
#endif
|
||||||
|
UpdateProjection();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGl2Renderer::DrawLine(const Vector &a, const Vector &b, hStroke hcs) {
|
void OpenGl2Renderer::DrawLine(const Vector &a, const Vector &b, hStroke hcs) {
|
||||||
|
@ -675,8 +676,10 @@ void OpenGl2Renderer::GetIdent(const char **vendor, const char **renderer, const
|
||||||
|
|
||||||
void OpenGl2Renderer::SetCamera(const Camera &c) {
|
void OpenGl2Renderer::SetCamera(const Camera &c) {
|
||||||
camera = c;
|
camera = c;
|
||||||
|
if(initialized) {
|
||||||
UpdateProjection();
|
UpdateProjection();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void OpenGl2Renderer::SetLighting(const Lighting &l) {
|
void OpenGl2Renderer::SetLighting(const Lighting &l) {
|
||||||
lighting = l;
|
lighting = l;
|
||||||
|
|
|
@ -870,9 +870,9 @@ void TextWindow::Paint() {
|
||||||
Lighting lighting = {};
|
Lighting lighting = {};
|
||||||
lighting.backgroundColor = RGBi(0, 0, 0);
|
lighting.backgroundColor = RGBi(0, 0, 0);
|
||||||
|
|
||||||
canvas->NewFrame();
|
|
||||||
canvas->SetCamera(camera);
|
|
||||||
canvas->SetLighting(lighting);
|
canvas->SetLighting(lighting);
|
||||||
|
canvas->SetCamera(camera);
|
||||||
|
canvas->NewFrame();
|
||||||
|
|
||||||
UiCanvas uiCanvas = {};
|
UiCanvas uiCanvas = {};
|
||||||
uiCanvas.canvas = canvas;
|
uiCanvas.canvas = canvas;
|
||||||
|
|
Loading…
Reference in New Issue