GL Studio C++ Runtime API
frame_buffer_utility.h
Go to the documentation of this file.
1 
2 /*! \file
3  \brief Utility for common frame buffer support
4 
5  \par Copyright Information
6 
7  Copyright (c) 2017 by The DiSTI Corporation.<br>
8  11301 Corporate Blvd; Suite 100<br>
9  Orlando, Florida 32817<br>
10  USA<br>
11  <br>
12  All rights reserved.<br>
13 
14  This Software contains proprietary trade secrets of DiSTI and may not be
15 reproduced, in whole or part, in any form, or by any means of electronic,
16 mechanical, or otherwise, without the written permission of DiSTI. Said
17 permission may be derived through the purchase of applicable DiSTI product
18 licenses which detail the distribution rights of this content and any
19 Derivative Works based on this or other copyrighted DiSTI Software.
20 
21  NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
22 AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
23 PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
24 AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
25 IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
26 PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
27 
28  LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
29 IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
30 INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
31 DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
32 INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
33 INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
34 OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
35 EXCEED FIVE DOLLARS (US$5.00).
36 
37  The aforementioned terms and restrictions are governed by the laws of the
38 State of Florida and the United States of America.
39 
40 */
41 
42 #ifndef INCLUDED_FRAME_BUFFER_UTILITY_H
43 #define INCLUDED_FRAME_BUFFER_UTILITY_H
44 
45 #include "gls_gl.h"
46 
47 #if defined( __APPLE__ ) || ( defined( GLES ) && defined( LINUX ) ) || defined( __VXWORKS__ ) || defined( QNX )
48 
49 # define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES
50 # define GL_DEPTH_STENCIL GL_DEPTH_STENCIL_OES
51 # define GL_UNSIGNED_INT_24_8 GL_UNSIGNED_INT_24_8_OES
52 # define GL_DEPTH_COMPONENT24 GL_DEPTH_COMPONENT24_OES
53 
54 # ifndef GLES20
55 # define GL_FRAMEBUFFER GL_FRAMEBUFFER_OES
56 # define GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_OES
57 # define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES
58 # define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES
59 # define GL_FRAMEBUFFER_UNSUPPORTED GL_FRAMEBUFFER_UNSUPPORTED_OES
60 # define GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_OES
61 
62 # define GL_DEPTH_ATTACHMENT GL_DEPTH_ATTACHMENT_OES
63 # define GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_OES
64 # define GL_RENDERBUFFER GL_RENDERBUFFER_OES
65 # define GL_DEPTH_COMPONENT16 GL_DEPTH_COMPONENT16_OES
66 
67 # define glCheckFramebufferStatus glCheckFramebufferStatusOES
68 # define glBindFramebuffer glBindFramebufferOES
69 # define glGenFramebuffers glGenFramebuffersOES
70 # define glDeleteFramebuffers glDeleteFramebuffersOES
71 # define glDeleteRenderbuffers glDeleteRenderbuffersOES
72 # define glFramebufferTexture2D glFramebufferTexture2DOES
73 # define glGenerateMipmap glGenerateMipmapOES
74 # define glClearBufferfv glClearBufferfvOES
75 # define glGenRenderbuffers glGenRenderbuffersOES
76 # define glBindRenderbuffer glBindRenderbufferOES
77 # define glRenderbufferStorage glRenderbufferStorageOES
78 # define glFramebufferRenderbuffer glFramebufferRenderbufferOES
79 # endif
80 
81 #endif
82 
83 namespace disti
84 {
86 {
87 public:
88  /**
89  * Determine if the hardware supports Frame buffers.
90  * If it does, then the Frame buffer API is lazily instantiated
91  *
92  * \return True if frame buffers are supported
93  */
94  static bool frameBuffersAreSupported();
95 
96  /**
97  * Check the completeness status of the GL_FRAMEBUFFER.
98  *
99  * \return true if the status of the GL_FRAMEBUFFER is GL_FRAMEBUFFER_COMPLETE.
100  */
101  static bool checkFrameBufferStatus();
102 
103 private:
104  static bool frameBufferSupportAvailable; /*< True if frame buffer support is available. */
105  static bool frameBufferSupportInitialized; /*< True if frame buffer support has been initialized. Allows lazily initialzation. */
106 
107  /**
108  * Initialize frame buffer support.
109  */
110  static void initializeFrameBufferSupport();
111 
112  // Disallow, this class is designed to be a utiltiy class.
114 };
115 } // namespace disti
116 
117 #endif // INCLUDED_FRAME_BUFFER_UTILITY_H
Definition: frame_buffer_utility.h:85
static bool checkFrameBufferStatus()
static bool frameBuffersAreSupported()
Definition: bmpimage.h:46
The gls_gl.