Search
lxdream.org :: lxdream/src/pvr2/glutil.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/pvr2/glutil.h
changeset 1222:a4545699a82b
prev1219:3966d3e55351
next1223:61684ca88599
author nkeynes
date Wed Feb 15 17:54:51 2012 +1000 (7 years ago)
permissions -rw-r--r--
last change Use GL_TEXTURE_2D instead of GL_TEXTURE_RECTANGLE_ARB for frame buffers, for
systems that don't provide the latter (and there's not really much
difference anyway).
Add macro wrangling for GL_DEPTH24_STENCIL8 format
view annotate diff log raw
     1 /**
     2  * $Id$
     3  *
     4  * GL-based support functions 
     5  *
     6  * Copyright (c) 2005 Nathan Keynes.
     7  *
     8  * This program is free software; you can redistribute it and/or modify
     9  * it under the terms of the GNU General Public License as published by
    10  * the Free Software Foundation; either version 2 of the License, or
    11  * (at your option) any later version.
    12  *
    13  * This program is distributed in the hope that it will be useful,
    14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  * GNU General Public License for more details.
    17  */
    19 #ifndef lxdream_glutil_H
    20 #define lxdream_glutil_H
    22 #include <stdio.h>
    23 #include "display.h"
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    29 /**
    30  * Test if a specific extension is supported. From opengl.org
    31  * @param extension extension name to check for
    32  * @return TRUE if supported, otherwise FALSE.
    33  */
    34 gboolean isGLExtensionSupported( const char *extension );
    36 /**
    37  * Dump GL information to the output stream, usually for debugging purposes
    38  */
    39 void glPrintInfo( FILE *out );
    41 /**
    42  * Check for a GL error and print a message if there is one
    43  * @param context If not null, a string to be printed along side an error message
    44  * @return FALSE if there was an error, otherwise TRUE
    45  */
    46 gboolean gl_check_error( const char *context );
    47 /**
    48  * Test if secondary color (GL_COLOR_SUM) is supported.
    49  */
    50 gboolean isGLSecondaryColorSupported();
    52 gboolean isGLVertexBufferSupported();
    53 gboolean isGLVertexRangeSupported();
    54 gboolean isGLPixelBufferSupported();
    55 gboolean isGLMultitextureSupported();
    56 gboolean isGLMirroredTextureSupported();
    58 /****** Extension variant wrangling *****/
    60 #if defined(GL_MIRRORED_REPEAT_ARB) && !defined(GL_MIRRORED_REPEAT)
    61 #define GL_MIRRORED_REPEAT GL_MIRRORED_REPEAT_ARB
    62 #endif
    64 #if defined(GL_MAX_TEXTURE_UNITS_ARB) && !defined(GL_MAX_TEXTURE_UNITS)
    65 #define GL_MAX_TEXTURE_UNITS GL_MAX_TEXTURE_UNITS_ARB
    66 #endif
    68 #if defined(GL_FRAMEBUFFER_EXT) && !defined(GL_FRAMEBUFFER)
    69 #define GL_FRAMEBUFFER GL_FRAMEBUFFER_EXT
    70 #endif
    72 #if defined(GL_RENDERBUFFER_EXT) && !defined(GL_RENDERBUFFER)
    73 #define GL_RENDERBUFFER GL_RENDERBUFFER_EXT
    74 #endif
    76 #if defined(GL_COLOR_ATTACHMENT0_EXT) && !defined(GL_COLOR_ATTACHMENT0)
    77 #define GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_EXT
    78 #endif
    80 #if defined(GL_MAX_COLOR_ATTACHMENTS_EXT) && !defined(GL_MAX_COLOR_ATTACHMENTS)
    81 #define GL_MAX_COLOR_ATTACHMENTS GL_MAX_COLOR_ATTACHMENTS_EXT
    82 #endif
    84 #if defined(GL_STENCIL_ATTACHMENT_EXT) && !defined(GL_STENCIL_ATTACHMENT)
    85 #define GL_STENCIL_ATTACHMENT GL_STENCIL_ATTACHMENT_EXT
    86 #endif
    88 #if defined(GL_DEPTH_ATTACHMENT_EXT) && !defined(GL_DEPTH_ATTACHMENT)
    89 #define GL_DEPTH_ATTACHMENT GL_DEPTH_ATTACHMENT_EXT
    90 #endif
    92 #ifndef GL_DEPTH24_STENCIL8
    93 #if defined(GL_DEPTH24_STENCIL8_EXT)
    94 #define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_EXT
    95 #elif defined(GL_DEPTH24_STENCIL8_OES)
    96 #define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES
    97 #endif
    98 #endif
   100 #if defined(GL_FRAMEBUFFER_COMPLETE_EXT) && !defined(GL_FRAMEBUFFER_COMPLETE)
   101 #define GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_EXT
   102 #endif
   104 #if defined(HAVE_OPENGL_FBO_EXT) && !defined(HAVE_OPENGL_FBO)
   105 #define glGenFramebuffers glGenFramebuffersEXT
   106 #define glGenRenderbuffers glGenRenderbuffersEXT
   107 #define glBindFramebuffer glBindFramebufferEXT
   108 #define glDeleteFramebuffers glDeleteFramebuffersEXT
   109 #define glDeleteRenderbuffers glDeleteRenderbuffersEXT
   110 #define glBindFramebuffer glBindFramebufferEXT
   111 #define glBindRenderbuffer glBindRenderbufferEXT
   112 #define glRenderbufferStorage glRenderbufferStorageEXT
   113 #define glFramebufferRenderbuffer glFramebufferRenderbufferEXT
   114 #define glFramebufferTexture2D glFramebufferTexture2DEXT
   115 #define glCheckFramebufferStatus glCheckFramebufferStatusEXT
   116 #endif
   119 /****** Shader handling (gl_sl.c) *****/
   120 gboolean glsl_is_supported(void);
   121 const char *glsl_get_version(void);
   122 gboolean glsl_load_shaders( );
   123 void glsl_unload_shaders(void);
   124 void glsl_clear_shader();
   126 /* Convenience formatting function for driver use */
   127 void fprint_extensions( FILE *out, const char *extensions );
   129 #ifdef __cplusplus
   130 }
   131 #endif
   133 #endif /* !lxdream_glutil_H */
.