Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/RenderSystems/GL/include/OgreGLPixelFormat.h @ 3

Last change on this file since 3 was 3, checked in by anonymous, 17 years ago

=update

File size: 3.7 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2006 Torus Knot Software Ltd
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23
24You may alternatively use this source under the terms of a specific version of
25the OGRE Unrestricted License provided you have obtained such a license from
26Torus Knot Software Ltd.
27-----------------------------------------------------------------------------
28*/
29#ifndef __GLPIXELFORMAT_H__
30#define __GLPIXELFORMAT_H__
31
32#include "OgreGLPrerequisites.h"
33#include "OgrePixelFormat.h"
34namespace Ogre {
35   
36        /**
37        * Class to do pixel format mapping between GL and OGRE
38        */
39        class _OgrePrivate GLPixelUtil
40        {
41        public:
42                /** Takes the OGRE pixel format and returns the appropriate GL one
43                        @returns a GLenum describing the format, or 0 if there is no exactly matching
44                        one (and conversion is needed)
45                */
46                static GLenum getGLOriginFormat(PixelFormat mFormat);
47       
48                /** Takes the OGRE pixel format and returns type that must be provided
49                        to GL as data type for reading it into the GPU
50                        @returns a GLenum describing the data type, or 0 if there is no exactly matching
51                        one (and conversion is needed)
52                */
53                static GLenum getGLOriginDataType(PixelFormat mFormat);
54       
55        /**     Takes the OGRE pixel format and returns the type that must be provided
56                        to GL as internal format. GL_NONE if no match exists.
57                */
58                static GLenum getGLInternalFormat(PixelFormat mFormat);
59       
60                /**     Takes the OGRE pixel format and returns the type that must be provided
61                        to GL as internal format. If no match exists, returns the closest match.
62                */
63                static GLenum getClosestGLInternalFormat(PixelFormat mFormat);
64               
65                /**     Function to get the closest matching OGRE format to an internal GL format. To be
66                        precise, the format will be chosen that is most efficient to transfer to the card
67                        without losing precision.
68                        @remarks It is valid for this function to always return PF_A8R8G8B8.
69                */
70                static PixelFormat getClosestOGREFormat(GLenum fmt);
71       
72                /** Returns the maximum number of Mipmaps that can be generated until we reach
73                        the mininum format possible. This does not count the base level.
74                        @param width
75                                The width of the area
76                        @param height
77                                The height of the area
78                        @param depth
79                                The depth of the area
80                        @param format
81                                The format of the area
82                        @remarks
83                                In case that the format is non-compressed, this simply returns
84                                how many times we can divide this texture in 2 until we reach 1x1.
85                                For compressed formats, constraints apply on minimum size and alignment
86                                so this might differ.
87                */
88                static size_t getMaxMipmaps(size_t width, size_t height, size_t depth, PixelFormat format);
89       
90        /** Returns next power-of-two size if required by render system, in case
91            RSC_NON_POWER_OF_2_TEXTURES is supported it returns value as-is.
92        */
93        static size_t optionalPO2(size_t value);
94        };
95};
96
97#endif
Note: See TracBrowser for help on using the repository browser.