mirror of https://github.com/fltk/fltk
Replaced static initializer with Fl_OpenGL_Display_Device.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11008 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
884928f68c
commit
b86f2f735a
2
FL/Fl.H
2
FL/Fl.H
|
@ -146,7 +146,7 @@ public: // run time information about compile time configuration
|
|||
static bool cfg_gfx_gdi; ///< GDI redering available, usually on MSWindows systems
|
||||
static bool cfg_gfx_opengl; ///< OpenGL redering available, available on many platforms
|
||||
static bool cfg_gfx_cairo; ///< Cairo redering available, available on many platforms
|
||||
static bool cfg_gfx_directx;///< DirectX redering available, available on many platforms
|
||||
static bool cfg_gfx_directx;///< DirectX redering available, usually on MSWindows systems
|
||||
/** @} */
|
||||
/** \defgroup cfg_prn runtime printer driver configuration */
|
||||
/** @{ */
|
||||
|
|
|
@ -24,6 +24,30 @@
|
|||
|
||||
#include "Fl_Window.H"
|
||||
|
||||
|
||||
// ------ this should be in a separate file! -----------------------------------
|
||||
#ifdef FL_CFG_GFX_OPENGL
|
||||
|
||||
#include <FL/Fl_Device.h>
|
||||
|
||||
class Fl_OpenGL_Graphics_Driver;
|
||||
/**
|
||||
OpenGL Surface.
|
||||
This surface is needed as an interface between GL windows and the GL graphics driver.
|
||||
*/
|
||||
class FL_EXPORT Fl_OpenGL_Display_Device : public Fl_Surface_Device {
|
||||
public:
|
||||
static const char *class_id;
|
||||
const char *class_name() {return class_id;};
|
||||
Fl_OpenGL_Display_Device(Fl_OpenGL_Graphics_Driver *graphics_driver);
|
||||
static Fl_OpenGL_Display_Device *display_device();
|
||||
};
|
||||
|
||||
#endif
|
||||
// ------ end of separate file! ------------------------------------------------
|
||||
|
||||
|
||||
|
||||
#ifndef GLContext
|
||||
/**
|
||||
Opaque pointer type to hide system specific implementation.
|
||||
|
|
|
@ -151,7 +151,21 @@ public:
|
|||
|
||||
const char *Fl_OpenGL_Graphics_Driver::class_id = "Fl_OpenGL_Graphics_Driver";
|
||||
|
||||
Fl_OpenGL_Graphics_Driver fl_opengl_graphics_driver;
|
||||
Fl_OpenGL_Display_Device *Fl_OpenGL_Display_Device::display_device() {
|
||||
static Fl_OpenGL_Display_Device *display = new Fl_OpenGL_Display_Device(new Fl_OpenGL_Graphics_Driver());
|
||||
return display;
|
||||
};
|
||||
|
||||
|
||||
Fl_OpenGL_Display_Device::Fl_OpenGL_Display_Device(Fl_OpenGL_Graphics_Driver *graphics_driver)
|
||||
: Fl_Surface_Device(graphics_driver)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
const char *Fl_OpenGL_Display_Device::class_id = "Fl_OpenGL_Display_Device";
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
// ------ end of separate file! ------------------------------------------------
|
||||
|
@ -659,8 +673,8 @@ void Fl_Gl_Window::draw_overlay() {}
|
|||
*/
|
||||
void Fl_Gl_Window::draw() {
|
||||
#ifdef FL_CFG_GFX_OPENGL
|
||||
Fl_Graphics_Driver *prev_driver = fl_graphics_driver;
|
||||
fl_graphics_driver = &fl_opengl_graphics_driver;
|
||||
Fl_Surface_Device *prev_device = Fl_Surface_Device::surface();
|
||||
Fl_OpenGL_Display_Device::display_device()->set_current();
|
||||
glPushAttrib(GL_ENABLE_BIT);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glPushMatrix();
|
||||
|
@ -673,7 +687,7 @@ void Fl_Gl_Window::draw() {
|
|||
|
||||
glPopMatrix();
|
||||
glPushAttrib(GL_ENABLE_BIT);
|
||||
fl_graphics_driver = prev_driver;
|
||||
prev_device->set_current();
|
||||
#else
|
||||
Fl::fatal("Fl_Gl_Window::draw() *must* be overriden. Please refer to the documentation.");
|
||||
#endif
|
||||
|
|
|
@ -82,6 +82,7 @@ Fl_Image_Surface::~Fl_Image_Surface() {
|
|||
|
||||
/** Returns an image made of all drawings sent to the Fl_Image_Surface object.
|
||||
The returned object contains its own copy of the RGB data.
|
||||
The caller is responsible for deleting the image.
|
||||
*/
|
||||
Fl_RGB_Image* Fl_Image_Surface::image()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue