core/vgui/internals/vgui_accelerate.cxx
Go to the documentation of this file.
00001 // This is core/vgui/internals/vgui_accelerate.cxx
00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00003 #pragma implementation
00004 #endif
00005 //:
00006 // \file
00007 // \author David Capel
00008 // \date   01 Apr 2000
00009 // \brief  See vgui_accelerate.h for a description of this file.
00010 
00011 #ifdef HAS_MFC
00012 #include <vgui/impl/mfc/StdAfx.h>
00013 extern CDC *vgui_mfc_adaptor_global_dc;
00014 #endif
00015 
00016 #include "vgui_accelerate.h"
00017 
00018 #include <vgui/vgui_gl.h>
00019 
00020 bool vgui_accelerate::vgui_no_acceleration = false;
00021 bool vgui_accelerate::vgui_mfc_acceleration = false;
00022 bool vgui_accelerate::vgui_doublebuffer = true;
00023 
00024 static int accelerator_level = 0;
00025 static vgui_accelerate* vgui_accelerator = 0;
00026 vgui_accelerate* vgui_accelerate::instance()
00027 {
00028   if (!vgui_accelerator) vgui_accelerator = new vgui_accelerate;
00029   return vgui_accelerator;
00030 }
00031 
00032 void vgui_accelerate::register_accelerator(vgui_accelerate* p, int level)
00033 {
00034   if (level > accelerator_level) {
00035     delete vgui_accelerator;
00036     vgui_accelerator = p;
00037     accelerator_level = level;
00038   }
00039 }
00040 
00041 // Default implementations (return false to indicate that a non-accelerated path was used.)
00042 
00043 bool
00044 vgui_accelerate::vgui_glClear( GLbitfield mask )
00045 {
00046   glClear(mask);
00047   return false;
00048 }
00049 
00050 bool
00051 vgui_accelerate::vgui_glDrawPixels( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels )
00052 {
00053   glDrawPixels( width, height, format, type, pixels);
00054   return false;
00055 }
00056 
00057 // 32 bit RGBA seems to be acceptable/fast on most platforms.
00058 // - u97mb RGBA is not acceptable on Mesa(too slow) so we use GL_RGB instead
00059 bool
00060 vgui_accelerate::vgui_choose_cache_format( GLenum* format, GLenum* type)
00061 {
00062 #if VGUI_MESA
00063   (*format) = GL_RGB;
00064 #else
00065   (*format) = GL_RGBA;
00066 #endif
00067   (*type) = GL_UNSIGNED_BYTE;
00068   return false;
00069 }
00070 
00071 // These functions are used in X11/Mesa to speed up overlay emulation. They
00072 // return false to indicate to overlay_biscuit that a default emulation must be used.
00073 bool vgui_accelerate::vgui_copy_back_to_aux()
00074 {
00075   return false;
00076 }
00077 
00078 bool vgui_accelerate::vgui_copy_aux_to_back()
00079 {
00080   return false;
00081 }