|
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 /or associated documentation files |
|
5 * (the "Materials "), to deal in the Materials without restriction, |
|
6 * including without limitation the rights to use, copy, modify, merge, |
|
7 * publish, distribute, sublicense, and/or sell copies of the Materials, |
|
8 * and to permit persons to whom the Materials are furnished to do so, |
|
9 * subject to the following conditions: |
|
10 * |
|
11 * The above copyright notice and this permission notice shall be included |
|
12 * in all copies or substantial portions of the Materials. |
|
13 * |
|
14 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|
15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|
17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
|
18 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
|
19 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR |
|
20 * THE USE OR OTHER DEALINGS IN THE MATERIALS. |
|
21 * |
|
22 * Initial Contributors: |
|
23 * Nokia Corporation - initial contribution. |
|
24 * |
|
25 * Contributors: |
|
26 * |
|
27 * Description: |
|
28 * |
|
29 */ |
|
30 |
|
31 #include "GLESDesktopGL.h" |
|
32 #include "glesInternal.h" |
|
33 #include "EGLInterface.h" |
|
34 #include <iostream> |
|
35 |
|
36 // Load function via EGL interface |
|
37 #define LOAD(func) do \ |
|
38 { \ |
|
39 *reinterpret_cast<void**>(&func) = iFace->GetHostProcAddress(#func); \ |
|
40 if(func == NULL) \ |
|
41 { \ |
|
42 std::cerr << "Symbol " << #func << " not found" << std::endl; \ |
|
43 success = false; \ |
|
44 } \ |
|
45 } while(0) |
|
46 |
|
47 GLESDesktopGL::GLESDesktopGL() : |
|
48 m_loaded(false) |
|
49 { |
|
50 } |
|
51 |
|
52 bool GLESDesktopGL::Load() |
|
53 { |
|
54 if( m_loaded ) |
|
55 { |
|
56 return true; |
|
57 } |
|
58 |
|
59 bool success = true; |
|
60 |
|
61 IGLEStoEGLInterface* iFace = EGLtoGLESInterface::GetEGLInterface(); |
|
62 |
|
63 LOAD(glActiveTexture); |
|
64 LOAD(glAlphaFunc); |
|
65 LOAD(glBegin); |
|
66 LOAD(glBindBuffer); |
|
67 LOAD(glBindTexture); |
|
68 LOAD(glBlendFunc); |
|
69 LOAD(glBufferData); |
|
70 LOAD(glBufferSubData); |
|
71 LOAD(glClear); |
|
72 LOAD(glClearColor); |
|
73 LOAD(glClearDepth); |
|
74 LOAD(glClearStencil); |
|
75 LOAD(glClientActiveTexture); |
|
76 LOAD(glClipPlane); |
|
77 LOAD(glColor4d); |
|
78 LOAD(glColor4f); |
|
79 LOAD(glColor4fv); |
|
80 LOAD(glColor4ub); |
|
81 LOAD(glColor4ubv); |
|
82 LOAD(glColorMask); |
|
83 LOAD(glColorPointer); |
|
84 LOAD(glCompressedTexImage2D); |
|
85 LOAD(glCompressedTexSubImage2D); |
|
86 LOAD(glCopyTexImage2D); |
|
87 LOAD(glCopyTexSubImage2D); |
|
88 LOAD(glCullFace); |
|
89 LOAD(glDeleteBuffers); |
|
90 LOAD(glDeleteTextures); |
|
91 LOAD(glDepthFunc); |
|
92 LOAD(glDepthMask); |
|
93 LOAD(glDepthRange); |
|
94 LOAD(glDisable); |
|
95 LOAD(glDisableClientState); |
|
96 LOAD(glDrawArrays); |
|
97 LOAD(glDrawElements); |
|
98 LOAD(glEnable); |
|
99 LOAD(glEnableClientState); |
|
100 LOAD(glEnd); |
|
101 LOAD(glFinish); |
|
102 LOAD(glFlush); |
|
103 LOAD(glFogf); |
|
104 LOAD(glFogfv); |
|
105 LOAD(glFrontFace); |
|
106 LOAD(glFrustum); |
|
107 LOAD(glGenBuffers); |
|
108 LOAD(glGenTextures); |
|
109 LOAD(glGetBooleanv); |
|
110 LOAD(glGetBufferParameteriv); |
|
111 LOAD(glGetClipPlane); |
|
112 LOAD(glGetDoublev); |
|
113 LOAD(glGetError); |
|
114 LOAD(glGetFloatv); |
|
115 LOAD(glGetIntegerv); |
|
116 LOAD(glGetLightfv); |
|
117 LOAD(glGetMaterialfv); |
|
118 LOAD(glGetPointerv); |
|
119 LOAD(glGetString); |
|
120 LOAD(glGetTexEnvfv); |
|
121 LOAD(glGetTexEnviv); |
|
122 LOAD(glGetTexParameterfv); |
|
123 LOAD(glGetTexParameteriv); |
|
124 LOAD(glHint); |
|
125 LOAD(glIsBuffer); |
|
126 LOAD(glIsEnabled); |
|
127 LOAD(glIsTexture); |
|
128 LOAD(glLightf); |
|
129 LOAD(glLightfv); |
|
130 LOAD(glLightModelf); |
|
131 LOAD(glLightModelfv); |
|
132 LOAD(glLineWidth); |
|
133 LOAD(glLoadIdentity); |
|
134 LOAD(glLoadMatrixf); |
|
135 LOAD(glLogicOp); |
|
136 LOAD(glMaterialf); |
|
137 LOAD(glMaterialfv); |
|
138 LOAD(glMultiTexCoord2fv); |
|
139 LOAD(glMultiTexCoord2sv); |
|
140 LOAD(glMultiTexCoord3fv); |
|
141 LOAD(glMultiTexCoord3sv); |
|
142 LOAD(glMultiTexCoord4fv); |
|
143 LOAD(glMultiTexCoord4sv); |
|
144 LOAD(glMultiTexCoord4f); |
|
145 LOAD(glMultMatrixf); |
|
146 LOAD(glNormal3f); |
|
147 LOAD(glNormal3fv); |
|
148 LOAD(glNormal3sv); |
|
149 LOAD(glOrtho); |
|
150 LOAD(glPointParameterf); |
|
151 LOAD(glPointParameterfv); |
|
152 LOAD(glPointSize); |
|
153 LOAD(glPolygonOffset); |
|
154 LOAD(glRotatef); |
|
155 LOAD(glScalef); |
|
156 LOAD(glTexEnvf); |
|
157 LOAD(glTexEnvfv); |
|
158 LOAD(glTexParameterf); |
|
159 LOAD(glTexParameterfv); |
|
160 LOAD(glMatrixMode); |
|
161 LOAD(glNormalPointer); |
|
162 LOAD(glPixelStorei); |
|
163 LOAD(glPopMatrix); |
|
164 LOAD(glPushMatrix); |
|
165 LOAD(glReadPixels); |
|
166 LOAD(glSampleCoverage); |
|
167 LOAD(glScissor); |
|
168 LOAD(glShadeModel); |
|
169 LOAD(glStencilFunc); |
|
170 LOAD(glStencilMask); |
|
171 LOAD(glStencilOp); |
|
172 LOAD(glTexCoordPointer); |
|
173 LOAD(glTexEnvi); |
|
174 LOAD(glTexEnviv); |
|
175 LOAD(glTexImage2D); |
|
176 LOAD(glTexParameteri); |
|
177 LOAD(glTexParameteriv); |
|
178 LOAD(glTexSubImage2D); |
|
179 LOAD(glTranslatef); |
|
180 LOAD(glVertex2fv); |
|
181 LOAD(glVertex2sv); |
|
182 LOAD(glVertex3fv); |
|
183 LOAD(glVertex3sv); |
|
184 LOAD(glVertex4fv); |
|
185 LOAD(glVertex4sv); |
|
186 LOAD(glVertexPointer); |
|
187 LOAD(glViewport); |
|
188 LOAD(glDrawPixels); |
|
189 |
|
190 m_loaded = success; |
|
191 |
|
192 return success; |
|
193 } |
|
194 |
|
195 #undef LOAD |