Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

gdkmm/gl/drawable.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 // Generated by gtkmmproc -- DO NOT MODIFY!
00003 #ifndef _GDKMM_GL_DRAWABLE_H
00004 #define _GDKMM_GL_DRAWABLE_H
00005 
00006 #include <glibmm.h>
00007 
00008 // -*- C++ -*-
00009 /* gdkglextmm - C++ Wrapper for GdkGLExt
00010  * Copyright (C) 2002-2003  Naofumi Yasufuku
00011  *
00012  * This library is free software; you can redistribute it and/or
00013  * modify it under the terms of the GNU Lesser General Public
00014  * License as published by the Free Software Foundation; either
00015  * version 2.1 of the License, or (at your option) any later version.
00016  *
00017  * This library is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020  * Lesser General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU Lesser General Public
00023  * License along with this library; if not, write to the Free Software
00024  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA.
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 /* DOXYGEN_SHOULD_SKIP_THIS */
00040 
00041 
00042 namespace Gdk
00043 {
00044 
00045 namespace GL
00046 { class Drawable_Class; } // namespace GL
00047 
00048 } // namespace Gdk
00049 namespace Gdk
00050 {
00051 namespace GL
00052 {
00053 
00054 class Context;
00055 
00056   /** @defgroup GLDrawables  GL Drawables
00057    */
00058 
00059   /** OpenGL rendering surface abstract class.
00060    *
00061    *
00062    */
00063 
00064 
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   // noncopyable
00081   Drawable(const Drawable&);
00082   Drawable& operator=(const Drawable&);
00083 
00084 protected:
00085   Drawable(); // you must derive from this class
00086   explicit Drawable(GdkGLDrawable* castitem);
00087 
00088 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
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 
00100   GdkGLDrawable*       gobj()       { return reinterpret_cast<GdkGLDrawable*>(gobject_); }
00101   const GdkGLDrawable* gobj() const { return reinterpret_cast<GdkGLDrawable*>(gobject_); }
00102 
00103 private:
00104 
00105 
00106 public:
00107 
00108   
00109   /** Attach an OpenGL rendering context to a @a gldrawable .
00110    * @param glcontext A Gdk::GLContext.
00111    * @return <tt>true</tt> if it is successful, <tt>false</tt> otherwise.
00112    */
00113   bool make_current(const Glib::RefPtr<Context>& glcontext);
00114 
00115   
00116   /** Returns whether the @a gldrawable  supports the double-buffered visual.
00117    * @return <tt>true</tt> if the double-buffered visual is supported,
00118    * <tt>false</tt> otherwise.
00119    */
00120   bool is_double_buffered() const;
00121 
00122   
00123   /** Exchange front and back buffers.
00124    */
00125   void swap_buffers();
00126 
00127   
00128   /** Complete OpenGL execution prior to subsequent GDK drawing calls.
00129    */
00130   void wait_gl();
00131 
00132   
00133   /** Complete GDK drawing execution prior to subsequent OpenGL calls.
00134    */
00135   void wait_gdk();
00136 
00137   
00138   /** Delimits the begining of the OpenGL execution.
00139    * The call makes the @a glcontext  current to the @a gldrawable , and
00140    * completes GDK drawing execution.
00141    * @param glcontext A Gdk::GLContext.
00142    * @return <tt>true</tt> if it is successful, <tt>false</tt> otherwise.
00143    */
00144   bool gl_begin(const Glib::RefPtr<Context>& glcontext);
00145 
00146   
00147   /** Delimits the end of the OpenGL execution.
00148    * The call completes OpenGL execution.
00149    */
00150   void gl_end();
00151 
00152   
00153   /** Gets Gdk::GLConfig with which the @a gldrawable  is configured.
00154    * @return The Gdk::GLConfig.
00155    */
00156   Glib::RefPtr<Config> get_gl_config();
00157   
00158   /** Gets Gdk::GLConfig with which the @a gldrawable  is configured.
00159    * @return The Gdk::GLConfig.
00160    */
00161   Glib::RefPtr<const Config> get_gl_config() const;
00162 
00163   
00164   /** Fills *width and *height with the size of GL drawable.
00165    * width or height can be <tt>0</tt> if you only want the other one.
00166    * @param width Location to store drawable's width, or <tt>0</tt>.
00167    * @param height Location to store drawable's height, or <tt>0</tt>.
00168    */
00169   void get_size(int& width, int& height);
00170 
00171   
00172   /** Returns the current Gdk::GLDrawable.
00173    * @return The current Gdk::GLDrawable or <tt>0</tt> if there is no current drawable.
00174    */
00175   static Glib::RefPtr<Drawable> get_current();
00176 
00177 public:
00178 
00179   
00180   /** Renders a cube.
00181    * The cube is centered at the modeling coordinates origin with sides of
00182    * length @a size .
00183    * @param solid <tt>true</tt> if the cube should be solid.
00184    * @param size Length of cube sides.
00185    */
00186   static void draw_cube(bool solid, double size);
00187 
00188   
00189   /** Renders a sphere centered at the modeling coordinates origin of
00190    * the specified @a radius . The sphere is subdivided around the Z axis into
00191    *  @a slices  and along the Z axis into @a stacks .
00192    * @param solid <tt>true</tt> if the sphere should be solid.
00193    * @param radius The radius of the sphere.
00194    * @param slices The number of subdivisions around the Z axis (similar to lines of
00195    * longitude).
00196    * @param stacks The number of subdivisions along the Z axis (similar to lines of
00197    * latitude).
00198    */
00199   static void draw_sphere(bool solid, double radius, int slices, int stacks);
00200 
00201   
00202   /** Renders a cone oriented along the Z axis.
00203    * The @a base  of the cone is placed at Z = 0, and the top at Z = @a height .
00204    * The cone is subdivided around the Z axis into @a slices , and along
00205    * the Z axis into @a stacks .
00206    * @param solid <tt>true</tt> if the cone should be solid.
00207    * @param base The radius of the base of the cone.
00208    * @param height The height of the cone.
00209    * @param slices The number of subdivisions around the Z axis.
00210    * @param stacks The number of subdivisions along the Z axis.
00211    */
00212   static void draw_cone(bool solid, double base, double height, int slices, int stacks);
00213 
00214   
00215   /** Renders a torus (doughnut) centered at the modeling coordinates
00216    * origin whose axis is aligned with the Z axis.
00217    * @param solid <tt>true</tt> if the torus should be solid.
00218    * @param inner_radius Inner radius of the torus.
00219    * @param outer_radius Outer radius of the torus.
00220    * @param nsides Number of sides for each radial section.
00221    * @param rings Number of radial divisions for the torus.
00222    */
00223   static void draw_torus(bool solid, double inner_radius, double outer_radius, int nsides, int rings);
00224 
00225   
00226   /** Renders a tetrahedron centered at the modeling coordinates
00227    * origin with a radius of the square root of 3.
00228    * @param solid <tt>true</tt> if the tetrahedron should be solid.
00229    */
00230   static void draw_tetrahedron(bool solid);
00231 
00232   
00233   /** Renders a octahedron centered at the modeling coordinates
00234    * origin with a radius of 1.0.
00235    * @param solid <tt>true</tt> if the octahedron should be solid.
00236    */
00237   static void draw_octahedron(bool solid);
00238 
00239   
00240   /** Renders a dodecahedron centered at the modeling coordinates
00241    * origin with a radius of the square root of 3.
00242    * @param solid <tt>true</tt> if the dodecahedron should be solid.
00243    */
00244   static void draw_dodecahedron(bool solid);
00245 
00246   
00247   /** Renders a icosahedron.
00248    * The icosahedron is centered at the modeling coordinates origin
00249    * and has a radius of 1.0.
00250    * @param solid <tt>true</tt> if the icosahedron should be solid.
00251    */
00252   static void draw_icosahedron(bool solid);
00253 
00254   
00255   /** Renders a teapot.
00256    * Both surface normals and texture coordinates for the teapot are generated.
00257    * The teapot is generated with OpenGL evaluators.
00258    * @param solid <tt>true</tt> if the teapot should be solid.
00259    * @param scale Relative size of the teapot.
00260    */
00261   static void draw_teapot(bool solid, double scale);
00262 
00263 
00264 public:
00265 
00266 public:
00267   //C++ methods used to invoke GTK+ virtual functions:
00268 
00269 protected:
00270   //GTK+ Virtual Functions (override these to change behaviour):
00271 
00272   //Default Signal Handlers::
00273 
00274 
00275 };
00276 
00277   /** @example shapes.h
00278    *
00279    * Geometric object rendering example.
00280    *
00281    */
00282 
00283   /** @example shapes.cc
00284    *
00285    * Geometric object rendering example.
00286    *
00287    */
00288 
00289 } // namespace GL
00290 } // namespace Gdk
00291 
00292 
00293 namespace Glib
00294 {
00295 
00296 /** @relates Gdk::GL::Drawable */
00297 Glib::RefPtr<Gdk::GL::Drawable> wrap(GdkGLDrawable* object, bool take_copy = false);
00298 
00299 } // namespace Glib
00300 
00301 #endif /* _GDKMM_GL_DRAWABLE_H */
00302 

Generated on Sat May 17 02:09:50 2003 for gtkglextmm by doxygen1.3