1 #ifndef _GLUFBORENDERCONTEXT_HPP 2 #define _GLUFBORENDERCONTEXT_HPP 3 /*------------------------------------------------------------------------- 4 * drawElements Quality Program OpenGL ES Utilities 5 * ------------------------------------------------ 6 * 7 * Copyright 2014 The Android Open Source Project 8 * 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 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 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. 20 * 21 *//*! 22 * \file 23 * \brief OpenGL ES context wrapper that uses FBO as default framebuffer. 24 *//*--------------------------------------------------------------------*/ 25 26 #include "tcuDefs.hpp" 27 #include "gluRenderContext.hpp" 28 #include "tcuRenderTarget.hpp" 29 30 namespace tcu 31 { 32 class CommandLine; 33 } 34 35 namespace glu 36 { 37 38 class ContextFactory; 39 struct RenderConfig; 40 41 /*--------------------------------------------------------------------*//*! 42 * \brief OpenGL ES context wrapper that uses FBO as default framebuffer. 43 *//*--------------------------------------------------------------------*/ 44 class FboRenderContext : public RenderContext 45 { 46 public: 47 FboRenderContext (RenderContext* context, const RenderConfig& config); 48 FboRenderContext (const ContextFactory& factory, const RenderConfig& config, const tcu::CommandLine& cmdLine); 49 virtual ~FboRenderContext (void); 50 getType(void) const51 virtual ContextType getType (void) const { return m_context->getType(); } getFunctions(void) const52 virtual const glw::Functions& getFunctions (void) const { return m_context->getFunctions(); } getRenderTarget(void) const53 virtual const tcu::RenderTarget& getRenderTarget (void) const { return m_renderTarget; } 54 virtual void postIterate (void); 55 getDefaultFramebuffer(void) const56 virtual deUint32 getDefaultFramebuffer (void) const { return m_framebuffer; } getProcAddress(const char * name) const57 virtual glw::GenericFuncType getProcAddress (const char* name) const { return m_context->getProcAddress(name); } 58 59 virtual void makeCurrent (void); 60 61 private: 62 void createFramebuffer (const RenderConfig& config); 63 void destroyFramebuffer (void); 64 65 RenderContext* m_context; 66 deUint32 m_framebuffer; 67 deUint32 m_colorBuffer; 68 deUint32 m_depthStencilBuffer; 69 tcu::RenderTarget m_renderTarget; 70 }; 71 72 // RenderConfig to format mapping utilities, useful for platforms like iOS. 73 deUint32 chooseColorFormat (const RenderConfig& config); 74 deUint32 chooseDepthStencilFormat (const RenderConfig& config); 75 76 } // glu 77 78 #endif // _GLUFBORENDERCONTEXT_HPP 79