diff -Nru supertux-0.5.2/debian/changelog supertux-0.5.2/debian/changelog --- supertux-0.5.2/debian/changelog 2018-09-16 22:20:34.000000000 +0000 +++ supertux-0.5.2/debian/changelog 2018-09-18 03:37:38.000000000 +0000 @@ -1,8 +1,8 @@ -supertux (0.5.2-0~git201809162220+9~ubuntu16.04.1) xenial; urgency=low +supertux (0.5.2-0~git201809180337+9~ubuntu16.04.1) xenial; urgency=low * Auto build. - -- Launchpad Package Builder Sun, 16 Sep 2018 22:20:34 +0000 + -- Launchpad Package Builder Tue, 18 Sep 2018 03:37:38 +0000 supertux (0.5.2-0) UNRELEASED; urgency=low diff -Nru supertux-0.5.2/debian/git-build-recipe.manifest supertux-0.5.2/debian/git-build-recipe.manifest --- supertux-0.5.2/debian/git-build-recipe.manifest 2018-09-16 22:20:34.000000000 +0000 +++ supertux-0.5.2/debian/git-build-recipe.manifest 2018-09-18 03:37:38.000000000 +0000 @@ -1,5 +1,5 @@ -# git-build-recipe format 0.4 deb-version {debupstream}-0~git201809162220+9 -lp:~supertux-dev/supertux/+git/github-clone git-commit:cbc7d9c04f187543583c7166058b85e16f51f633 +# git-build-recipe format 0.4 deb-version {debupstream}-0~git201809180337+9 +lp:~supertux-dev/supertux/+git/github-clone git-commit:537c2357f4ae7b9acde20cc5270c8993b980265f nest-part packaging lp:~supertux-dev/supertux/+git/supertux-debian debian debian git-commit:b8cbfcef4de3ce6c28e5b8484109af49ca99479e nest physfs lp:~supertux-dev/supertux/+git/external-physfs external/physfs git-commit:bbaa39973d1e6a1d6638af9573996f765bd80fe2 nest sexp-cpp lp:~supertux-dev/supertux/+git/external-sexp-cpp external/sexp-cpp git-commit:472d896512f3637e820e9486c02de852ef8f678b diff -Nru supertux-0.5.2/.pc/.quilt_patches supertux-0.5.2/.pc/.quilt_patches --- supertux-0.5.2/.pc/.quilt_patches 2018-09-16 22:20:35.000000000 +0000 +++ supertux-0.5.2/.pc/.quilt_patches 2018-09-18 03:37:39.000000000 +0000 @@ -1 +1 @@ -/home/buildd/build-RECIPEBRANCHBUILD-1959290/chroot-autobuild/home/buildd/work/tree/recipe/debian/patches +/home/buildd/build-RECIPEBRANCHBUILD-1959609/chroot-autobuild/home/buildd/work/tree/recipe/debian/patches diff -Nru supertux-0.5.2/.pc/.quilt_series supertux-0.5.2/.pc/.quilt_series --- supertux-0.5.2/.pc/.quilt_series 2018-09-16 22:20:35.000000000 +0000 +++ supertux-0.5.2/.pc/.quilt_series 2018-09-18 03:37:39.000000000 +0000 @@ -1 +1 @@ -/home/buildd/build-RECIPEBRANCHBUILD-1959290/chroot-autobuild/home/buildd/work/tree/recipe/debian/patches/series +/home/buildd/build-RECIPEBRANCHBUILD-1959609/chroot-autobuild/home/buildd/work/tree/recipe/debian/patches/series diff -Nru supertux-0.5.2/src/video/gl/gl20_context.hpp supertux-0.5.2/src/video/gl/gl20_context.hpp --- supertux-0.5.2/src/video/gl/gl20_context.hpp 2018-09-16 22:20:21.000000000 +0000 +++ supertux-0.5.2/src/video/gl/gl20_context.hpp 2018-09-18 03:37:27.000000000 +0000 @@ -46,6 +46,8 @@ virtual void draw_arrays(GLenum type, GLint first, GLsizei count) override; + virtual bool supports_framebuffer() const override { return false; } + private: GL20Context(const GL20Context&) = delete; GL20Context& operator=(const GL20Context&) = delete; diff -Nru supertux-0.5.2/src/video/gl/gl33core_context.hpp supertux-0.5.2/src/video/gl/gl33core_context.hpp --- supertux-0.5.2/src/video/gl/gl33core_context.hpp 2018-09-16 22:20:21.000000000 +0000 +++ supertux-0.5.2/src/video/gl/gl33core_context.hpp 2018-09-18 03:37:27.000000000 +0000 @@ -50,6 +50,8 @@ virtual void bind_no_texture() override; virtual void draw_arrays(GLenum type, GLint first, GLsizei count) override; + virtual bool supports_framebuffer() const override { return true; } + GLProgram& get_program() const { return *m_program; } GLVertexArrays& get_vertex_arrays() const { return *m_vertex_arrays; } GLTexture& get_white_texture() const { return *m_white_texture; } diff -Nru supertux-0.5.2/src/video/gl/gl_context.hpp supertux-0.5.2/src/video/gl/gl_context.hpp --- supertux-0.5.2/src/video/gl/gl_context.hpp 2018-09-16 22:20:21.000000000 +0000 +++ supertux-0.5.2/src/video/gl/gl_context.hpp 2018-09-18 03:37:27.000000000 +0000 @@ -49,6 +49,8 @@ virtual void draw_arrays(GLenum type, GLint first, GLsizei count) = 0; + virtual bool supports_framebuffer() const = 0; + private: GLContext(const GLContext&) = delete; GLContext& operator=(const GLContext&) = delete; diff -Nru supertux-0.5.2/src/video/gl/gl_framebuffer.cpp supertux-0.5.2/src/video/gl/gl_framebuffer.cpp --- supertux-0.5.2/src/video/gl/gl_framebuffer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ supertux-0.5.2/src/video/gl/gl_framebuffer.cpp 2018-09-18 03:37:27.000000000 +0000 @@ -0,0 +1,42 @@ +// SuperTux +// Copyright (C) 2018 Ingo Ruhnke +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include "video/gl/gl_framebuffer.hpp" + +#include "video/glutil.hpp" +#include "video/gl/gl_texture.hpp" + +GLFramebuffer::GLFramebuffer(/*GLVideoSystem& video_system,*/ GLTexture& texture) : + //m_video_system(video_system), + m_handle(0) +{ + assert_gl(); + + glGenFramebuffers(1, &m_handle); + + glBindFramebuffer(GL_FRAMEBUFFER, m_handle); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture.get_handle(), 0); + glBindFramebuffer(GL_FRAMEBUFFER, 0); + + assert_gl(); +} + +GLFramebuffer::~GLFramebuffer() +{ + glDeleteFramebuffers(1, &m_handle); +} + +/* EOF */ diff -Nru supertux-0.5.2/src/video/gl/gl_framebuffer.hpp supertux-0.5.2/src/video/gl/gl_framebuffer.hpp --- supertux-0.5.2/src/video/gl/gl_framebuffer.hpp 1970-01-01 00:00:00.000000000 +0000 +++ supertux-0.5.2/src/video/gl/gl_framebuffer.hpp 2018-09-18 03:37:27.000000000 +0000 @@ -0,0 +1,47 @@ +// SuperTux +// Copyright (C) 2018 Ingo Ruhnke +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#ifndef HEADER_SUPERTUX_VIDEO_GL_GL_FRAMEBUFFER_HPP +#define HEADER_SUPERTUX_VIDEO_GL_GL_FRAMEBUFFER_HPP + +#include + +#include "video/gl.hpp" + +class GLTexture; +class GLVideoSystem; + +class GLFramebuffer +{ +private: +public: + GLFramebuffer(/*GLVideoSystem& video_system,*/ GLTexture& texture); + ~GLFramebuffer(); + + GLuint get_handle() const { return m_handle; } + +private: + //GLVideoSystem& m_video_system; + GLuint m_handle; + +private: + GLFramebuffer(const GLFramebuffer&) = delete; + GLFramebuffer& operator=(const GLFramebuffer&) = delete; +}; + +#endif + +/* EOF */ diff -Nru supertux-0.5.2/src/video/gl/gl_lightmap.cpp supertux-0.5.2/src/video/gl/gl_lightmap.cpp --- supertux-0.5.2/src/video/gl/gl_lightmap.cpp 2018-09-16 22:20:21.000000000 +0000 +++ supertux-0.5.2/src/video/gl/gl_lightmap.cpp 2018-09-18 03:37:27.000000000 +0000 @@ -17,9 +17,11 @@ #include "video/gl/gl_lightmap.hpp" #include "supertux/globals.hpp" +#include "util/log.hpp" #include "video/drawing_request.hpp" #include "video/gl.hpp" #include "video/gl/gl_context.hpp" +#include "video/gl/gl_framebuffer.hpp" #include "video/gl/gl_painter.hpp" #include "video/gl/gl_program.hpp" #include "video/gl/gl_texture.hpp" @@ -32,6 +34,7 @@ m_size(size), m_painter(m_video_system), m_lightmap(), + m_framebuffer(), m_lightmap_width(), m_lightmap_height() { @@ -55,6 +58,16 @@ m_lightmap.reset(new GLTexture(next_power_of_two(m_lightmap_width), next_power_of_two(m_lightmap_height))); + + if (m_video_system.get_context().supports_framebuffer()) + { + m_framebuffer = std::make_unique(*m_lightmap); + } + } + + if (m_framebuffer) + { + glBindFramebuffer(GL_FRAMEBUFFER, m_framebuffer->get_handle()); } glViewport(0, 0, m_lightmap_width, m_lightmap_height); @@ -68,13 +81,23 @@ GLLightmap::end_draw() { assert_gl(); - glBindTexture(GL_TEXTURE_2D, m_lightmap->get_handle()); - glCopyTexSubImage2D(GL_TEXTURE_2D, - 0, // level - 0, 0, // offset - 0, 0, // x, y - m_lightmap_width, - m_lightmap_height); + + if (m_framebuffer) + { + glBindFramebuffer(GL_FRAMEBUFFER, 0); + } + else + { + assert_gl(); + glBindTexture(GL_TEXTURE_2D, m_lightmap->get_handle()); + glCopyTexSubImage2D(GL_TEXTURE_2D, + 0, // level + 0, 0, // offset + 0, 0, // x, y + m_lightmap_width, + m_lightmap_height); + } + assert_gl(); } diff -Nru supertux-0.5.2/src/video/gl/gl_lightmap.hpp supertux-0.5.2/src/video/gl/gl_lightmap.hpp --- supertux-0.5.2/src/video/gl/gl_lightmap.hpp 2018-09-16 22:20:21.000000000 +0000 +++ supertux-0.5.2/src/video/gl/gl_lightmap.hpp 2018-09-18 03:37:27.000000000 +0000 @@ -23,6 +23,7 @@ #include "video/gl/gl_painter.hpp" #include "video/lightmap.hpp" +class GLFramebuffer; class GLTexture; class GLVideoSystem; class Rect; @@ -57,6 +58,7 @@ GLPainter m_painter; std::shared_ptr m_lightmap; + std::unique_ptr m_framebuffer; int m_lightmap_width; int m_lightmap_height;