Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef GNASH_RENDER_HANDLER_OGL_H
00020 #define GNASH_RENDER_HANDLER_OGL_H
00021
00022
00023 #if defined(NOT_SGI_GL) || defined(__APPLE_CC__)
00024 # ifdef __APPLE_CC__
00025 # include <AGL/agl.h>
00026 # endif
00027 #include <vector>
00028 #include <OpenGL/gl.h>
00029 #include <OpenGL/glu.h>
00030 #include <OpenGL/glext.h>
00031 # if defined(__APPLE_CC__) && (__APPLE_CC__ >= 5465)
00032 # define GLUCALLBACKTYPE GLvoid (*)()
00033 # else
00034 # define GLUCALLBACKTYPE GLvoid (*)(...)
00035 # endif
00036 #else
00037 # define GLUCALLBACKTYPE void (*)()
00038 # include <GL/gl.h>
00039 # ifdef WIN32
00040 # define GL_CLAMP_TO_EDGE 0x812F
00041 # else
00042 # include <GL/glx.h>
00043 # ifdef OSMESA_TESTING
00044 # include <GL/osmesa.h>
00045 # endif // OSMESA_TESTING
00046 # endif
00047 # include <GL/glu.h>
00048 # ifndef APIENTRY
00049 # define APIENTRY
00050 # endif
00051 #endif
00052
00053 #include "Renderer.h"
00054 #include "Geometry.h"
00055 #include "CachedBitmap.h"
00056
00057 #include <map>
00058
00059
00060 namespace gnash {
00061
00062
00063
00064
00065 typedef std::vector<const Path*> PathRefs;
00066
00067
00068
00069 struct oglVertex {
00070 oglVertex(double x, double y, double z = 0.0)
00071 : _x(x), _y(y), _z(z)
00072 {
00073 }
00074
00075 oglVertex(const point& p)
00076 : _x(p.x), _y(p.y), _z(0.0)
00077 {
00078 }
00079
00080 GLdouble _x;
00081 GLdouble _y;
00082 GLdouble _z;
00083 };
00084
00085 typedef std::map<const Path*, std::vector<oglVertex> > PathPointMap;
00086
00087 class Tesselator
00088 {
00089 public:
00090 Tesselator();
00091 ~Tesselator();
00092
00093 void beginPolygon();
00094
00095 void feed(std::vector<oglVertex>& vertices);
00096
00097 void tesselate();
00098
00099 void beginContour();
00100 void endContour();
00101
00102 void rememberVertex(GLdouble* v);
00103
00104 static void
00105 error(GLenum error);
00106
00107 static void combine(GLdouble coords [3], void *vertex_data[4],
00108 GLfloat weight[4], void **outData, void* userdata);
00109
00110
00111
00112 private:
00113 std::vector<GLdouble*> _vertices;
00114 GLUtesselator* _tessobj;
00115 };
00116
00117 class WholeShape
00118 {
00119 public:
00120 void newPath(const Path& new_path)
00121 {
00122 PathRefs refs;
00123 refs.push_back(&new_path);
00124
00125 shape.push_back(refs);
00126 }
00127
00128 void addPath(const Path& add_path)
00129 {
00130 PathRefs& refs = shape.back();
00131 refs.push_back(&add_path);
00132 }
00133
00134 void addPathRefs(const PathRefs& pathrefs)
00135 {
00136
00137 PathRefs new_refs(pathrefs.begin(), pathrefs.end());
00138
00139 shape.push_back(new_refs);
00140 }
00141
00142
00143 const std::vector<PathRefs>& get() const
00144 {
00145 return shape;
00146 }
00147
00148 private:
00149 std::vector<PathRefs> shape;
00150
00151 };
00152
00153
00154
00155
00156 DSOEXPORT Renderer* create_Renderer_ogl(bool init = true);
00157
00158
00159
00160 }
00161
00162
00163 #endif
00164