6 #if !defined(AFX_DRAWGL_H__56DE0244_F36F_49DC_A5CD_79388C983A87__INCLUDED_)
7 #define AFX_DRAWGL_H__56DE0244_F36F_49DC_A5CD_79388C983A87__INCLUDED_
13 #ifdef POLYGONTESSELATOR
14 #include "Utility/PolygonTesselator.h"
24 #include <GLES2/gl2.h>
25 #include <GLES2/gl2ext.h>
32 typedef struct X11DisplayInfo {
42 #include <OpenGLES/ES2/gl.h>
43 #include <OpenGLES/ES2/glext.h>
50 #include <GLES2/gl2.h>
51 #include <GLES2/gl2ext.h>
83 eChoosePixelFmtFailed = EXC_DRAWGL,
84 eSetPixelFormatFailed = EXC_DRAWGL + 1,
85 eCreateContextFailed = EXC_DRAWGL + 2,
86 eMakeCurrentFailed = EXC_DRAWGL + 3
92 GLuint loadShader(GLenum type,
const char *source);
93 GLuint buildProgram(GLuint vertexShader, GLuint fragmentShader,
int index);
98 void drawVertexArray(GLenum mode, GLpointf *pPoints,
long count);
100 void setDisplay(
void *pDisplay,
void* pOther = 0);
106 unsigned char*
getBitmapAt(
int x,
int y,
int w,
int h);
109 void PanScreen(LPoint nOffset,
bool bDragging);
114 void setTransform(DRect *window, DRect *viewport, DRect* clientRect,
double rotation,
int originFlag);
153 long setFillStipple(
long flag,
unsigned long *stipple = NULL, CColor fore = CColor(0,0,0,255), CColor back = CColor(0,0,0,0));
169 double m_saveScalingFactor;
170 double m_scalingFactor;
172 double m_minVisibleText;
193 X11DisplayInfo* m_pDisplay;
197 GLXContext m_context;
204 #if defined(EMSCRIPTEN) || defined(ANDROID) || defined(OpenGLESv2)
205 # if defined(EMSCRIPTEN) || defined(ANDROID_GLES2) || defined(OpenGLESv2)
207 # define SOLID_SHADER 0
208 # define TEX_SHADER 1
210 # if defined(ANDROID_ALLNATIVE) || defined(OpenGLESv2) || defined(EMSCRIPTEN)
213 EGLDisplay m_eglDisplay;
214 EGLContext m_eglContext;
215 EGLSurface m_eglSurface;
221 GLuint m_textures[1];
222 GLfloat m_gl2Matrix[16];
223 GLfloat m_gl2Color[4];
229 #ifndef ANDROID_GLUTESSELATOR_VOIDP
230 #ifdef POLYGONTESSELATOR
233 GLUtesselator *m_tessObj;
239 bool m_workaround_GL_LINE_LOOP_bug;
241 long m_currentProgram;
243 GLfloat m_psRange[2];
244 GLfloat m_lwRange[2];
250 GLsizei m_mem_glWidth;
251 GLsizei m_mem_glHeight;
252 GLuint m_mem_framebuffer;
253 GLuint m_mem_colorRenderbuffer;
254 GLuint m_mem_depthRenderbuffer;
257 void checkGLError(
char*,
int,
char*);
260 int m_masterClipStatus;
261 DRect m_masterClipRect;
264 #if defined(ANDROID) && defined(WANT_C_API)
266 typedef struct c_CDrawGL c_CDrawGL;
268 inline CDrawGL* realCDrawGL(c_CDrawGL* p) {
return (
CDrawGL*)p; };
270 c_CDrawGL* new_CDrawGL() {
return (c_CDrawGL*)(
new CDrawGL()); };
272 void open_CDrawGL(c_CDrawGL* p) { realCDrawGL(p)->
open(); };
274 void bgColorFromObjects_CDrawBase(c_CDrawGL *p, c_CCgmObjects *pObj)
275 { ((CDrawBase*)p)->m_backgroundColor = ((CCgmObjects*)pObj)->m_backgroundColor; };
277 void clear_CDrawGL(c_CDrawGL* p) { realCDrawGL(p)->clear(); };
279 void flush_CDrawGL(c_CDrawGL* p) { realCDrawGL(p)->flush(); };
281 void close_CDrawGL(c_CDrawGL* p) { realCDrawGL(p)->close(); };
283 void delete_CDrawGL(c_CDrawGL* p) {
delete realCDrawGL(p); };
285 void setTransform_CDrawGL(c_CDrawGL *p, c_DRect *window, c_DRect *viewport, c_DRect *clientRect,
286 double rotation,
int originFlag)
287 { realCDrawGL(p)->setTransform((DRect*)window, (DRect*)viewport, (DRect*)clientRect,
288 rotation, originFlag); };
290 void setMinMarkerSize_CDrawGL(c_CDrawGL *p,
double s)
291 { realCDrawGL(p)->m_dMinMarkerSize = s; };
295 #endif // !defined(AFX_DRAWGL_H__56DE0244_F36F_49DC_A5CD_79388C983A87__INCLUDED_)
unsigned char * m_mem_pBitmap
pointer to allocated bitmap pointer returned to user - valid until close()
Definition: DrawGL.h:181
void eraseDCarea(DRect *rect)
draws a graphical path to the GL device
Definition: DrawGL.cpp:6120
void setTransform(DRect *window, DRect *viewport, DRect *clientRect, double rotation, int originFlag)
set VDC to device coordinates transform
Definition: DrawGL.cpp:1759
void flush()
fills the device with the background color
Definition: DrawGL.cpp:1944
void drawDCfill(CCgmBaseObj *pCgmBaseObj, DPoint *pCa, long cnt)
draws a filled object to the GL device
Definition: DrawGL.cpp:2117
void drawDCdots(CCgmBaseObj *pCgmBaseObj, DPoint *pCa, long cnt)
draws one or more dots to the GL device
Definition: DrawGL.cpp:2278
void unApplyClipping(CCgmBaseObj *)
remove current clipping – used internally
Definition: DrawGL.cpp:2668
unsigned char * getBitmap()
initializes GL memory drawing
Definition: DrawGL.cpp:1340
CCgmCellArray – CellArray element container class.
Definition: CgmObj.h:933
void SelectRectangle(LPoint downPt, LPoint currPt, bool bDraw)
returns a pointer to a memory bit at x,y of w,h
Definition: DrawGL.cpp:1396
void drawPoly(CCgmPoly *pCgmPoly)
draw text to the GL device
Definition: DrawGL.cpp:3438
long setLineAttr(CCgmBaseObj *pCgmBaseObj)
apply line attributes
Definition: DrawGL.cpp:5246
long setFillAttr(CCgmBaseObj *pCgmBaseObj, unsigned long rgb)
set the current line pattern via available OpenGL calls
Definition: DrawGL.cpp:5408
void setColor(CColor color)
set the current fill pattern via available OpenGL calls
Definition: DrawGL.cpp:6345
virtual ~CDrawGL()
standard constructor
Definition: DrawGL.cpp:559
void memoryOpen(long width, long height)
initializes GL screen drawing
Definition: DrawGL.cpp:1175
void setMinVisibleText(double minHeight)
set the current color via available OpenGL calls
Definition: DrawGL.h:160
void setDisplay(void *pDisplay, void *pOther=0)
select target device
Definition: DrawGL.cpp:583
CDrawBase – drawing base class from which all output specific draw classes are derived.
Definition: DrawBase.h:19
void setWorkaround_GL_LINE_LOOP_bug(bool bValue)
standard destructor
Definition: DrawGL.cpp:417
void drawCellArray(CCgmCellArray *pCCgmCellArray)
draw a polygon or polyline to the GL device
Definition: DrawGL.cpp:3773
void drawText(CCgmText *pCgmText)
close the GL device
Definition: DrawGL.cpp:2730
Path – graphical path data container class.
Definition: Path.h:17
bool applyClipping(CCgmBaseObj *, DRect *)
set minimum height at which text is rendered
Definition: DrawGL.cpp:2408
long setFillStipple(long flag, unsigned long *stipple=NULL, CColor fore=CColor(0, 0, 0, 255), CColor back=CColor(0, 0, 0, 0))
sets the current fill attributes according to the pCgmBaseObj attributes
Definition: DrawGL.cpp:5581
void drawFigure(CCgmFigure *pCgmFigure)
draw a cell array to the GL device
Definition: DrawGL.cpp:4722
CCgmPoly – Poly elements container class(Polyline, PolyBezier, Polygon, Disjoint Polyline) ...
Definition: CgmObj.h:883
void drawDCline(CCgmBaseObj *pCgmBaseObj, DPoint *pCa, long cnt, bool close)
draws a line to the GL device
Definition: DrawGL.cpp:1978
CCgmBaseObj – graphical element container base class.
Definition: CgmObj.h:121
long setLineStipple(long width, GLushort pattern)
sets the current line attributes according to the pCgmBaseObj attributes
Definition: DrawGL.cpp:5378
void drawPath(CCgmBaseObj *pCgmBaseObj, Path *pPath, bool fill)
draws a CGM figure to the GL device
Definition: DrawGL.cpp:5094
CCgmText – Text and RestrictedText elements container class.
Definition: CgmObj.h:794
void close()
forces completion of all GL drawing operations
Definition: DrawGL.cpp:2311
LRect m_selRect
pointer to allocated bitmap of selectRectangle area
Definition: DrawGL.h:177
void open()
open device for drawing
Definition: DrawGL.cpp:813
unsigned char * getBitmapAt(int x, int y, int w, int h)
returns a pointer to a memory bitmap
Definition: DrawGL.cpp:1367
void clear()
sets up the transformation between the window and viewport
Definition: DrawGL.cpp:1921
CCgmObjects – CGM Picture container.
Definition: CgmObjects.h:472
CDrawGL – OpenGL drawing class.
Definition: DrawGL.h:74