Replace gl_xxx() function names by new member functions of the Fl_X class to avoid
collisions with user-defined symbols. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10548 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
f8ee30ef74
commit
5017171db8
8
FL/mac.H
8
FL/mac.H
@ -75,9 +75,11 @@ typedef CGContextRef Fl_Offscreen;
|
||||
#ifdef __OBJC__
|
||||
@class NSCursor;
|
||||
@class NSOpenGLPixelFormat;
|
||||
@class NSOpenGLContext;
|
||||
#else
|
||||
class NSCursor;
|
||||
class NSOpenGLPixelFormat;
|
||||
class NSOpenGLContext;
|
||||
#endif // __OBJC__
|
||||
|
||||
typedef CGContextRef Fl_Offscreen;
|
||||
@ -168,6 +170,12 @@ public:
|
||||
// Cocoa additions
|
||||
static int resolution_scaling_factor(Fl_Window*);
|
||||
static NSOpenGLPixelFormat *mode_to_NSOpenGLPixelFormat(int mode, const int*); // computes NSOpenGLPixelFormat from Gl window's mode
|
||||
static NSOpenGLContext* create_GLcontext_for_window(NSOpenGLPixelFormat *pixelformat, NSOpenGLContext *shared_ctx, Fl_Window *window);
|
||||
static void GLcontext_update(NSOpenGLContext*);
|
||||
static void GLcontext_flushbuffer(NSOpenGLContext*);
|
||||
static void GLcontext_release(NSOpenGLContext*);
|
||||
static void GLcontext_makecurrent(NSOpenGLContext*);
|
||||
static void GL_cleardrawable(void);
|
||||
void destroy(void);
|
||||
void map(void);
|
||||
void unmap(void);
|
||||
|
@ -27,14 +27,6 @@
|
||||
# include "flstring.h"
|
||||
# include <FL/fl_utf8.h>
|
||||
|
||||
# ifdef __APPLE__
|
||||
extern NSOpenGLContext* gl_create_context_for_window(NSOpenGLPixelFormat *pixelformat,
|
||||
NSOpenGLContext *shared_ctx, Fl_Window *window);
|
||||
extern void gl_context_release(NSOpenGLContext*);
|
||||
extern void gl_context_makecurrent(NSOpenGLContext*);
|
||||
extern void gl_cleardrawable(void);
|
||||
# endif
|
||||
|
||||
# ifdef WIN32
|
||||
void fl_save_dc(HWND, HDC);
|
||||
# endif
|
||||
@ -247,7 +239,7 @@ GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int lay
|
||||
GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer) {
|
||||
GLContext context, shared_ctx = 0;
|
||||
if (context_list && nContext) shared_ctx = context_list[0];
|
||||
context = gl_create_context_for_window(g->pixelformat, shared_ctx, window);
|
||||
context = Fl_X::create_GLcontext_for_window(g->pixelformat, shared_ctx, window);
|
||||
if (!context) return 0;
|
||||
add_context((GLContext)context);
|
||||
return (context);
|
||||
@ -268,7 +260,7 @@ void fl_set_gl_context(Fl_Window* w, GLContext context) {
|
||||
# elif defined(WIN32)
|
||||
wglMakeCurrent(Fl_X::i(w)->private_dc, context);
|
||||
# elif defined(__APPLE_QUARTZ__)
|
||||
gl_context_makecurrent(context);
|
||||
Fl_X::GLcontext_makecurrent(context);
|
||||
# else
|
||||
# error unsupported platform
|
||||
# endif
|
||||
@ -283,7 +275,7 @@ void fl_no_gl_context() {
|
||||
# elif defined(WIN32)
|
||||
wglMakeCurrent(0, 0);
|
||||
# elif defined(__APPLE_QUARTZ__)
|
||||
gl_cleardrawable();
|
||||
Fl_X::GL_cleardrawable();
|
||||
# else
|
||||
# error unsupported platform
|
||||
# endif
|
||||
@ -296,7 +288,7 @@ void fl_delete_gl_context(GLContext context) {
|
||||
# elif defined(WIN32)
|
||||
wglDeleteContext(context);
|
||||
# elif defined(__APPLE_QUARTZ__)
|
||||
gl_context_release(context);
|
||||
Fl_X::GLcontext_release(context);
|
||||
# else
|
||||
# error unsupported platform
|
||||
# endif
|
||||
|
@ -29,8 +29,6 @@ extern void gl_texture_reset();
|
||||
#include "Fl_Gl_Choice.H"
|
||||
#ifdef __APPLE__
|
||||
#include <FL/gl.h>
|
||||
extern void gl_context_update(NSOpenGLContext*);
|
||||
extern void gl_context_flushbuffer(NSOpenGLContext*);
|
||||
#endif
|
||||
#include <FL/Fl_Gl_Window.H>
|
||||
#include <stdlib.h>
|
||||
@ -191,7 +189,7 @@ void Fl_Gl_Window::make_current() {
|
||||
if (Fl_X::i(this)->changed_resolution()){
|
||||
Fl_X::i(this)->changed_resolution(false);
|
||||
invalidate();
|
||||
gl_context_update(context_);
|
||||
Fl_X::GLcontext_update(context_);
|
||||
}
|
||||
#endif
|
||||
if (!context_) {
|
||||
@ -406,7 +404,7 @@ void Fl_Gl_Window::flush() {
|
||||
|
||||
}
|
||||
#ifdef __APPLE__
|
||||
gl_context_flushbuffer(context_);
|
||||
Fl_X::GLcontext_flushbuffer(context_);
|
||||
#endif
|
||||
|
||||
if (overlay==this && SWAP_TYPE != SWAP) { // fake overlay in front buffer
|
||||
@ -436,7 +434,7 @@ void Fl_Gl_Window::resize(int X,int Y,int W,int H) {
|
||||
if (is_a_resize) valid(0);
|
||||
|
||||
#ifdef __APPLE__
|
||||
if (Fl_X::i(this)->in_windowDidResize()) gl_context_update(context_);
|
||||
if (Fl_X::i(this)->in_windowDidResize()) Fl_X::GLcontext_update(context_);
|
||||
#endif
|
||||
|
||||
#if ! ( defined(__APPLE__) || defined(WIN32) )
|
||||
|
@ -2724,7 +2724,7 @@ NSOpenGLPixelFormat* Fl_X::mode_to_NSOpenGLPixelFormat(int m, const int *alistp)
|
||||
return pixform;
|
||||
}
|
||||
|
||||
NSOpenGLContext* gl_create_context_for_window(NSOpenGLPixelFormat *pixelformat,
|
||||
NSOpenGLContext* Fl_X::create_GLcontext_for_window(NSOpenGLPixelFormat *pixelformat,
|
||||
NSOpenGLContext *shared_ctx, Fl_Window *window)
|
||||
{
|
||||
NSOpenGLContext *context = [[NSOpenGLContext alloc] initWithFormat:pixelformat shareContext:shared_ctx];
|
||||
@ -2732,27 +2732,27 @@ NSOpenGLContext* gl_create_context_for_window(NSOpenGLPixelFormat *pixelformat,
|
||||
return context;
|
||||
}
|
||||
|
||||
void gl_context_update(NSOpenGLContext* ctxt)
|
||||
void Fl_X::GLcontext_update(NSOpenGLContext* ctxt)
|
||||
{
|
||||
[ctxt update];
|
||||
}
|
||||
|
||||
void gl_context_flushbuffer(NSOpenGLContext* ctxt)
|
||||
void Fl_X::GLcontext_flushbuffer(NSOpenGLContext* ctxt)
|
||||
{
|
||||
[ctxt flushBuffer];
|
||||
}
|
||||
|
||||
void gl_context_release(NSOpenGLContext* ctxt)
|
||||
void Fl_X::GLcontext_release(NSOpenGLContext* ctxt)
|
||||
{
|
||||
[ctxt release];
|
||||
}
|
||||
|
||||
void gl_cleardrawable(void)
|
||||
void Fl_X::GL_cleardrawable(void)
|
||||
{
|
||||
[[NSOpenGLContext currentContext] clearDrawable];
|
||||
}
|
||||
|
||||
void gl_context_makecurrent(NSOpenGLContext* ctxt)
|
||||
void Fl_X::GLcontext_makecurrent(NSOpenGLContext* ctxt)
|
||||
{
|
||||
[ctxt makeCurrentContext];
|
||||
}
|
||||
|
@ -48,7 +48,6 @@ static Fl_Gl_Choice* gl_choice;
|
||||
|
||||
#ifdef __APPLE__
|
||||
static Fl_Gl_Choice* gl_choice;
|
||||
extern void gl_context_update(NSOpenGLContext*);
|
||||
#endif
|
||||
|
||||
Fl_Region XRectangleRegion(int x, int y, int w, int h); // in fl_rect.cxx
|
||||
@ -69,7 +68,7 @@ void gl_start() {
|
||||
}
|
||||
fl_set_gl_context(Fl_Window::current(), context);
|
||||
#ifdef __APPLE__
|
||||
gl_context_update(context); // supports window resizing
|
||||
Fl_X::GLcontext_update(context); // supports window resizing
|
||||
#elif !defined(WIN32)
|
||||
glXWaitX();
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user