PageRenderTime 492ms CodeModel.GetById 162ms app.highlight 130ms RepoModel.GetById 193ms app.codeStats 1ms

/opengles/src/Config.h

http://ftk.googlecode.com/
C++ Header | 131 lines | 79 code | 16 blank | 36 comment | 0 complexity | 1fb5219424bcd1cf2711dcae5648a940 MD5 | raw file
  1#ifndef EGL_CONFIG_H
  2#define EGL_CONFIG_H 1
  3
  4// ==========================================================================
  5//
  6// Config.h			Configuration Management Class
  7//					for 3D Rendering Library
  8//
  9// --------------------------------------------------------------------------
 10//
 11// 08-14-2003		Hans-Martin Will	initial version
 12//
 13// --------------------------------------------------------------------------
 14//
 15// Copyright (c) 2004, Hans-Martin Will. All rights reserved.
 16// 
 17// Redistribution and use in source and binary forms, with or without 
 18// modification, are permitted provided that the following conditions are 
 19// met:
 20// 
 21//	 *  Redistributions of source code must retain the above copyright
 22// 		notice, this list of conditions and the following disclaimer. 
 23//   *	Redistributions in binary form must reproduce the above copyright
 24// 		notice, this list of conditions and the following disclaimer in the 
 25// 		documentation and/or other materials provided with the distribution. 
 26// 
 27// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 28// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 29// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 30// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
 31// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 
 32// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 33// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 34// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 35// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 36// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
 37// THE POSSIBILITY OF SUCH DAMAGE.
 38//
 39// ==========================================================================
 40
 41
 42#include "OGLES.h"
 43#include "GLES/egl.h"
 44
 45
 46namespace EGL {
 47
 48	class Context;
 49
 50	class Config {
 51
 52#if defined(EGL_ON_LINUX)
 53		friend class Context;
 54#else
 55		friend Context;
 56#endif
 57
 58	public:
 59		Config(
 60			EGLint	bufferSize,
 61			EGLint	redSize,
 62			EGLint	greenSize,
 63			EGLint	blueSize,
 64			EGLint	alphaSize,
 65			EGLint	configCaveat,
 66			EGLint	configID,
 67			EGLint	depthSize,
 68			EGLint	level,
 69			EGLint	maxPBufferWidth,
 70			EGLint	maxPBufferHeight,
 71			EGLint	mxPBufferPixels,
 72			EGLint	nativeRenderable,
 73			EGLint	nativeVisualID,
 74			EGLint	nativeVisualType,
 75			EGLint	sampleBuffers,
 76			EGLint	samples,
 77			EGLint	stencilSize,
 78			EGLint	surfaceType,
 79			EGLint	transparentType,
 80			EGLint	transparentRedValue,
 81			EGLint	transparentGreenValue,
 82			EGLint	transparentBlueValue,
 83			EGLint  width,
 84			EGLint	height
 85			);
 86
 87		OGLES_API Config() { }
 88		Config (const Config &other, const EGLint * attribList = 0, const EGLint * validAttributes = 0);
 89		Config & operator=(const Config & other);
 90
 91		EGLint GetConfigAttrib(EGLint attribute) const;
 92		void SetConfigAttrib(EGLint attribute, EGLint value);
 93
 94		static EGLBoolean GetConfigs(EGLConfig * result, EGLint configSize, EGLint * numConfig);
 95		static EGLBoolean ChooseConfig(const EGLint * attribList, EGLConfig * result, EGLint configSize, EGLint * numConfig);
 96
 97	private:
 98		bool Matches(EGLint attribList);
 99
100		static bool IsValidAttribute(const EGLint * validAttributes, EGLint attribute);
101
102	private:
103		EGLint	m_BufferSize;
104		EGLint	m_RedSize;
105		EGLint	m_GreenSize;
106		EGLint	m_BlueSize;
107		EGLint	m_AlphaSize;
108		EGLint	m_ConfigCaveat;
109		EGLint	m_ConfigID;
110		EGLint	m_DepthSize;
111		EGLint	m_Level;
112		EGLint	m_MaxPBufferWidth;
113		EGLint	m_MaxPBufferHeight;
114		EGLint	m_MaxPBufferPixels;
115		EGLint	m_NativeRenderable;
116		EGLint	m_NativeVisualID;
117		EGLint	m_NativeVisualType;
118		EGLint	m_SampleBuffers;
119		EGLint	m_Samples;
120		EGLint	m_StencilSize;
121		EGLint	m_SurfaceType;
122		EGLint	m_TransparentType;
123		EGLint	m_TransparentRedValue;
124		EGLint	m_TransparentGreenValue;
125		EGLint	m_TransparentBlueValue;
126		EGLint  m_Width;
127		EGLint	m_Height;
128	};
129}
130
131#endif // ndef EGL_CONFIG_H