Fixing game not getting scaled correctly in fullscreen.

This commit is contained in:
Faerbit 2015-05-16 13:54:01 +02:00
parent a56907a956
commit 536ffc899e
3 changed files with 8 additions and 1 deletions

View File

@ -627,6 +627,10 @@ void Graphics::updateLights() {
glUniform1iv(lightingShader->getUniformLocation("isFlame"), sizeof(isFlame), (GLint*) isFlame); glUniform1iv(lightingShader->getUniformLocation("isFlame"), sizeof(isFlame), (GLint*) isFlame);
} }
void Graphics::saveWindowSize(glm::uvec2 windowSize) {
this->windowSize = windowSize;
}
void Graphics::resize(glm::uvec2 windowSize) { void Graphics::resize(glm::uvec2 windowSize) {
this->windowSize = windowSize; this->windowSize = windowSize;
if (gameStart) { if (gameStart) {

View File

@ -34,6 +34,7 @@ class Graphics {
bool getRenderDebug(); bool getRenderDebug();
bool getRenderWorld(); bool getRenderWorld();
void enqueueObjects(std::vector<std::vector<Object*>>* queue); void enqueueObjects(std::vector<std::vector<Object*>>* queue);
void saveWindowSize(glm::uvec2 windowSize);
private: private:
void bindTextureUnits(); void bindTextureUnits();
void updateLights(); void updateLights();

View File

@ -125,6 +125,7 @@ bool createWindow()
glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits); glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits);
glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits); glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits);
glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate); glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate);
app.getGraphics()->saveWindowSize(glm::uvec2(mode->width, mode->height));
window = glfwCreateWindow(mode->width, mode->height, "Saxum", glfwGetPrimaryMonitor(), NULL); window = glfwCreateWindow(mode->width, mode->height, "Saxum", glfwGetPrimaryMonitor(), NULL);
if (!window) { if (!window) {
@ -168,8 +169,9 @@ int main( int argc, char *argv[] )
// Enable vertical sync (on cards that support it) with parameter 1 - 0 means off // Enable vertical sync (on cards that support it) with parameter 1 - 0 means off
glfwSwapInterval( 0 ); glfwSwapInterval( 0 );
app.init(); app.init();
app.getGraphics()->resize(app.getGraphics()->getWindowSize());
glBindFramebuffer( GL_FRAMEBUFFER, 0 ); glBindFramebuffer( GL_FRAMEBUFFER, 0 );
glfwSwapBuffers(window); glfwSwapBuffers(window);
app.initLevel(); app.initLevel();