automake upgrade
[gdash.git] / src / sdl / ogl.hpp
blob802b531554fb06d2f474a03324b8baa51d28eca1
1 /*
2 * Copyright (c) 2007-2013, Czirkos Zoltan http://code.google.com/p/gdash/
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
19 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
20 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 #ifndef NEWOGL_HPP_INCLUDED
25 #define NEWOGL_HPP_INCLUDED
27 #include <SDL_opengl.h>
29 #include <glib.h>
30 #include <string>
31 #include <vector>
32 #include "sdl/sdlabstractscreen.hpp"
34 class SDLNewOGLScreen: public SDLAbstractScreen {
35 private:
36 bool shader_support;
37 bool timed_flips;
38 double oglscaling;
40 GLuint glprogram;
41 std::vector<GLuint> shaders;
42 GLuint texture;
44 /// used when loading the xml
45 std::string shadertext;
46 static void start_element(GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer user_data, GError **error);
47 static void end_element(GMarkupParseContext *context, const gchar *element_name, gpointer user_data, GError **error);
48 static void text(GMarkupParseContext *context, const gchar *text, gsize text_len, gpointer user_data, GError **error);
50 void set_uniform_float(char const *name, GLfloat value);
51 void set_uniform_2float(char const *name, GLfloat value1, GLfloat value2);
52 void set_texture_bilinear(bool bilinear);
54 public:
55 SDLNewOGLScreen(PixbufFactory &pixbuf_factory);
56 virtual void set_properties(int scaling_factor_, GdScalingType scaling_type_, bool pal_emulation_);
57 virtual void set_title(char const *);
58 virtual void configure_size();
59 virtual void flip();
60 virtual bool has_timed_flips() const;
61 void uninit();
62 ~SDLNewOGLScreen();
63 virtual Pixmap *create_pixmap_from_pixbuf(Pixbuf const &pb, bool keep_alpha) const;
66 #endif