source: OGRE/trunk/ogrenew/RenderSystems/GL/include/OgreGLPixelFormat.h @ 692

Revision 692, 3.6 KB checked in by mattausch, 19 years ago (diff)

adding ogre 1.2 and dependencies

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-2005 The OGRE Team
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-----------------------------------------------------------------------------
24*/
25#ifndef __GLPIXELFORMAT_H__
26#define __GLPIXELFORMAT_H__
27
28#include "OgreGLPrerequisites.h"
29#include "OgrePixelFormat.h"
30namespace Ogre {
31   
32        /**
33        * Class to do pixel format mapping between GL and OGRE
34        */
35        class GLPixelUtil {
36        public:
37                /** Takes the OGRE pixel format and returns the appropriate GL one
38                        @returns a GLenum describing the format, or 0 if there is no exactly matching
39                        one (and conversion is needed)
40                */
41                static GLenum getGLOriginFormat(PixelFormat mFormat);
42       
43                /** Takes the OGRE pixel format and returns type that must be provided
44                        to GL as data type for reading it into the GPU
45                        @returns a GLenum describing the data type, or 0 if there is no exactly matching
46                        one (and conversion is needed)
47                */
48                static GLenum getGLOriginDataType(PixelFormat mFormat);
49       
50        /**     Takes the OGRE pixel format and returns the type that must be provided
51                        to GL as internal format. GL_NONE if no match exists.
52                */
53                static GLenum getGLInternalFormat(PixelFormat mFormat);
54       
55                /**     Takes the OGRE pixel format and returns the type that must be provided
56                        to GL as internal format. If no match exists, returns the closest match.
57                */
58                static GLenum getClosestGLInternalFormat(PixelFormat mFormat);
59               
60                /**     Function to get the closest matching OGRE format to an internal GL format. To be
61                        precise, the format will be chosen that is most efficient to transfer to the card
62                        without losing precision.
63                        @remarks It is valid for this function to always return PF_A8R8G8B8.
64                */
65                static PixelFormat getClosestOGREFormat(GLenum fmt);
66       
67                /** Returns the maximum number of Mipmaps that can be generated until we reach
68                        the mininum format possible. This does not count the base level.
69                        @param width
70                                The width of the area
71                        @param height
72                                The height of the area
73                        @param depth
74                                The depth of the area
75                        @param format
76                                The format of the area
77                        @remarks
78                                In case that the format is non-compressed, this simply returns
79                                how many times we can divide this texture in 2 until we reach 1x1.
80                                For compressed formats, constraints apply on minimum size and alignment
81                                so this might differ.
82                */
83                static size_t getMaxMipmaps(size_t width, size_t height, size_t depth, PixelFormat format);
84       
85        /** Returns next power-of-two size if required by render system, in case
86            RSC_NON_POWER_OF_2_TEXTURES is supported it returns value as-is.
87        */
88        static size_t optionalPO2(size_t value);
89        };
90};
91
92#endif
Note: See TracBrowser for help on using the repository browser.