diff --git a/src/Platform/AbstractXApplication.cpp b/src/Platform/AbstractXApplication.cpp index 5b7b8bc35..591b72dfe 100644 --- a/src/Platform/AbstractXApplication.cpp +++ b/src/Platform/AbstractXApplication.cpp @@ -113,9 +113,6 @@ int AbstractXApplication::exec() { /* Show window */ XMapWindow(display, window); - /* Call viewportEvent for the first time */ - viewportEvent(viewportSize); - while(!(flags & Flag::Exit)) { XEvent event; diff --git a/src/Platform/GlutApplication.h b/src/Platform/GlutApplication.h index 228e05332..67169128c 100644 --- a/src/Platform/GlutApplication.h +++ b/src/Platform/GlutApplication.h @@ -144,6 +144,11 @@ class GlutApplication { * Called when window size changes. You should pass the new size to * DefaultFramebuffer::setViewport() and possibly elsewhere (cameras, * other framebuffers...). + * + * Note that this function might not get called at all if the window + * size doesn't change. You are responsible for configuring the initial + * state yourself, viewport of default framebuffer can be retrieved + * from @ref DefaultFramebuffer::viewport(). */ virtual void viewportEvent(const Vector2i& size) = 0; diff --git a/src/Platform/NaClApplication.cpp b/src/Platform/NaClApplication.cpp index dbbdaf0a2..c3a56a45e 100644 --- a/src/Platform/NaClApplication.cpp +++ b/src/Platform/NaClApplication.cpp @@ -109,9 +109,6 @@ bool NaClApplication::tryCreateContext(const Configuration& configuration) { RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE|PP_INPUTEVENT_CLASS_WHEEL); RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD); - /* Make sure viewportEvent() is called for first time */ - flags |= Flag::ViewportUpdated; - c = new Context; return true; } @@ -164,14 +161,7 @@ void NaClApplication::DidChangeView(const pp::View& view) { /* Canvas resized */ if(viewportSize != size) { graphics->ResizeBuffers(size.x(), size.y()); - viewportSize = size; - flags |= Flag::ViewportUpdated; - } - - /* Update viewport, if changed */ - if(flags & Flag::ViewportUpdated) { - flags &= ~Flag::ViewportUpdated; - viewportEvent(size); + viewportEvent(viewportSize = size); } drawEvent(); diff --git a/src/Platform/NaClApplication.h b/src/Platform/NaClApplication.h index 53d76ab07..d1de44e8c 100644 --- a/src/Platform/NaClApplication.h +++ b/src/Platform/NaClApplication.h @@ -261,12 +261,11 @@ class NaClApplication: public pp::Instance, public pp::Graphics3DClient, public struct ConsoleDebugOutput; enum class Flag: UnsignedByte { - ViewportUpdated = 1 << 0, - SwapInProgress = 1 << 1, - Redraw = 1 << 2, - FullscreenSwitchInProgress = 1 << 3, - WillBeFullscreen = 1 << 4, - MouseLocked = 1 << 5 + SwapInProgress = 1 << 0, + Redraw = 1 << 1, + FullscreenSwitchInProgress = 1 << 2, + WillBeFullscreen = 1 << 3, + MouseLocked = 1 << 4 }; typedef Containers::EnumSet Flags;