13 #include "../../gfx.h"
15 #if GFX_USE_GWIN && GWIN_NEED_GL3D
17 #if GDISP_PIXELFORMAT != GDISP_PIXELFORMAT_RGB565
18 #error "GWIN: GL3D only support GDISP_PIXELFORMAT_RGB565 color format (TinyGL limitation)"
21 #include "gwin_class.h"
23 #include "../../3rdparty/tinygl-0.4-ugfx/src/zgl.h"
28 static int gl3dResizeGLViewport(GLContext *c,
int *xsize_ptr,
int *ysize_ptr);
30 static const gwinVMT gl3dVMT = {
38 static gBool haveGLwindow = gFalse;
48 if (!(gl = (GGL3DObject *)_gwindowCreate(g, &gl->g, pInit, &gl3dVMT, 0)))
55 zb = ZB_open(gl->g.width, gl->g.height, ZB_MODE_5R6G5B, 0, NULL, NULL, NULL);
57 if ((gl->g.flags & GWIN_FLG_DYNAMIC))
64 gl->glcxt = glcxt = gl_get_context();
66 glcxt->gl_resize_viewport = gl3dResizeGLViewport;
69 glcxt->viewport.xsize=-1;
70 glcxt->viewport.ysize=-1;
72 glViewport(0, 0, gl->g.width, gl->g.height);
82 haveGLwindow = gFalse;
88 zb = ((GGL3DObject *)gh)->glcxt->zb;
92 static int gl3dResizeGLViewport(GLContext *c,
int *xsize_ptr,
int *ysize_ptr) {
102 if (cx <= 0 || cy <= 0)
111 ZB_resize(c->zb, NULL, cx, cy);
123 void tgl_warning(
const char *format, ...) { (void)format; }
124 void tgl_trace(
const char *format, ...) { (void)format; }
125 void tgl_fixme(
const char *format, ...) { (void)format; }
126 void gl_fatal_error(
char *format, ...) {
gfxHalt(format); }
127 void gl_assert(
int test) {
if (!test)
gfxHalt(
"TinyGL Assert"); }
129 void gl_free(
void *p) {
gfxFree(p); }
130 void *gl_malloc(
int size) {
return gfxAlloc(size); }
132 void *gl_zalloc(
int size) {
150 #include "../../3rdparty/tinygl-0.4-ugfx/src/api.c"
151 #include "../../3rdparty/tinygl-0.4-ugfx/src/list.c"
152 #include "../../3rdparty/tinygl-0.4-ugfx/src/vertex.c"
153 #include "../../3rdparty/tinygl-0.4-ugfx/src/init.c"
154 #include "../../3rdparty/tinygl-0.4-ugfx/src/matrix.c"
155 #include "../../3rdparty/tinygl-0.4-ugfx/src/texture.c"
156 #include "../../3rdparty/tinygl-0.4-ugfx/src/misc.c"
157 #include "../../3rdparty/tinygl-0.4-ugfx/src/clear.c"
158 #include "../../3rdparty/tinygl-0.4-ugfx/src/light.c"
159 #include "../../3rdparty/tinygl-0.4-ugfx/src/clip.c"
160 #include "../../3rdparty/tinygl-0.4-ugfx/src/select.c"
161 #include "../../3rdparty/tinygl-0.4-ugfx/src/get.c"
162 #include "../../3rdparty/tinygl-0.4-ugfx/src/zbuffer.c"
163 #include "../../3rdparty/tinygl-0.4-ugfx/src/zline.c"
164 #include "../../3rdparty/tinygl-0.4-ugfx/src/zdither.c"
165 #include "../../3rdparty/tinygl-0.4-ugfx/src/ztriangle.c"
166 #include "../../3rdparty/tinygl-0.4-ugfx/src/zmath.c"
167 #include "../../3rdparty/tinygl-0.4-ugfx/src/image_util.c"
168 #include "../../3rdparty/tinygl-0.4-ugfx/src/arrays.c"
169 #include "../../3rdparty/tinygl-0.4-ugfx/src/specbuf.c"
COLOR_TYPE gColor
The color type definition.
GHandle gwinGGL3DCreate(GDisplay *g, GGL3DObject *gg, const GWindowInit *pInit)
Create a gl3d window.
void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord srcx, gCoord srcy, gCoord srccx, const gPixel *buffer)
Fill an area using the supplied bitmap.
gColor gPixel
The pixel format.
void * gfxAlloc(gMemSize sz)
Allocate memory.
void gfxHalt(const char *msg)
Halt the GFX application due to an error.
void gfxFree(void *ptr)
Free memory.
void gwinSetVisible(GHandle gh, gBool visible)
Sets whether a window is visible or not.
The structure to initialise a GWIN.
A window object structure.
The Virtual Method Table for a GWIN window.