00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef QSDRVOPENGL_H
00020 #define QSDRVOPENGL_H
00021
00022 #ifdef HAVE_CONFIG_H
00023 #include <config.h>
00024 #endif
00025
00026 #ifdef HAVE_GL
00027
00028 #include "qsdrvqt.h"
00029 #include <qgl.h>
00030
00031 class QPainter;
00032 class QPixmap;
00033 class QPicture;
00034 class QSAxes3D;
00035 class QSProjection3D;
00036
00043 class QSDrvOpenGL : public QSDrvQt
00044 {
00045 public:
00049 QSDrvOpenGL();
00053 virtual ~QSDrvOpenGL();
00057 virtual QSDrvOpenGL *copy();
00061 void copySettingsFrom( const QSDrvOpenGL *drv );
00065 void setAlpha( bool enabled );
00069 void setShadeWalls( bool enabled );
00073 void setGlobalTransparency( unsigned char value );
00077 void setMeshAutoStroke( bool enabled );
00081 void setAutoStrokeLightness( int value );
00085 bool alpha() const { return m_alpha; }
00089 bool shadeWalls() const { return m_shade_walls; }
00093 int globalTransparency() const { return m_global_transparency; }
00097 bool meshAutoStroke() const { return m_auto_stroke; }
00101 int meshAutoStrokeLightness() const { return m_stroke_lightness; }
00105 void init( QSAxes3D *parent );
00109 QSAxes3D *parentAxes() const { return m_axes3; }
00110 virtual void setClipping( bool enabled );
00111 virtual void setCurrentElement( int category, int element );
00112 virtual CNormals cNormals() const;
00113 virtual CColors cColors() const;
00114 virtual COrdering cOrdering() const;
00120 virtual void setDC( QPainter *p, double dpi = 72, bool deletePainter = false );
00121 virtual void startDrawing();
00122 virtual void stopDrawing();
00123
00124 virtual void clearCanvas( const QSGFill& f, const QSPt2& pos, const QSPt2& size );
00125 virtual void drawPoly3( const QSPt3f pts[], int npoints,
00126 const QSPt3f *nor, const QSGFill *col, const bool *edges = NULL, int edgeAutoColor = 0 );
00127 virtual void drawLine3( const QSPt3f& begin, const QSPt3f& end, const QSPt3f norm[2] );
00128 virtual void setFill( const QSGFill &f );
00129 virtual void setLine( const QSGLine &l );
00130
00131 protected:
00132 QSAxes3D *m_axes3;
00133 QPainter *m_opaint;
00134 QGLContext *pgl;
00135 QPainter *ppic;
00136 QPixmap *pix;
00137 QPicture *pic;
00138 QPointArray *points;
00139
00140 GLuint plist;
00141 GLubyte color[4];
00142 GLubyte lcolor[4];
00143
00144 bool axis_mode;
00145 bool m_alpha;
00146 bool m_shade_walls;
00147 bool m_auto_stroke;
00148 bool dpaint;
00149 int m_global_transparency;
00150 int trv;
00151 int m_stroke_lightness;
00152 int pasize;
00153
00154 const QSProjection3D *t;
00155 void loadMatrix( const double m[4][4] );
00156 void get_qpainter_wmatrix( const QPainter *p, double m[4][4] );
00157 void glError();
00158 };
00159
00160 #endif // HAVE_GL
00161 #endif
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181