Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics
[Home] [Tutorials] [All Classes] [Grouped Classes]

X:/dropbox/visualizationlibrary/src/vlGraphics/OpenGL.hpp

Go to the documentation of this file.
00001 /**************************************************************************************/
00002 /*                                                                                    */
00003 /*  Visualization Library                                                             */
00004 /*  http://www.visualizationlibrary.org                                               */
00005 /*                                                                                    */
00006 /*  Copyright (c) 2005-2011, Michele Bosi                                             */
00007 /*  All rights reserved.                                                              */
00008 /*                                                                                    */
00009 /*  Redistribution and use in source and binary forms, with or without modification,  */
00010 /*  are permitted provided that the following conditions are met:                     */
00011 /*                                                                                    */
00012 /*  - Redistributions of source code must retain the above copyright notice, this     */
00013 /*  list of conditions and the following disclaimer.                                  */
00014 /*                                                                                    */
00015 /*  - Redistributions in binary form must reproduce the above copyright notice, this  */
00016 /*  list of conditions and the following disclaimer in the documentation and/or       */
00017 /*  other materials provided with the distribution.                                   */
00018 /*                                                                                    */
00019 /*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND   */
00020 /*  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED     */
00021 /*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE            */
00022 /*  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR  */
00023 /*  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    */
00024 /*  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;      */
00025 /*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON    */
00026 /*  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT           */
00027 /*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS     */
00028 /*  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                      */
00029 /*                                                                                    */
00030 /**************************************************************************************/
00031 
00032 #ifndef OpenGL_INCLUDE_ONCE
00033 #define OpenGL_INCLUDE_ONCE
00034 
00035 #include <vlCore/OpenGLDefs.hpp>
00036 #include <vlGraphics/link_config.hpp>
00037 #include <vlCore/Log.hpp>
00038 
00039 namespace vl
00040 {
00042   VLGRAPHICS_EXPORT extern bool Is_OpenGL_Initialized;
00043 
00048   VLGRAPHICS_EXPORT extern bool Is_OpenGL_Core_Profile;
00049 
00054   VLGRAPHICS_EXPORT extern bool Is_OpenGL_Forward_Compatible;
00055 
00059   VLGRAPHICS_EXPORT extern bool Has_Fixed_Function_Pipeline;
00060 
00061   VLGRAPHICS_EXPORT extern const GLenum Translate_Enable[];
00062   VLGRAPHICS_EXPORT extern bool Is_Enable_Supported[];
00063   VLGRAPHICS_EXPORT extern const char* Translate_Enable_String[];
00064 
00065   VLGRAPHICS_EXPORT extern bool Has_GLES_Version_1_1;
00066   VLGRAPHICS_EXPORT extern bool Has_GLES_Version_2_0;
00067   VLGRAPHICS_EXPORT extern bool Has_GLES;
00068 
00069   VLGRAPHICS_EXPORT extern bool Has_GL_Version_1_1;
00070   VLGRAPHICS_EXPORT extern bool Has_GL_Version_1_2;
00071   VLGRAPHICS_EXPORT extern bool Has_GL_Version_1_3;
00072   VLGRAPHICS_EXPORT extern bool Has_GL_Version_1_4;
00073   VLGRAPHICS_EXPORT extern bool Has_GL_Version_1_5;
00074   VLGRAPHICS_EXPORT extern bool Has_GL_Version_2_0;
00075   VLGRAPHICS_EXPORT extern bool Has_GL_Version_2_1;
00076   VLGRAPHICS_EXPORT extern bool Has_GL_Version_3_0;
00077   VLGRAPHICS_EXPORT extern bool Has_GL_Version_3_1;
00078   VLGRAPHICS_EXPORT extern bool Has_GL_Version_3_2;
00079   VLGRAPHICS_EXPORT extern bool Has_GL_Version_3_3;
00080   VLGRAPHICS_EXPORT extern bool Has_GL_Version_4_0;
00081   VLGRAPHICS_EXPORT extern bool Has_GL_Version_4_1;
00082 
00083   // Helper variables
00084 
00085   VLGRAPHICS_EXPORT extern bool Has_GLSL;
00086   VLGRAPHICS_EXPORT extern bool Has_GLSL_120_Or_More;
00087   VLGRAPHICS_EXPORT extern bool Has_GLSL_130_Or_More;
00088   VLGRAPHICS_EXPORT extern bool Has_GLSL_140_Or_More;
00089   VLGRAPHICS_EXPORT extern bool Has_GLSL_150_Or_More;
00090   VLGRAPHICS_EXPORT extern bool Has_GLSL_330_Or_More;
00091   VLGRAPHICS_EXPORT extern bool Has_GLSL_400_Or_More;
00092   VLGRAPHICS_EXPORT extern bool Has_GLSL_410_Or_More;
00093   VLGRAPHICS_EXPORT extern bool Has_Geometry_Shader;
00094   VLGRAPHICS_EXPORT extern bool Has_BufferObject;
00095   VLGRAPHICS_EXPORT extern bool Has_FBO;
00096   VLGRAPHICS_EXPORT extern bool Has_PBO;
00097   VLGRAPHICS_EXPORT extern bool Has_FBO_Multisample;
00098   VLGRAPHICS_EXPORT extern bool Has_Cubemap_Textures;
00099   VLGRAPHICS_EXPORT extern bool Has_Texture_Rectangle;
00100   VLGRAPHICS_EXPORT extern bool Has_Texture_Array;
00101   VLGRAPHICS_EXPORT extern bool Has_Texture_Buffer;
00102   VLGRAPHICS_EXPORT extern bool Has_Texture_Multisample;
00103   VLGRAPHICS_EXPORT extern bool Has_Texture_3D;
00104   VLGRAPHICS_EXPORT extern bool Has_Multitexture;
00105   VLGRAPHICS_EXPORT extern bool Has_Primitive_Restart;
00106   VLGRAPHICS_EXPORT extern bool Has_Occlusion_Query;
00107   VLGRAPHICS_EXPORT extern bool Has_Transform_Feedback;
00108   VLGRAPHICS_EXPORT extern bool Has_glGenerateMipmaps;
00109   VLGRAPHICS_EXPORT extern bool Has_GL_GENERATE_MIPMAP;
00110   VLGRAPHICS_EXPORT extern bool Has_Point_Sprite;
00111   VLGRAPHICS_EXPORT extern bool Has_Base_Vertex;
00112   VLGRAPHICS_EXPORT extern bool Has_Primitive_Instancing;
00113 
00114   #define VL_EXTENSION(extension) VLGRAPHICS_EXPORT extern bool Has_##extension;
00115   #include <vlGraphics/GL/GLExtensionList.hpp>
00116   #undef VL_EXTENSION
00117 
00118   #define VL_GLES_EXTENSION(extension) VLGRAPHICS_EXPORT extern bool Has_##extension;
00119   #include <vlGraphics/GL/GLESExtensionList.hpp>
00120   #undef VL_GLES_EXTENSION
00121 
00122   #if defined(VL_OPENGL)
00123     #define VL_GL_FUNCTION(TYPE, NAME) VLGRAPHICS_EXPORT extern TYPE NAME;
00124     #include <vlGraphics/GL/GLFunctionList.hpp>
00125     #undef VL_GL_FUNCTION
00126   #endif
00127 
00128   #if defined(VL_OPENGL_ES1)
00129     #define VL_GL_FUNCTION(TYPE, NAME) VLGRAPHICS_EXPORT extern TYPE NAME;
00130     #include <vlGraphics/GL/GLES1FunctionList.hpp>
00131     #undef VL_GL_FUNCTION
00132   #endif
00133 
00134   #if defined(VL_OPENGL_ES2)
00135     #define VL_GL_FUNCTION(TYPE, NAME) VLGRAPHICS_EXPORT extern TYPE NAME;
00136     #include <vlGraphics/GL/GLES2FunctionList.hpp>
00137     #undef VL_GL_FUNCTION
00138   #endif
00139 
00141   VLGRAPHICS_EXPORT bool initializeOpenGL();
00142 
00144   VLGRAPHICS_EXPORT void* getGLProcAddress(const char* name);
00145   
00147   VLGRAPHICS_EXPORT const char* getGLErrorString(int err);
00148 
00149   //-----------------------------------------------------------------------------
00150   // VL_CHECK_OGL
00151   //-----------------------------------------------------------------------------
00152 
00153   VLGRAPHICS_EXPORT int glcheck( const char* file, int line );
00154 
00155   #if defined( _DEBUG ) || !defined( NDEBUG ) || VL_FORCE_CHECKS == 1
00156     #define VL_CHECK_OGL( ) { if ( ::vl::glcheck( __FILE__, __LINE__ ) ) { VL_TRAP( ) } }
00157   #else
00158     #define VL_CHECK_OGL( );
00159   #endif
00160 
00161   //------------------------------------------------------------------------------
00162   
00163 }
00164 
00165 //-----------------------------------------------------------------------------
00166 // OpenGL functions wrappers
00167 //-----------------------------------------------------------------------------
00168 
00169 #if defined(VL_OPENGL)
00170   #include <vlGraphics/GL/VL_Functions_GL.hpp>
00171 #endif
00172   
00173 #if defined(VL_OPENGL_ES1)
00174   #include <vlGraphics/GL/VL_Functions_GLES1.hpp>
00175 #endif
00176 
00177 #if defined(VL_OPENGL_ES2)
00178   #include <vlGraphics/GL/VL_Functions_GLES2.hpp>
00179 #endif
00180 //-----------------------------------------------------------------------------
00181 #endif

Visualization Library 2011.09.1160 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 2 2013 13:40:38.
Permission is granted to use this page to write and publish articles regarding Visualization Library.