diff --git a/src/h/auto.in b/src/h/auto.in index 954d713c5..5a6aecfda 100644 --- a/src/h/auto.in +++ b/src/h/auto.in @@ -143,6 +143,7 @@ /* Define to 1 if you lib freetype */ #undef HAVE_LIBFREETYPE + /* Define to 1 if you lib ftgl */ #undef HAVE_LIBFTGL diff --git a/src/h/rproto.h b/src/h/rproto.h index d9c9cb0c2..a2d3de1b6 100644 --- a/src/h/rproto.h +++ b/src/h/rproto.h @@ -939,7 +939,6 @@ int checkOpenConsole( FILE *w, char *s ); /* * Windowing functions (platform-specific) */ - wcp gl_alc_context(wbp w); wdp gl_alc_display(char *s); wdp gl_alc_display_font(wdp wd); wsp gl_alc_winstate(); diff --git a/src/runtime/rmswin.ri b/src/runtime/rmswin.ri index 22449127a..43ce11499 100644 --- a/src/runtime/rmswin.ri +++ b/src/runtime/rmswin.ri @@ -314,17 +314,6 @@ FILE *wopen(char *name, struct b_list *lp, dptr attr, int n, int *err_index, int * some attributes of the display and window are used in the context */ -#ifdef GraphicsGL - if (is_gl) { - if ((wc = w->context = gl_alc_context(w)) == NULL) { - *err_index = -2; - free_binding(w); - set_errortext(145); - return NULL; - } - } - else -#endif /* GraphicsGL */ if ((wc = w->context = alc_context(w)) == NULL) { *err_index = -2; free_binding(w); diff --git a/src/runtime/ropengl2d.ri b/src/runtime/ropengl2d.ri index 7b97820b1..b49c345d9 100644 --- a/src/runtime/ropengl2d.ri +++ b/src/runtime/ropengl2d.ri @@ -1306,7 +1306,13 @@ int init_2dcanvas(wbp w) */ if (glIsEnabled(GL_STENCIL_TEST) == GL_FALSE) glEnable(GL_STENCIL_TEST); - setpattern2d(w, NULL); + + /* + * FIXME: setpattern2d() seems to casue issues with 3D windows + * Disbale for now + */ + if (!ws->is_3D) + setpattern2d(w, NULL); /* * Clipping @@ -1402,18 +1408,12 @@ int init_2dcontext(wcp wc) /* default fg is black */ SetColor(wc->glfg, 0, 0, 0, 65535, 0); sprintf(wc->glfg.name,"black"); -#ifdef XWindows - wc->glfg.c = wd->colors[0].c; - wd->colors[0].refcount++; -#endif /* XWindows */ + /* default bg is white */ SetColor(wc->glbg, 65535, 65535, 65535, 65535, 0); sprintf(wc->glbg.name,"white"); -#ifdef XWindows - wc->glbg.c = wd->colors[1].c; - wd->colors[1].refcount++; -#endif /* XWindows */ + wc->rgbmode = 2; wc->gamma = wd->gamma; @@ -1429,16 +1429,6 @@ int init_2dcontext(wcp wc) glprintf("fonts not allocated\n"); wc->font = NULL; wc->leading = 0; - wc->font = (wfp)alloc(sizeof (struct _wfont)); - wc->font->name = salloc("fixed"); - wc->font->font = CreateFont(16,0,0,0,FW_NORMAL,0,0,0, - ((MAXBYTESPERCHAR==1)?ANSI_CHARSET:DEFAULT_CHARSET), - OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS, - DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, - NULL); - - wc->font->charwidth = 8; /* looks like a bug */ - wc->leading = 16; } /* drawing */ @@ -7319,7 +7309,7 @@ wcp gl_clone_context(wbp w) wcp wc, rv; wc = w->context; - Protect(rv = gl_alc_context(w), return NULL); + Protect(rv = alc_context(w), return NULL); copy_2dcontext(rv, wc); copy_3dcontext(wc, rv); @@ -7495,28 +7485,6 @@ int gl_wputc(int ci, wbp w) *******************************************************/ - - -/* - * allocate a context. Can't be called until w has a display and window. - */ -wcp gl_alc_context(wbp w) - { - wcp wc; - - wc = alc_context(w); /* platform-specific init */ - if (!wc) return NULL; - - /* set defaults here */ - init_2dcontext(wc); - init_3dcontext(wc); - - return wc; - } - - - - /* * allocate a display on machine s */ diff --git a/src/runtime/rwindow.r b/src/runtime/rwindow.r index 3d9e3d4d7..7e280e947 100644 --- a/src/runtime/rwindow.r +++ b/src/runtime/rwindow.r @@ -5469,12 +5469,7 @@ char child_window_generic(wbp w, wbp wp, int child_window) ws = w->window; ws->display = wd; CLRTITLEBAR(ws); -#ifdef GraphicsGL - if (w->window->is_gl) { - Protect(w->context = gl_alc_context(w), { free_binding(w); return 0; }); - } - else -#endif /* GraphicsGL */ + Protect(w->context = alc_context(w), { free_binding(w); return 0; }); wc = w->context; diff --git a/src/runtime/rxrsc.ri b/src/runtime/rxrsc.ri index fa17b0347..5c6b98471 100644 --- a/src/runtime/rxrsc.ri +++ b/src/runtime/rxrsc.ri @@ -1209,25 +1209,38 @@ wcp alc_context(wbp w) wc->serial = ++context_serial; wc->display = wd; wd->refcount++; + wc->font = NULL; -#ifdef OpenGL2D - if (!w->window->is_gl) -#endif /* OpenGL2D */ +#ifdef GraphicsGL + if (w->window->is_gl) { + init_2dcontext(wc); + init_3dcontext(wc); + wc->glfg.c = wd->colors[0].c; + wd->colors[0].refcount++; + wc->glbg.c = wd->colors[1].c; + wd->colors[1].refcount++; + } else +#endif /* GraphicsGL */ { - wd->colors[0].refcount++; - wc->fg = 0; - wd->colors[1].refcount++; - wc->bg = 1; - wc->font = wd->fonts; - wc->leading = wd->fonts->height; - wc->drawop = GXcopy; - wc->rgbmode = 2; wc->gamma = wd->gamma; wc->clipx = wc->clipy = 0; wc->clipw = wc->cliph = -1; wc->linewidth = 1; + wc->drawop = GXcopy; + wc->fg = 0; + wc->bg = 1; + wc->rgbmode = 2; } + + + + /* Ensure we have fonts, even with GLand no FreeType, so alway fall back to the old ways */ + if (!wc->font) { + wc->font = wd->fonts; + wc->leading = wd->fonts->height; + } + GRFX_LINK(wc, wcntxts); return wc; } diff --git a/src/runtime/rxwin.ri b/src/runtime/rxwin.ri index ce3699c22..7bd4e6662 100644 --- a/src/runtime/rxwin.ri +++ b/src/runtime/rxwin.ri @@ -1262,16 +1262,6 @@ FILE *wopen(char *name, struct b_list *lp, dptr attr, int n, int *err_index, int * some attributes of the display and window are used in the context */ -#ifdef GraphicsGL - if (is_gl) { - if ((wc = w->context = gl_alc_context(w)) == NULL) { - *err_index = -2; - free_binding(w); - return NULL; - } - } - else -#endif /* GraphicsGL */ if ((wc = w->context = alc_context(w)) == NULL) { *err_index = -2; free_binding(w);