|
1 /* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
2 * |
|
3 * Permission is hereby granted, free of charge, to any person obtaining a |
|
4 * copy of this software and associated documentation files (the "Software"), |
|
5 * to deal in the Software without restriction, including without limitation |
|
6 * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
|
7 * and/or sell copies of the Software, and to permit persons to whom the |
|
8 * Software is furnished to do so, subject to the following conditions: |
|
9 * |
|
10 * The above copyright notice and this permission notice shall be included |
|
11 * in all copies or substantial portions of the Software. |
|
12 * |
|
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
|
14 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
16 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
|
17 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
|
18 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
19 * |
|
20 * Initial Contributors: |
|
21 * Nokia Corporation - initial contribution. |
|
22 * |
|
23 * Contributors: |
|
24 * |
|
25 * Description: |
|
26 * |
|
27 */ |
|
28 |
|
29 #ifndef TEXTURE_H_ |
|
30 #define TEXTURE_H_ |
|
31 |
|
32 typedef enum DGLTextureType |
|
33 { |
|
34 DGLES2_TEXTURE_2D, |
|
35 DGLES2_TEXTURE_CUBE_MAP |
|
36 } DGLTextureType; |
|
37 |
|
38 typedef struct DGLTextureLevel |
|
39 { |
|
40 GLboolean specified; |
|
41 GLenum format; |
|
42 GLsizei width; |
|
43 GLsizei height; |
|
44 void* bound_surface; // The EGLSurface bound to this image with eglBindTexImage. |
|
45 } DGLTextureLevel; |
|
46 |
|
47 typedef struct DGLTexture |
|
48 { |
|
49 struct DGLObject obj; |
|
50 |
|
51 DGLTextureType type; |
|
52 |
|
53 // One for each face in case of a cube map texture. |
|
54 int num_levels[6]; |
|
55 DGLTextureLevel* levels[6]; |
|
56 GLeglImageOES egl_image[6]; // EGLimage this texture is a sibling of. |
|
57 } DGLTexture; |
|
58 |
|
59 DGLTexture* DGLTexture_create(GLuint name, DGLTextureType type, GLint num_levels); |
|
60 void DGLTexture_destroy(DGLTexture* texture); |
|
61 GLboolean DGLTexture_isComplete(const DGLTexture* texture); |
|
62 GLboolean DGLTexture_hasLevelZero(const DGLTexture* texture); |
|
63 GLboolean DGLTexture_hasLevelsOtherThanZero(const DGLTexture* texture); |
|
64 DGLTextureLevel* DGLTexture_getLevel(DGLTexture* texture, GLenum target, GLint level); |
|
65 void DGLTexture_setLevel(DGLTexture* texture, GLenum target, GLint level, GLenum format, GLsizei width, GLsizei height); |
|
66 GLeglImageOES DGLTexture_getEGLImage(DGLTexture* texture, GLenum target); |
|
67 void DGLTexture_setEGLImage(DGLTexture* texture, GLenum target, GLeglImageOES image); |
|
68 void DGLTexture_generateMipmap(DGLTexture* texture); |
|
69 |
|
70 #endif // TEXTURE_H_ |