Convert texture's gl format (from dali-core).
[platform/core/uifw/dali-adaptor.git] / dali / internal / graphics / gles / gl-implementation.h
1 #ifndef __DALI_INTERNAL_GL_IMPLEMENTATION_H__
2 #define __DALI_INTERNAL_GL_IMPLEMENTATION_H__
3
4 /*
5  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #ifndef DALI_GLES_VERSION
23 #error "OpenGL ES version not specified"
24 #endif
25
26 #if DALI_GLES_VERSION >= 31
27 #include <GLES3/gl31.h>
28 #elif DALI_GLES_VERSION >= 30
29 #include <GLES3/gl3.h>
30 #else
31 #include <cstdlib>
32 #include <GLES2/gl2.h>
33 #endif
34
35 #include <dali/integration-api/gl-abstraction.h>
36
37 // INTERNAL INCLUDES
38 #include <dali/internal/graphics/gles/gl-extensions.h>
39
40 namespace Dali
41 {
42
43 namespace Internal
44 {
45
46 namespace Adaptor
47 {
48
49 /**
50  * GlImplementation is a concrete implementation for GlAbstraction.
51  * The class provides an OpenGL-ES 2.0 implementation.
52  * The class is provided when creating the Integration::Core object.
53  */
54 class GlImplementation: public Dali::Integration::GlAbstraction
55 {
56
57 public:
58   virtual ~GlImplementation() {}
59
60   void PreRender()
61   {
62     /* Do nothing in main implementation */
63   }
64
65   void PostRender()
66   {
67     /* Do nothing in main implementation */
68   }
69
70   void ConvertTexture( uint8_t* buffer, GLenum& imageGlFormat, const uint32_t dataSize, const GLenum textureGlFormat, const bool isSubImage )
71   {
72     bool convert = ( ( imageGlFormat == GL_RGB ) && ( textureGlFormat == GL_RGBA ) );
73 #if DALI_GLES_VERSION >= 30
74     // Don't convert manually from RGB to RGBA if GLES >= 3.0 and a sub-image is uploaded.
75     convert = convert && !isSubImage;
76 #endif // DALI_GLES_VERSION >= 30
77
78     if( convert )
79     {
80       //This buffer is only used if manually converting from RGB to RGBA
81       uint8_t* tempBuffer(0);
82
83       tempBuffer = new uint8_t[dataSize*4u];
84       for( uint32_t i = 0u; i < dataSize; ++i )
85       {
86         tempBuffer[i*4u]   = buffer[i*3u];
87         tempBuffer[i*4u+1] = buffer[i*3u+1];
88         tempBuffer[i*4u+2] = buffer[i*3u+2];
89         tempBuffer[i*4u+3] = 0xFF;
90       }
91       buffer = tempBuffer;
92       imageGlFormat = textureGlFormat; // Set the glFormat to GL_RGBA
93
94       //Destroy temp buffer used for conversion RGB->RGBA
95       delete[] tempBuffer;
96     }
97   }
98
99   /* OpenGL ES 2.0 */
100
101   void ActiveTexture (GLenum texture)
102   {
103     glActiveTexture(texture);
104   }
105
106   void AttachShader (GLuint program, GLuint shader)
107   {
108     glAttachShader(program,shader);
109   }
110
111   void BindAttribLocation (GLuint program, GLuint index, const char* name)
112   {
113     glBindAttribLocation(program,index,name);
114   }
115
116   void BindBuffer (GLenum target, GLuint buffer)
117   {
118     glBindBuffer(target,buffer);
119   }
120
121   void BindFramebuffer (GLenum target, GLuint framebuffer)
122   {
123     glBindFramebuffer(target,framebuffer);
124   }
125
126   void BindRenderbuffer (GLenum target, GLuint renderbuffer)
127   {
128     glBindRenderbuffer(target,renderbuffer);
129   }
130
131   void BindTexture (GLenum target, GLuint texture)
132   {
133     glBindTexture(target,texture);
134   }
135
136   void BlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
137   {
138     glBlendColor(red,green,blue,alpha);
139   }
140
141   void BlendEquation ( GLenum mode )
142   {
143     glBlendEquation(mode);
144   }
145
146   void BlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha)
147   {
148     glBlendEquationSeparate(modeRGB,modeAlpha);
149   }
150
151   void BlendFunc (GLenum sfactor, GLenum dfactor)
152   {
153     glBlendFunc(sfactor,dfactor);
154   }
155
156   void BlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
157   {
158     glBlendFuncSeparate(srcRGB,dstRGB,srcAlpha,dstAlpha);
159   }
160
161   void BufferData (GLenum target, GLsizeiptr size, const void* data, GLenum usage)
162   {
163     glBufferData(target,size,data,usage);
164   }
165
166   void BufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void* data)
167   {
168     glBufferSubData(target,offset,size,data);
169   }
170
171   GLenum CheckFramebufferStatus (GLenum target)
172   {
173     return glCheckFramebufferStatus(target);
174   }
175
176   void Clear (GLbitfield mask)
177   {
178     glClear(mask);
179   }
180
181   void ClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
182   {
183     glClearColor(red,green,blue,alpha);
184   }
185
186   void ClearDepthf (GLclampf depth)
187   {
188     glClearDepthf(depth);
189   }
190
191   void ClearStencil (GLint s)
192   {
193     glClearStencil(s);
194   }
195
196   void ColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
197   {
198     glColorMask(red,green,blue,alpha);
199   }
200
201   void CompileShader (GLuint shader)
202   {
203     glCompileShader(shader);
204   }
205
206   void CompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
207   {
208     glCompressedTexImage2D(target,level,internalformat,width,height,border,imageSize,data);
209   }
210
211   void CompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)
212   {
213     glCompressedTexSubImage2D(target,level,xoffset,yoffset,width,height,format,imageSize,data);
214   }
215
216   void CopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
217   {
218     glCopyTexImage2D(target,level,internalformat,x,y,width,height,border);
219   }
220
221   void CopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
222   {
223     glCopyTexSubImage2D(target,level,xoffset,yoffset,x,y,width,height);
224   }
225
226   GLuint CreateProgram (void)
227   {
228     return glCreateProgram();
229   }
230
231   GLuint CreateShader (GLenum type)
232   {
233     return glCreateShader(type);
234   }
235
236   void CullFace (GLenum mode)
237   {
238     glCullFace(mode);
239   }
240
241   void DeleteBuffers (GLsizei n, const GLuint* buffers)
242   {
243     glDeleteBuffers(n,buffers);
244   }
245
246   void DeleteFramebuffers (GLsizei n, const GLuint* framebuffers)
247   {
248     glDeleteFramebuffers(n,framebuffers);
249   }
250
251   void DeleteProgram (GLuint program)
252   {
253     glDeleteProgram(program);
254   }
255
256   void DeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers)
257   {
258     glDeleteRenderbuffers(n,renderbuffers);
259   }
260
261   void DeleteShader (GLuint shader)
262   {
263     glDeleteShader(shader);
264   }
265
266   void DeleteTextures (GLsizei n, const GLuint* textures)
267   {
268     glDeleteTextures(n,textures);
269   }
270
271   void DepthFunc (GLenum func)
272   {
273     glDepthFunc(func);
274   }
275
276   void DepthMask (GLboolean flag)
277   {
278     glDepthMask(flag);
279   }
280
281   void DepthRangef (GLclampf zNear, GLclampf zFar)
282   {
283     glDepthRangef(zNear,zFar);
284   }
285
286   void DetachShader (GLuint program, GLuint shader)
287   {
288     glDetachShader(program,shader);
289   }
290
291   void Disable (GLenum cap)
292   {
293     glDisable(cap);
294   }
295
296   void DisableVertexAttribArray (GLuint index)
297   {
298     glDisableVertexAttribArray(index);
299   }
300
301   void DrawArrays (GLenum mode, GLint first, GLsizei count)
302   {
303     glDrawArrays(mode,first,count);
304   }
305
306   void DrawElements (GLenum mode, GLsizei count, GLenum type, const void* indices)
307   {
308     glDrawElements(mode,count,type,indices);
309   }
310
311   void Enable (GLenum cap)
312   {
313     glEnable(cap);
314   }
315
316   void EnableVertexAttribArray (GLuint index)
317   {
318     glEnableVertexAttribArray(index);
319   }
320
321   void Finish (void)
322   {
323     glFinish();
324   }
325
326   void Flush (void)
327   {
328     glFlush();
329   }
330
331   void FramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
332   {
333     glFramebufferRenderbuffer(target,attachment,renderbuffertarget,renderbuffer);
334   }
335
336   void FramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
337   {
338     glFramebufferTexture2D(target,attachment,textarget,texture,level);
339   }
340
341   void FrontFace (GLenum mode)
342   {
343     glFrontFace(mode);
344   }
345
346   void GenBuffers (GLsizei n, GLuint* buffers)
347   {
348     glGenBuffers(n,buffers);
349   }
350
351   void GenerateMipmap (GLenum target)
352   {
353     glGenerateMipmap(target);
354   }
355
356   void GenFramebuffers (GLsizei n, GLuint* framebuffers)
357   {
358     glGenFramebuffers(n,framebuffers);
359   }
360
361   void GenRenderbuffers (GLsizei n, GLuint* renderbuffers)
362   {
363     glGenRenderbuffers(n,renderbuffers);
364   }
365
366   void GenTextures (GLsizei n, GLuint* textures)
367   {
368     glGenTextures(n,textures);
369   }
370
371   void GetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
372   {
373     glGetActiveAttrib(program,index,bufsize,length,size,type,name);
374   }
375
376   void GetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
377   {
378     glGetActiveUniform(program,index,bufsize,length,size,type,name);
379   }
380
381   void GetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
382   {
383     glGetAttachedShaders(program,maxcount,count,shaders);
384   }
385
386   int  GetAttribLocation (GLuint program, const char* name)
387   {
388     return glGetAttribLocation(program,name);
389   }
390
391   void GetBooleanv (GLenum pname, GLboolean* params)
392   {
393     glGetBooleanv(pname,params);
394   }
395
396   void GetBufferParameteriv (GLenum target, GLenum pname, GLint* params)
397   {
398     glGetBufferParameteriv(target,pname,params);
399   }
400
401   GLenum       GetError (void)
402   {
403     return glGetError();
404   }
405
406   void GetFloatv (GLenum pname, GLfloat* params)
407   {
408     glGetFloatv(pname,params);
409   }
410
411   void GetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params)
412   {
413     glGetFramebufferAttachmentParameteriv(target,attachment,pname,params);
414   }
415
416   void GetIntegerv (GLenum pname, GLint* params)
417   {
418     glGetIntegerv(pname,params);
419   }
420
421   void GetProgramiv (GLuint program, GLenum pname, GLint* params)
422   {
423     glGetProgramiv(program,pname,params);
424   }
425
426   void GetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
427   {
428     glGetProgramInfoLog(program,bufsize,length,infolog);
429   }
430
431   void GetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params)
432   {
433     glGetRenderbufferParameteriv(target,pname,params);
434   }
435
436   void GetShaderiv (GLuint shader, GLenum pname, GLint* params)
437   {
438     glGetShaderiv(shader,pname,params);
439   }
440
441   void GetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
442   {
443     glGetShaderInfoLog(shader,bufsize,length,infolog);
444   }
445
446   void GetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
447   {
448     glGetShaderPrecisionFormat(shadertype,precisiontype,range,precision);
449   }
450
451   void GetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
452   {
453     glGetShaderSource(shader,bufsize,length,source);
454   }
455
456   const GLubyte* GetString (GLenum name)
457   {
458     return glGetString(name);
459   }
460
461   void GetTexParameterfv (GLenum target, GLenum pname, GLfloat* params)
462   {
463     glGetTexParameterfv(target,pname,params);
464   }
465
466   void GetTexParameteriv (GLenum target, GLenum pname, GLint* params)
467   {
468     glGetTexParameteriv(target,pname,params);
469   }
470
471   void GetUniformfv (GLuint program, GLint location, GLfloat* params)
472   {
473     glGetUniformfv(program,location,params);
474   }
475
476   void GetUniformiv (GLuint program, GLint location, GLint* params)
477   {
478     glGetUniformiv(program,location,params);
479   }
480
481   int  GetUniformLocation (GLuint program, const char* name)
482   {
483     return glGetUniformLocation(program,name);
484   }
485
486   void GetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params)
487   {
488     glGetVertexAttribfv(index,pname,params);
489   }
490
491   void GetVertexAttribiv (GLuint index, GLenum pname, GLint* params)
492   {
493     glGetVertexAttribiv(index,pname,params);
494   }
495
496   void GetVertexAttribPointerv (GLuint index, GLenum pname, void** pointer)
497   {
498     glGetVertexAttribPointerv(index,pname,pointer);
499   }
500
501   void Hint (GLenum target, GLenum mode)
502   {
503     glHint(target,mode);
504   }
505
506   GLboolean IsBuffer (GLuint buffer)
507   {
508     return glIsBuffer(buffer);
509   }
510
511   GLboolean IsEnabled (GLenum cap)
512   {
513     return glIsEnabled(cap);
514   }
515
516   GLboolean IsFramebuffer (GLuint framebuffer)
517   {
518     return glIsFramebuffer(framebuffer);
519   }
520
521   GLboolean IsProgram (GLuint program)
522   {
523     return glIsProgram(program);
524   }
525
526   GLboolean IsRenderbuffer (GLuint renderbuffer)
527   {
528     return glIsRenderbuffer(renderbuffer);
529   }
530
531   GLboolean IsShader (GLuint shader)
532   {
533     return glIsShader(shader);
534   }
535
536   GLboolean IsTexture (GLuint texture)
537   {
538     return glIsTexture(texture);
539   }
540
541   void LineWidth (GLfloat width)
542   {
543     glLineWidth(width);
544   }
545
546   void LinkProgram (GLuint program)
547   {
548     glLinkProgram(program);
549   }
550
551   void PixelStorei (GLenum pname, GLint param)
552   {
553     glPixelStorei(pname,param);
554   }
555
556   void PolygonOffset (GLfloat factor, GLfloat units)
557   {
558     glPolygonOffset(factor,units);
559   }
560
561   void ReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels)
562   {
563     glReadPixels(x,y,width,height,format,type,pixels);
564   }
565
566   void ReleaseShaderCompiler (void)
567   {
568     glReleaseShaderCompiler();
569   }
570
571   void RenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
572   {
573     glRenderbufferStorage(target,internalformat,width,height);
574   }
575
576   void SampleCoverage (GLclampf value, GLboolean invert)
577   {
578     glSampleCoverage(value,invert);
579   }
580
581   void Scissor (GLint x, GLint y, GLsizei width, GLsizei height)
582   {
583     glScissor(x,y,width,height);
584   }
585
586   void ShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length)
587   {
588     glShaderBinary(n,shaders,binaryformat,binary,length);
589   }
590
591   void ShaderSource (GLuint shader, GLsizei count, const char** string, const GLint* length)
592   {
593     glShaderSource(shader,count,string,length);
594   }
595
596   void StencilFunc (GLenum func, GLint ref, GLuint mask)
597   {
598     glStencilFunc(func,ref,mask);
599   }
600
601   void StencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask)
602   {
603     glStencilFuncSeparate(face,func,ref,mask);
604   }
605
606   void StencilMask (GLuint mask)
607   {
608     glStencilMask(mask);
609   }
610
611   void StencilMaskSeparate (GLenum face, GLuint mask)
612   {
613     glStencilMaskSeparate(face,mask);
614   }
615
616   void StencilOp (GLenum fail, GLenum zfail, GLenum zpass)
617   {
618     glStencilOp(fail,zfail,zpass);
619   }
620
621   void StencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
622   {
623     glStencilOpSeparate(face,fail,zfail,zpass);
624   }
625
626   void TexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels)
627   {
628     glTexImage2D(target,level,internalformat,width,height,border,format,type,pixels);
629   }
630
631   void TexParameterf (GLenum target, GLenum pname, GLfloat param)
632   {
633     glTexParameterf(target,pname,param);
634   }
635
636   void TexParameterfv (GLenum target, GLenum pname, const GLfloat* params)
637   {
638     glTexParameterfv(target,pname,params);
639   }
640
641   void TexParameteri (GLenum target, GLenum pname, GLint param)
642   {
643     glTexParameteri(target,pname,param);
644   }
645
646   void TexParameteriv (GLenum target, GLenum pname, const GLint* params)
647   {
648     glTexParameteriv(target,pname,params);
649   }
650
651   void TexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels)
652   {
653     glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,pixels);
654   }
655
656   void Uniform1f (GLint location, GLfloat x)
657   {
658     glUniform1f(location,x);
659   }
660
661   void Uniform1fv (GLint location, GLsizei count, const GLfloat* v)
662   {
663     glUniform1fv(location,count,v);
664   }
665
666   void Uniform1i (GLint location, GLint x)
667   {
668     glUniform1i(location,x);
669   }
670
671   void Uniform1iv (GLint location, GLsizei count, const GLint* v)
672   {
673     glUniform1iv(location,count,v);
674   }
675
676   void Uniform2f (GLint location, GLfloat x, GLfloat y)
677   {
678     glUniform2f(location,x,y);
679   }
680
681   void Uniform2fv (GLint location, GLsizei count, const GLfloat* v)
682   {
683     glUniform2fv(location,count,v);
684   }
685
686   void Uniform2i (GLint location, GLint x, GLint y)
687   {
688     glUniform2i(location,x,y);
689   }
690
691   void Uniform2iv (GLint location, GLsizei count, const GLint* v)
692   {
693     glUniform2iv(location,count,v);
694   }
695
696   void Uniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z)
697   {
698     glUniform3f(location,x,y,z);
699   }
700
701   void Uniform3fv (GLint location, GLsizei count, const GLfloat* v)
702   {
703     glUniform3fv(location,count,v);
704   }
705
706   void Uniform3i (GLint location, GLint x, GLint y, GLint z)
707   {
708     glUniform3i(location,x,y,z);
709   }
710
711   void Uniform3iv (GLint location, GLsizei count, const GLint* v)
712   {
713     glUniform3iv(location,count,v);
714   }
715
716   void Uniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
717   {
718     glUniform4f(location,x,y,z,w);
719   }
720
721   void Uniform4fv (GLint location, GLsizei count, const GLfloat* v)
722   {
723     glUniform4fv(location,count,v);
724   }
725
726   void Uniform4i (GLint location, GLint x, GLint y, GLint z, GLint w)
727   {
728     glUniform4i(location,x,y,z,w);
729   }
730
731   void Uniform4iv (GLint location, GLsizei count, const GLint* v)
732   {
733     glUniform4iv(location,count,v);
734   }
735
736   void UniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
737   {
738     glUniformMatrix2fv(location,count,transpose,value);
739   }
740
741   void UniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
742   {
743     glUniformMatrix3fv(location,count,transpose,value);
744   }
745
746   void UniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
747   {
748     glUniformMatrix4fv(location,count,transpose,value);
749   }
750
751   void UseProgram (GLuint program)
752   {
753     glUseProgram(program);
754   }
755
756   void ValidateProgram (GLuint program)
757   {
758     glValidateProgram(program);
759   }
760
761   void VertexAttrib1f (GLuint indx, GLfloat x)
762   {
763     glVertexAttrib1f(indx,x);
764   }
765
766   void VertexAttrib1fv (GLuint indx, const GLfloat* values)
767   {
768     glVertexAttrib1fv(indx,values);
769   }
770
771   void VertexAttrib2f (GLuint indx, GLfloat x, GLfloat y)
772   {
773     glVertexAttrib2f(indx,x,y);
774   }
775
776   void VertexAttrib2fv (GLuint indx, const GLfloat* values)
777   {
778     glVertexAttrib2fv(indx,values);
779   }
780
781   void VertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z)
782   {
783     glVertexAttrib3f(indx,x,y,z);
784   }
785
786   void VertexAttrib3fv (GLuint indx, const GLfloat* values)
787   {
788     glVertexAttrib3fv(indx,values);
789   }
790
791   void VertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
792   {
793     glVertexAttrib4f(indx,x,y,z,w);
794   }
795
796   void VertexAttrib4fv (GLuint indx, const GLfloat* values)
797   {
798     glVertexAttrib4fv(indx,values);
799   }
800
801   void VertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)
802   {
803     glVertexAttribPointer(indx,size,type,normalized,stride,ptr);
804   }
805
806   void Viewport (GLint x, GLint y, GLsizei width, GLsizei height)
807   {
808     glViewport(x,y,width,height);
809   }
810
811   /* OpenGL ES 3.0 */
812
813   void ReadBuffer(GLenum mode)
814   {
815 #if DALI_GLES_VERSION >= 30
816     glReadBuffer(mode);
817 #endif // DALI_GLES_VERSION >= 30
818   }
819
820   void DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices)
821   {
822 #if DALI_GLES_VERSION >= 30
823     glDrawRangeElements(mode,start,end,count,type,indices);
824 #endif // DALI_GLES_VERSION >= 30
825   }
826
827   void TexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
828   {
829 #if DALI_GLES_VERSION >= 30
830     glTexImage3D(target,level,internalformat,width,height,depth,border,format,type,pixels);
831 #endif // DALI_GLES_VERSION >= 30
832   }
833
834   void TexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels)
835   {
836 #if DALI_GLES_VERSION >= 30
837     glTexSubImage3D(target,level,xoffset,yoffset,zoffset,width,height,depth,format,type,pixels);
838 #endif // DALI_GLES_VERSION >= 30
839   }
840
841   void CopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
842   {
843 #if DALI_GLES_VERSION >= 30
844     glCopyTexSubImage3D(target,level,xoffset,yoffset,zoffset,x,y,width,height);
845 #endif // DALI_GLES_VERSION >= 30
846   }
847
848   void CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
849   {
850 #if DALI_GLES_VERSION >= 30
851     glCompressedTexImage3D(target,level,internalformat,width,height,depth,border,imageSize,data);
852 #endif // DALI_GLES_VERSION >= 30
853   }
854
855   void CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data)
856   {
857 #if DALI_GLES_VERSION >= 30
858     glCompressedTexSubImage3D(target,level,xoffset,yoffset,zoffset,width,height,depth,format,imageSize,data);
859 #endif // DALI_GLES_VERSION >= 30
860   }
861
862   void GenQueries(GLsizei n, GLuint* ids)
863   {
864 #if DALI_GLES_VERSION >= 30
865     glGenQueries(n,ids);
866 #endif // DALI_GLES_VERSION >= 30
867   }
868
869   void DeleteQueries(GLsizei n, const GLuint* ids)
870   {
871 #if DALI_GLES_VERSION >= 30
872     glDeleteQueries(n,ids);
873 #endif // DALI_GLES_VERSION >= 30
874   }
875
876   GLboolean IsQuery(GLuint id)
877   {
878 #if DALI_GLES_VERSION >= 30
879     return glIsQuery(id);
880 #else
881     return 0;
882 #endif // DALI_GLES_VERSION >= 30
883   }
884
885   void BeginQuery(GLenum target, GLuint id)
886   {
887 #if DALI_GLES_VERSION >= 30
888     glBeginQuery(target,id);
889 #endif // DALI_GLES_VERSION >= 30
890   }
891
892   void EndQuery(GLenum target)
893   {
894 #if DALI_GLES_VERSION >= 30
895     glEndQuery(target);
896 #endif // DALI_GLES_VERSION >= 30
897   }
898
899   void GetQueryiv(GLenum target, GLenum pname, GLint* params)
900   {
901 #if DALI_GLES_VERSION >= 30
902     glGetQueryiv(target,pname,params);
903 #endif // DALI_GLES_VERSION >= 30
904   }
905
906   void GetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params)
907   {
908 #if DALI_GLES_VERSION >= 30
909     glGetQueryObjectuiv(id,pname,params);
910 #endif // DALI_GLES_VERSION >= 30
911   }
912
913   GLboolean UnmapBuffer(GLenum target)
914   {
915 #if DALI_GLES_VERSION >= 30
916     return glUnmapBuffer(target);
917 #else
918     return 0;
919 #endif // DALI_GLES_VERSION >= 30
920   }
921
922   void GetBufferPointerv(GLenum target, GLenum pname, GLvoid** params)
923   {
924 #if DALI_GLES_VERSION >= 30
925     glGetBufferPointerv(target,pname,params);
926 #endif // DALI_GLES_VERSION >= 30
927   }
928
929   void DrawBuffers(GLsizei n, const GLenum* bufs)
930   {
931 #if DALI_GLES_VERSION >= 30
932     glDrawBuffers(n,bufs);
933 #endif // DALI_GLES_VERSION >= 30
934   }
935
936   void UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
937   {
938 #if DALI_GLES_VERSION >= 30
939     glUniformMatrix2x3fv(location,count,transpose,value);
940 #endif // DALI_GLES_VERSION >= 30
941   }
942
943   void UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
944   {
945 #if DALI_GLES_VERSION >= 30
946     glUniformMatrix3x2fv(location,count,transpose,value);
947 #endif // DALI_GLES_VERSION >= 30
948   }
949
950   void UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
951   {
952 #if DALI_GLES_VERSION >= 30
953     glUniformMatrix2x4fv(location,count,transpose,value);
954 #endif // DALI_GLES_VERSION >= 30
955   }
956
957   void UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
958   {
959 #if DALI_GLES_VERSION >= 30
960     glUniformMatrix4x2fv(location,count,transpose,value);
961 #endif // DALI_GLES_VERSION >= 30
962   }
963
964   void UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
965   {
966 #if DALI_GLES_VERSION >= 30
967     glUniformMatrix3x4fv(location,count,transpose,value);
968 #endif // DALI_GLES_VERSION >= 30
969   }
970
971   void UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
972   {
973 #if DALI_GLES_VERSION >= 30
974     glUniformMatrix4x3fv(location,count,transpose,value);
975 #endif // DALI_GLES_VERSION >= 30
976   }
977
978   void BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
979   {
980 #if DALI_GLES_VERSION >= 30
981     glBlitFramebuffer(srcX0,srcY0,srcX1,srcY1,dstX0,dstY0,dstX1,dstY1,mask,filter);
982 #endif // DALI_GLES_VERSION >= 30
983   }
984
985   void RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
986   {
987 #if DALI_GLES_VERSION >= 30
988     glRenderbufferStorageMultisample(target,samples,internalformat,width,height);
989 #endif // DALI_GLES_VERSION >= 30
990   }
991
992   void FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
993   {
994 #if DALI_GLES_VERSION >= 30
995     glFramebufferTextureLayer(target,attachment,texture,level,layer);
996 #endif // DALI_GLES_VERSION >= 30
997   }
998
999   GLvoid* MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
1000   {
1001 #if DALI_GLES_VERSION >= 30
1002     return glMapBufferRange(target,offset,length,access);
1003 #else
1004     return NULL;
1005 #endif // DALI_GLES_VERSION >= 30
1006   }
1007
1008   void FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
1009   {
1010 #if DALI_GLES_VERSION >= 30
1011     glFlushMappedBufferRange(target,offset,length);
1012 #endif // DALI_GLES_VERSION >= 30
1013   }
1014
1015   void BindVertexArray(GLuint array)
1016   {
1017 #if DALI_GLES_VERSION >= 30
1018     glBindVertexArray(array);
1019 #endif // DALI_GLES_VERSION >= 30
1020   }
1021
1022   void DeleteVertexArrays(GLsizei n, const GLuint* arrays)
1023   {
1024 #if DALI_GLES_VERSION >= 30
1025     glDeleteVertexArrays(n,arrays);
1026 #endif // DALI_GLES_VERSION >= 30
1027   }
1028
1029   void GenVertexArrays(GLsizei n, GLuint* arrays)
1030   {
1031 #if DALI_GLES_VERSION >= 30
1032     glGenVertexArrays(n,arrays);
1033 #endif // DALI_GLES_VERSION >= 30
1034   }
1035
1036   GLboolean IsVertexArray(GLuint array)
1037   {
1038 #if DALI_GLES_VERSION >= 30
1039     return glIsVertexArray(array);
1040 #else
1041     return 0;
1042 #endif // DALI_GLES_VERSION >= 30
1043   }
1044
1045   void GetIntegeri_v(GLenum target, GLuint index, GLint* data)
1046   {
1047 #if DALI_GLES_VERSION >= 30
1048     glGetIntegeri_v(target,index,data);
1049 #endif // DALI_GLES_VERSION >= 30
1050   }
1051
1052   void BeginTransformFeedback(GLenum primitiveMode)
1053   {
1054 #if DALI_GLES_VERSION >= 30
1055     glBeginTransformFeedback(primitiveMode);
1056 #endif // DALI_GLES_VERSION >= 30
1057   }
1058
1059   void EndTransformFeedback(void)
1060   {
1061 #if DALI_GLES_VERSION >= 30
1062     glEndTransformFeedback();
1063 #endif // DALI_GLES_VERSION >= 30
1064   }
1065
1066   void BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
1067   {
1068 #if DALI_GLES_VERSION >= 30
1069     glBindBufferRange(target,index,buffer,offset,size);
1070 #endif // DALI_GLES_VERSION >= 30
1071   }
1072
1073   void BindBufferBase(GLenum target, GLuint index, GLuint buffer)
1074   {
1075 #if DALI_GLES_VERSION >= 30
1076     glBindBufferBase(target,index,buffer);
1077 #endif // DALI_GLES_VERSION >= 30
1078   }
1079
1080   void TransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode)
1081   {
1082 #if DALI_GLES_VERSION >= 30
1083     glTransformFeedbackVaryings(program,count,varyings,bufferMode);
1084 #endif // DALI_GLES_VERSION >= 30
1085   }
1086
1087   void GetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name)
1088   {
1089 #if DALI_GLES_VERSION >= 30
1090     glGetTransformFeedbackVarying(program,index,bufSize,length,size,type,name);
1091 #endif // DALI_GLES_VERSION >= 30
1092   }
1093
1094   void VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
1095   {
1096 #if DALI_GLES_VERSION >= 30
1097     glVertexAttribIPointer(index,size,type,stride,pointer);
1098 #endif // DALI_GLES_VERSION >= 30
1099   }
1100
1101   void GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params)
1102   {
1103 #if DALI_GLES_VERSION >= 30
1104     glGetVertexAttribIiv(index,pname,params);
1105 #endif // DALI_GLES_VERSION >= 30
1106   }
1107
1108   void GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params)
1109   {
1110 #if DALI_GLES_VERSION >= 30
1111     glGetVertexAttribIuiv(index,pname,params);
1112 #endif // DALI_GLES_VERSION >= 30
1113   }
1114
1115   void VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
1116   {
1117 #if DALI_GLES_VERSION >= 30
1118     glVertexAttribI4i(index,x,y,z,w);
1119 #endif // DALI_GLES_VERSION >= 30
1120   }
1121
1122   void VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
1123   {
1124 #if DALI_GLES_VERSION >= 30
1125     glVertexAttribI4ui(index,x,y,z,w);
1126 #endif // DALI_GLES_VERSION >= 30
1127   }
1128
1129   void VertexAttribI4iv(GLuint index, const GLint* v)
1130   {
1131 #if DALI_GLES_VERSION >= 30
1132     glVertexAttribI4iv(index,v);
1133 #endif // DALI_GLES_VERSION >= 30
1134   }
1135
1136   void VertexAttribI4uiv(GLuint index, const GLuint* v)
1137   {
1138 #if DALI_GLES_VERSION >= 30
1139     glVertexAttribI4uiv(index,v);
1140 #endif // DALI_GLES_VERSION >= 30
1141   }
1142
1143   void GetUniformuiv(GLuint program, GLint location, GLuint* params)
1144   {
1145 #if DALI_GLES_VERSION >= 30
1146     glGetUniformuiv(program,location,params);
1147 #endif // DALI_GLES_VERSION >= 30
1148   }
1149
1150   GLint GetFragDataLocation(GLuint program, const GLchar *name)
1151   {
1152 #if DALI_GLES_VERSION >= 30
1153     return glGetFragDataLocation(program,name);
1154 #else
1155     return -1;
1156 #endif // DALI_GLES_VERSION >= 30
1157   }
1158
1159   void Uniform1ui(GLint location, GLuint v0)
1160   {
1161 #if DALI_GLES_VERSION >= 30
1162     glUniform1ui(location,v0);
1163 #endif // DALI_GLES_VERSION >= 30
1164   }
1165
1166   void Uniform2ui(GLint location, GLuint v0, GLuint v1)
1167   {
1168 #if DALI_GLES_VERSION >= 30
1169     glUniform2ui(location,v0,v1);
1170 #endif // DALI_GLES_VERSION >= 30
1171   }
1172
1173   void Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
1174   {
1175 #if DALI_GLES_VERSION >= 30
1176     glUniform3ui(location,v0,v1,v2);
1177 #endif // DALI_GLES_VERSION >= 30
1178   }
1179
1180   void Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
1181   {
1182 #if DALI_GLES_VERSION >= 30
1183     glUniform4ui(location,v0,v1,v2,v3);
1184 #endif // DALI_GLES_VERSION >= 30
1185   }
1186
1187   void Uniform1uiv(GLint location, GLsizei count, const GLuint* value)
1188   {
1189 #if DALI_GLES_VERSION >= 30
1190     glUniform1uiv(location,count,value);
1191 #endif // DALI_GLES_VERSION >= 30
1192   }
1193
1194   void Uniform2uiv(GLint location, GLsizei count, const GLuint* value)
1195   {
1196 #if DALI_GLES_VERSION >= 30
1197     glUniform2uiv(location,count,value);
1198 #endif // DALI_GLES_VERSION >= 30
1199   }
1200
1201   void Uniform3uiv(GLint location, GLsizei count, const GLuint* value)
1202   {
1203 #if DALI_GLES_VERSION >= 30
1204     glUniform3uiv(location,count,value);
1205 #endif // DALI_GLES_VERSION >= 30
1206   }
1207
1208   void Uniform4uiv(GLint location, GLsizei count, const GLuint* value)
1209   {
1210 #if DALI_GLES_VERSION >= 30
1211     glUniform4uiv(location,count,value);
1212 #endif // DALI_GLES_VERSION >= 30
1213   }
1214
1215   void ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value)
1216   {
1217 #if DALI_GLES_VERSION >= 30
1218     glClearBufferiv(buffer,drawbuffer,value);
1219 #endif // DALI_GLES_VERSION >= 30
1220   }
1221
1222   void ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value)
1223   {
1224 #if DALI_GLES_VERSION >= 30
1225     glClearBufferuiv(buffer,drawbuffer,value);
1226 #endif // DALI_GLES_VERSION >= 30
1227   }
1228
1229   void ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value)
1230   {
1231 #if DALI_GLES_VERSION >= 30
1232     glClearBufferfv(buffer,drawbuffer,value);
1233 #endif // DALI_GLES_VERSION >= 30
1234   }
1235
1236   void ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
1237   {
1238 #if DALI_GLES_VERSION >= 30
1239     glClearBufferfi(buffer,drawbuffer,depth,stencil);
1240 #endif // DALI_GLES_VERSION >= 30
1241   }
1242
1243   const GLubyte* GetStringi(GLenum name, GLuint index)
1244   {
1245 #if DALI_GLES_VERSION >= 30
1246     return glGetStringi(name,index);
1247 #else
1248     return NULL;
1249 #endif // DALI_GLES_VERSION >= 30
1250   }
1251
1252   void CopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
1253   {
1254 #if DALI_GLES_VERSION >= 30
1255     glCopyBufferSubData(readTarget,writeTarget,readOffset,writeOffset,size);
1256 #endif // DALI_GLES_VERSION >= 30
1257   }
1258
1259   void GetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices)
1260   {
1261 #if DALI_GLES_VERSION >= 30
1262     glGetUniformIndices(program,uniformCount,uniformNames,uniformIndices);
1263 #endif // DALI_GLES_VERSION >= 30
1264   }
1265
1266   void GetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params)
1267   {
1268 #if DALI_GLES_VERSION >= 30
1269     glGetActiveUniformsiv(program,uniformCount,uniformIndices,pname,params);
1270 #endif // DALI_GLES_VERSION >= 30
1271   }
1272
1273   GLuint GetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName)
1274   {
1275 #if DALI_GLES_VERSION >= 30
1276     return glGetUniformBlockIndex(program,uniformBlockName);
1277 #else
1278     return 0;
1279 #endif // DALI_GLES_VERSION >= 30
1280   }
1281
1282   void GetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params)
1283   {
1284 #if DALI_GLES_VERSION >= 30
1285     glGetActiveUniformBlockiv(program,uniformBlockIndex,pname,params);
1286 #endif // DALI_GLES_VERSION >= 30
1287   }
1288
1289   void GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName)
1290   {
1291 #if DALI_GLES_VERSION >= 30
1292     glGetActiveUniformBlockName(program,uniformBlockIndex,bufSize,length,uniformBlockName);
1293 #endif // DALI_GLES_VERSION >= 30
1294   }
1295
1296   void UniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
1297   {
1298 #if DALI_GLES_VERSION >= 30
1299     glUniformBlockBinding(program,uniformBlockIndex,uniformBlockBinding);
1300 #endif // DALI_GLES_VERSION >= 30
1301   }
1302
1303   void DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
1304   {
1305 #if DALI_GLES_VERSION >= 30
1306     glDrawArraysInstanced(mode,first,count,instanceCount);
1307 #endif // DALI_GLES_VERSION >= 30
1308   }
1309
1310   void DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount)
1311   {
1312 #if DALI_GLES_VERSION >= 30
1313     glDrawElementsInstanced(mode,count,type,indices,instanceCount);
1314 #endif // DALI_GLES_VERSION >= 30
1315   }
1316
1317   GLsync FenceSync(GLenum condition, GLbitfield flags)
1318   {
1319 #if DALI_GLES_VERSION >= 30
1320     return glFenceSync(condition,flags);
1321 #else
1322     return NULL;
1323 #endif // DALI_GLES_VERSION >= 30
1324   }
1325
1326   GLboolean IsSync(GLsync sync)
1327   {
1328 #if DALI_GLES_VERSION >= 30
1329     return glIsSync(sync);
1330 #else
1331     return 0;
1332 #endif // DALI_GLES_VERSION >= 30
1333   }
1334
1335   void DeleteSync(GLsync sync)
1336   {
1337 #if DALI_GLES_VERSION >= 30
1338     glDeleteSync(sync);
1339 #endif // DALI_GLES_VERSION >= 30
1340   }
1341
1342   GLenum ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
1343   {
1344 #if DALI_GLES_VERSION >= 30
1345     return glClientWaitSync(sync,flags,timeout);
1346 #else
1347     return 0;
1348 #endif // DALI_GLES_VERSION >= 30
1349   }
1350
1351   void WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
1352   {
1353 #if DALI_GLES_VERSION >= 30
1354     glWaitSync(sync,flags,timeout);
1355 #endif // DALI_GLES_VERSION >= 30
1356   }
1357
1358   void GetInteger64v(GLenum pname, GLint64* params)
1359   {
1360 #if DALI_GLES_VERSION >= 30
1361     glGetInteger64v(pname,params);
1362 #endif // DALI_GLES_VERSION >= 30
1363   }
1364
1365   void GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values)
1366   {
1367 #if DALI_GLES_VERSION >= 30
1368     glGetSynciv(sync,pname,bufSize,length,values);
1369 #endif // DALI_GLES_VERSION >= 30
1370   }
1371
1372   void GetInteger64i_v(GLenum target, GLuint index, GLint64* data)
1373   {
1374 #if DALI_GLES_VERSION >= 30
1375     glGetInteger64i_v(target,index,data);
1376 #endif // DALI_GLES_VERSION >= 30
1377   }
1378
1379   void GetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params)
1380   {
1381 #if DALI_GLES_VERSION >= 30
1382     glGetBufferParameteri64v(target,pname,params);
1383 #endif // DALI_GLES_VERSION >= 30
1384   }
1385
1386   void GenSamplers(GLsizei count, GLuint* samplers)
1387   {
1388 #if DALI_GLES_VERSION >= 30
1389     glGenSamplers(count,samplers);
1390 #endif // DALI_GLES_VERSION >= 30
1391   }
1392
1393   void DeleteSamplers(GLsizei count, const GLuint* samplers)
1394   {
1395 #if DALI_GLES_VERSION >= 30
1396     glDeleteSamplers(count,samplers);
1397 #endif // DALI_GLES_VERSION >= 30
1398   }
1399
1400   GLboolean IsSampler(GLuint sampler)
1401   {
1402 #if DALI_GLES_VERSION >= 30
1403     return glIsSampler(sampler);
1404 #else
1405     return 0;
1406 #endif // DALI_GLES_VERSION >= 30
1407   }
1408
1409   void BindSampler(GLuint unit, GLuint sampler)
1410   {
1411 #if DALI_GLES_VERSION >= 30
1412     glBindSampler(unit,sampler);
1413 #endif // DALI_GLES_VERSION >= 30
1414   }
1415
1416   void SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
1417   {
1418 #if DALI_GLES_VERSION >= 30
1419     glSamplerParameteri(sampler,pname,param);
1420 #endif // DALI_GLES_VERSION >= 30
1421   }
1422
1423   void SamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param)
1424   {
1425 #if DALI_GLES_VERSION >= 30
1426     glSamplerParameteriv(sampler,pname,param);
1427 #endif // DALI_GLES_VERSION >= 30
1428   }
1429
1430   void SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
1431   {
1432 #if DALI_GLES_VERSION >= 30
1433     glSamplerParameterf(sampler,pname,param);
1434 #endif // DALI_GLES_VERSION >= 30
1435   }
1436
1437   void SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param)
1438   {
1439 #if DALI_GLES_VERSION >= 30
1440     glSamplerParameterfv(sampler,pname,param);
1441 #endif // DALI_GLES_VERSION >= 30
1442   }
1443
1444   void GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params)
1445   {
1446 #if DALI_GLES_VERSION >= 30
1447     glGetSamplerParameteriv(sampler,pname,params);
1448 #endif // DALI_GLES_VERSION >= 30
1449   }
1450
1451   void GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params)
1452   {
1453 #if DALI_GLES_VERSION >= 30
1454     glGetSamplerParameterfv(sampler,pname,params);
1455 #endif // DALI_GLES_VERSION >= 30
1456   }
1457
1458   void VertexAttribDivisor(GLuint index, GLuint divisor)
1459   {
1460 #if DALI_GLES_VERSION >= 30
1461     glVertexAttribDivisor(index,divisor);
1462 #endif // DALI_GLES_VERSION >= 30
1463   }
1464
1465   void BindTransformFeedback(GLenum target, GLuint id)
1466   {
1467 #if DALI_GLES_VERSION >= 30
1468     glBindTransformFeedback(target,id);
1469 #endif // DALI_GLES_VERSION >= 30
1470   }
1471
1472   void DeleteTransformFeedbacks(GLsizei n, const GLuint* ids)
1473   {
1474 #if DALI_GLES_VERSION >= 30
1475     glDeleteTransformFeedbacks(n,ids);
1476 #endif // DALI_GLES_VERSION >= 30
1477   }
1478
1479   void GenTransformFeedbacks(GLsizei n, GLuint* ids)
1480   {
1481 #if DALI_GLES_VERSION >= 30
1482     glGenTransformFeedbacks(n,ids);
1483 #endif // DALI_GLES_VERSION >= 30
1484   }
1485
1486   GLboolean IsTransformFeedback(GLuint id)
1487   {
1488 #if DALI_GLES_VERSION >= 30
1489     return glIsTransformFeedback(id);
1490 #else
1491     return 0;
1492 #endif // DALI_GLES_VERSION >= 30
1493   }
1494
1495   void PauseTransformFeedback(void)
1496   {
1497 #if DALI_GLES_VERSION >= 30
1498     glPauseTransformFeedback();
1499 #endif // DALI_GLES_VERSION >= 30
1500   }
1501
1502   void ResumeTransformFeedback(void)
1503   {
1504 #if DALI_GLES_VERSION >= 30
1505     glResumeTransformFeedback();
1506 #endif // DALI_GLES_VERSION >= 30
1507   }
1508
1509   void GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary)
1510   {
1511 #if DALI_GLES_VERSION >= 30
1512     // if OpenGL ES 2.0 compatibility is need this can be implemented with
1513     // glGetProgramBinaryOES
1514     glGetProgramBinary(program,bufSize,length,binaryFormat,binary);
1515 #else
1516     mGlExtensions.GetProgramBinaryOES(program, bufSize, length, binaryFormat, binary);
1517 #endif // DALI_GLES_VERSION >= 30
1518   }
1519
1520   void ProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length)
1521   {
1522 #if DALI_GLES_VERSION >= 30
1523     // if OpenGL ES 2.0 compatibility is need this can be implemented with
1524     // glProgramBinaryOES
1525     glProgramBinary(program,binaryFormat,binary,length);
1526 #else
1527     mGlExtensions.ProgramBinaryOES(program, binaryFormat, binary, length);
1528 #endif // DALI_GLES_VERSION >= 30
1529   }
1530
1531   void ProgramParameteri(GLuint program, GLenum pname, GLint value)
1532   {
1533 #if DALI_GLES_VERSION >= 30
1534     glProgramParameteri(program,pname,value);
1535 #endif // DALI_GLES_VERSION >= 30
1536   }
1537
1538   void InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments)
1539   {
1540 #if DALI_GLES_VERSION >= 30
1541     glInvalidateFramebuffer(target,numAttachments,attachments);
1542 #else
1543     mGlExtensions.DiscardFrameBuffer(target, numAttachments, attachments);
1544 #endif // DALI_GLES_VERSION >= 30
1545   }
1546
1547   void InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height)
1548   {
1549 #if DALI_GLES_VERSION >= 30
1550     glInvalidateSubFramebuffer(target,numAttachments,attachments,x,y,width,height);
1551 #endif // DALI_GLES_VERSION >= 30
1552   }
1553
1554   void TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
1555   {
1556 #if DALI_GLES_VERSION >= 30
1557     glTexStorage2D(target,levels,internalformat,width,height);
1558 #endif // DALI_GLES_VERSION >= 30
1559   }
1560
1561   void TexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
1562   {
1563 #if DALI_GLES_VERSION >= 30
1564     glTexStorage3D(target,levels,internalformat,width,height,depth);
1565 #endif // DALI_GLES_VERSION >= 30
1566   }
1567
1568   void GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params)
1569   {
1570 #if DALI_GLES_VERSION >= 30
1571     glGetInternalformativ(target,internalformat,pname,bufSize,params);
1572 #endif // DALI_GLES_VERSION >= 30
1573   }
1574
1575 private:
1576   ECoreX::GlExtensions mGlExtensions;
1577
1578 };
1579
1580 } // namespace Adaptor
1581
1582 } // namespace Internal
1583
1584 } // namespace Dali
1585
1586 #endif // __DALI_INTERNAL_GL_IMPLEMENTATION_H__