00001
00002
00003 #ifndef _GDKMM_GL_DRAWABLE_H
00004 #define _GDKMM_GL_DRAWABLE_H
00005
00006 #include <glibmm.h>
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include <glibmm/interface.h>
00028
00029 #include <gdkmm/gl/defs.h>
00030 #include <gdkmm/gl/config.h>
00031 #include <gdkmm/gl/context.h>
00032
00033 #include <GL/gl.h>
00034
00035
00036 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00037 typedef struct _GdkGLDrawable GdkGLDrawable;
00038 typedef struct _GdkGLDrawableClass GdkGLDrawableClass;
00039 #endif
00040
00041
00042 namespace Gdk
00043 {
00044
00045 namespace GL
00046 { class Drawable_Class; }
00047
00048 }
00049 namespace Gdk
00050 {
00051 namespace GL
00052 {
00053
00054 class Context;
00055
00065 class Drawable : public Glib::Interface
00066 {
00067
00068 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00069
00070 public:
00071 typedef Drawable CppObjectType;
00072 typedef Drawable_Class CppClassType;
00073 typedef GdkGLDrawable BaseObjectType;
00074 typedef GdkGLDrawableClass BaseClassType;
00075
00076 private:
00077 friend class Drawable_Class;
00078 static CppClassType drawable_class_;
00079
00080
00081 Drawable(const Drawable&);
00082 Drawable& operator=(const Drawable&);
00083
00084 protected:
00085 Drawable();
00086 explicit Drawable(GdkGLDrawable* castitem);
00087
00088 #endif
00089
00090 public:
00091 virtual ~Drawable();
00092
00093 static void add_interface(GType gtype_implementer);
00094
00095 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00096 static GType get_type() G_GNUC_CONST;
00097 static GType get_base_type() G_GNUC_CONST;
00098 #endif
00099
00101 GdkGLDrawable* gobj() { return reinterpret_cast<GdkGLDrawable*>(gobject_); }
00102
00104 const GdkGLDrawable* gobj() const { return reinterpret_cast<GdkGLDrawable*>(gobject_); }
00105
00106 private:
00107
00108
00109 public:
00110
00111
00116 bool make_current(const Glib::RefPtr<Context>& glcontext);
00117
00118
00123 bool is_double_buffered() const;
00124
00125
00128 void swap_buffers();
00129
00130
00133 void wait_gl();
00134
00135
00138 void wait_gdk();
00139
00140
00145 bool gl_begin(const Glib::RefPtr<Context>& glcontext);
00146
00147
00150 void gl_end();
00151
00152
00156 Glib::RefPtr<Config> get_gl_config();
00157
00161 Glib::RefPtr<const Config> get_gl_config() const;
00162
00163
00169 void get_size(int& width, int& height);
00170
00171
00175 static Glib::RefPtr<Drawable> get_current();
00176
00177 public:
00178
00179
00186 static void draw_cube(bool solid, double size);
00187
00188
00199 static void draw_sphere(bool solid, double radius, int slices, int stacks);
00200
00201
00212 static void draw_cone(bool solid, double base, double height, int slices, int stacks);
00213
00214
00223 static void draw_torus(bool solid, double inner_radius, double outer_radius, int nsides, int rings);
00224
00225
00230 static void draw_tetrahedron(bool solid);
00231
00232
00237 static void draw_octahedron(bool solid);
00238
00239
00244 static void draw_dodecahedron(bool solid);
00245
00246
00252 static void draw_icosahedron(bool solid);
00253
00254
00261 static void draw_teapot(bool solid, double scale);
00262
00263
00264 public:
00265
00266 public:
00267
00268
00269 protected:
00270
00271
00272
00273
00274
00275 };
00276
00289 }
00290 }
00291
00292
00293 namespace Glib
00294 {
00300 Glib::RefPtr<Gdk::GL::Drawable> wrap(GdkGLDrawable* object, bool take_copy = false);
00301
00302 }
00303
00304 #endif
00305