1 #ifndef _GLUFBORENDERCONTEXT_HPP
2 #define _GLUFBORENDERCONTEXT_HPP
3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program OpenGL ES Utilities
5 * ------------------------------------------------
7 * Copyright 2014 The Android Open Source Project
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 * \brief OpenGL ES context wrapper that uses FBO as default framebuffer.
24 *//*--------------------------------------------------------------------*/
26 #include "tcuDefs.hpp"
27 #include "gluRenderContext.hpp"
28 #include "tcuRenderTarget.hpp"
41 /*--------------------------------------------------------------------*//*!
42 * \brief OpenGL ES context wrapper that uses FBO as default framebuffer.
43 *//*--------------------------------------------------------------------*/
44 class FboRenderContext : public RenderContext
47 FboRenderContext (RenderContext* context, const RenderConfig& config);
48 FboRenderContext (const ContextFactory& factory, const RenderConfig& config, const tcu::CommandLine& cmdLine);
49 virtual ~FboRenderContext (void);
51 virtual ContextType getType (void) const { return m_context->getType(); }
52 virtual const glw::Functions& getFunctions (void) const { return m_context->getFunctions(); }
53 virtual const tcu::RenderTarget& getRenderTarget (void) const { return m_renderTarget; }
54 virtual void postIterate (void);
56 virtual deUint32 getDefaultFramebuffer (void) const { return m_framebuffer; }
57 virtual glw::GenericFuncType getProcAddress (const char* name) const { return m_context->getProcAddress(name); }
59 virtual void makeCurrent (void);
62 void createFramebuffer (const RenderConfig& config);
63 void destroyFramebuffer (void);
65 RenderContext* m_context;
66 deUint32 m_framebuffer;
67 deUint32 m_colorBuffer;
68 deUint32 m_depthStencilBuffer;
69 tcu::RenderTarget m_renderTarget;
72 // RenderConfig to format mapping utilities, useful for platforms like iOS.
73 deUint32 chooseColorFormat (const RenderConfig& config);
74 deUint32 chooseDepthStencilFormat (const RenderConfig& config);
78 #endif // _GLUFBORENDERCONTEXT_HPP