1 // SuperTux 2 // Copyright (C) 2018 Ingo Ruhnke <grumbel@gmail.com> 3 // 4 // This program is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // This program is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with this program. If not, see <http://www.gnu.org/licenses/>. 16 17 #ifndef HEADER_SUPERTUX_VIDEO_GL_GL_CONTEXT_HPP 18 #define HEADER_SUPERTUX_VIDEO_GL_GL_CONTEXT_HPP 19 20 #include <stddef.h> 21 #include <string> 22 23 #include "video/gl.hpp" 24 25 class Color; 26 class GLTexture; 27 class Texture; 28 29 class GLContext 30 { 31 public: GLContext()32 GLContext() {} ~GLContext()33 virtual ~GLContext() {} 34 35 virtual std::string get_name() const = 0; 36 37 virtual void bind() = 0; 38 39 virtual void ortho(float width, float height, bool vflip) = 0; 40 41 virtual void blend_func(GLenum src, GLenum dst) = 0; 42 43 virtual void set_positions(const float* data, size_t size) = 0; 44 45 virtual void set_texcoords(const float* data, size_t size) = 0; 46 virtual void set_texcoord(float u, float v) = 0; 47 48 virtual void set_colors(const float* data, size_t size) = 0; 49 virtual void set_color(const Color& color) = 0; 50 51 virtual void bind_texture(const Texture& texture, const Texture* displacement_texture) = 0; 52 virtual void bind_no_texture() = 0; 53 54 virtual void draw_arrays(GLenum type, GLint first, GLsizei count) = 0; 55 56 virtual bool supports_framebuffer() const = 0; 57 58 private: 59 GLContext(const GLContext&) = delete; 60 GLContext& operator=(const GLContext&) = delete; 61 }; 62 63 #endif 64 65 /* EOF */ 66