djsollen@google.com | e32b583 | 2011-06-13 16:58:40 +0000 | [diff] [blame] | 1 | // Modified from chromium/src/webkit/glue/gl_bindings_skia_cmd_buffer.cc |
| 2 | |
| 3 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 4 | // Use of this source code is governed by a BSD-style license that can be |
| 5 | // found in the LICENSE file. |
| 6 | |
| 7 | #include "GrGLInterface.h" |
| 8 | |
| 9 | #ifndef GL_GLEXT_PROTOTYPES |
| 10 | #define GL_GLEXT_PROTOTYPES |
| 11 | #endif |
| 12 | |
bsalomon@google.com | 6defc04 | 2011-09-06 21:04:36 +0000 | [diff] [blame^] | 13 | #include <GLES2/gl2.h> |
| 14 | #include <GLES2/gl2ext.h> |
bsalomon@google.com | 0b77d68 | 2011-08-19 13:28:54 +0000 | [diff] [blame] | 15 | |
| 16 | void GrGLInitializeDefaultGLInterface() { |
bsalomon@google.com | 6defc04 | 2011-09-06 21:04:36 +0000 | [diff] [blame^] | 17 | GrGLInterface* glInterface = new GrGLInterface; |
bsalomon@google.com | 0b77d68 | 2011-08-19 13:28:54 +0000 | [diff] [blame] | 18 | |
| 19 | glInterface->fBindingsExported = kES2_GrGLBinding; |
| 20 | glInterface->fActiveTexture = glActiveTexture; |
| 21 | glInterface->fAttachShader = glAttachShader; |
| 22 | glInterface->fBindAttribLocation = glBindAttribLocation; |
| 23 | glInterface->fBindBuffer = glBindBuffer; |
| 24 | glInterface->fBindTexture = glBindTexture; |
| 25 | glInterface->fBlendColor = glBlendColor; |
| 26 | glInterface->fBlendFunc = glBlendFunc; |
| 27 | glInterface->fBufferData = glBufferData; |
| 28 | glInterface->fBufferSubData = glBufferSubData; |
| 29 | glInterface->fClear = glClear; |
| 30 | glInterface->fClearColor = glClearColor; |
| 31 | glInterface->fClearStencil = glClearStencil; |
| 32 | glInterface->fColorMask = glColorMask; |
| 33 | glInterface->fCompileShader = glCompileShader; |
| 34 | glInterface->fCompressedTexImage2D = glCompressedTexImage2D; |
| 35 | glInterface->fCreateProgram = glCreateProgram; |
| 36 | glInterface->fCreateShader = glCreateShader; |
| 37 | glInterface->fCullFace = glCullFace; |
| 38 | glInterface->fDeleteBuffers = glDeleteBuffers; |
| 39 | glInterface->fDeleteProgram = glDeleteProgram; |
| 40 | glInterface->fDeleteShader = glDeleteShader; |
| 41 | glInterface->fDeleteTextures = glDeleteTextures; |
| 42 | glInterface->fDepthMask = glDepthMask; |
| 43 | glInterface->fDisable = glDisable; |
| 44 | glInterface->fDisableVertexAttribArray = glDisableVertexAttribArray; |
| 45 | glInterface->fDrawArrays = glDrawArrays; |
| 46 | glInterface->fDrawElements = glDrawElements; |
| 47 | glInterface->fEnable = glEnable; |
| 48 | glInterface->fEnableVertexAttribArray = glEnableVertexAttribArray; |
| 49 | glInterface->fFrontFace = glFrontFace; |
| 50 | glInterface->fGenBuffers = glGenBuffers; |
| 51 | glInterface->fGenTextures = glGenTextures; |
| 52 | glInterface->fGetBufferParameteriv = glGetBufferParameteriv; |
| 53 | glInterface->fGetError = glGetError; |
| 54 | glInterface->fGetIntegerv = glGetIntegerv; |
| 55 | glInterface->fGetProgramInfoLog = glGetProgramInfoLog; |
| 56 | glInterface->fGetProgramiv = glGetProgramiv; |
| 57 | glInterface->fGetShaderInfoLog = glGetShaderInfoLog; |
| 58 | glInterface->fGetShaderiv = glGetShaderiv; |
| 59 | glInterface->fGetString = glGetString; |
| 60 | glInterface->fGetUniformLocation = glGetUniformLocation; |
| 61 | glInterface->fLineWidth = glLineWidth; |
| 62 | glInterface->fLinkProgram = glLinkProgram; |
| 63 | glInterface->fPixelStorei = glPixelStorei; |
| 64 | glInterface->fReadPixels = glReadPixels; |
| 65 | glInterface->fScissor = glScissor; |
| 66 | glInterface->fShaderSource = glShaderSource; |
| 67 | glInterface->fStencilFunc = glStencilFunc; |
| 68 | glInterface->fStencilFuncSeparate = glStencilFuncSeparate; |
| 69 | glInterface->fStencilMask = glStencilMask; |
| 70 | glInterface->fStencilMaskSeparate = glStencilMaskSeparate; |
| 71 | glInterface->fStencilOp = glStencilOp; |
| 72 | glInterface->fStencilOpSeparate = glStencilOpSeparate; |
| 73 | glInterface->fTexImage2D = glTexImage2D; |
| 74 | glInterface->fTexParameteri = glTexParameteri; |
| 75 | glInterface->fTexSubImage2D = glTexSubImage2D; |
| 76 | glInterface->fUniform1f = glUniform1f; |
| 77 | glInterface->fUniform1i = glUniform1i; |
| 78 | glInterface->fUniform1fv = glUniform1fv; |
| 79 | glInterface->fUniform1iv = glUniform1iv; |
| 80 | glInterface->fUniform2f = glUniform2f; |
| 81 | glInterface->fUniform2i = glUniform2i; |
| 82 | glInterface->fUniform2fv = glUniform2fv; |
| 83 | glInterface->fUniform2iv = glUniform2iv; |
| 84 | glInterface->fUniform3f = glUniform3f; |
| 85 | glInterface->fUniform3i = glUniform3i; |
| 86 | glInterface->fUniform3fv = glUniform3fv; |
| 87 | glInterface->fUniform3iv = glUniform3iv; |
| 88 | glInterface->fUniform4f = glUniform4f; |
| 89 | glInterface->fUniform4i = glUniform4i; |
| 90 | glInterface->fUniform4fv = glUniform4fv; |
| 91 | glInterface->fUniform4iv = glUniform4iv; |
| 92 | glInterface->fUniformMatrix2fv = glUniformMatrix2fv; |
| 93 | glInterface->fUniformMatrix3fv = glUniformMatrix3fv; |
| 94 | glInterface->fUniformMatrix4fv = glUniformMatrix4fv; |
| 95 | glInterface->fUseProgram = glUseProgram; |
| 96 | glInterface->fVertexAttrib4fv = glVertexAttrib4fv; |
| 97 | glInterface->fVertexAttribPointer = glVertexAttribPointer; |
| 98 | glInterface->fViewport = glViewport; |
| 99 | glInterface->fBindFramebuffer = glBindFramebuffer; |
| 100 | glInterface->fBindRenderbuffer = glBindRenderbuffer; |
| 101 | glInterface->fCheckFramebufferStatus = glCheckFramebufferStatus; |
| 102 | glInterface->fDeleteFramebuffers = glDeleteFramebuffers; |
| 103 | glInterface->fDeleteRenderbuffers = glDeleteRenderbuffers; |
| 104 | glInterface->fFramebufferRenderbuffer = glFramebufferRenderbuffer; |
| 105 | glInterface->fFramebufferTexture2D = glFramebufferTexture2D; |
| 106 | glInterface->fGenFramebuffers = glGenFramebuffers; |
| 107 | glInterface->fGenRenderbuffers = glGenRenderbuffers; |
| 108 | glInterface->fGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameteriv; |
| 109 | glInterface->fGetRenderbufferParameteriv = glGetRenderbufferParameteriv; |
| 110 | glInterface->fRenderbufferStorage = glRenderbufferStorage; |
bsalomon@google.com | 6defc04 | 2011-09-06 21:04:36 +0000 | [diff] [blame^] | 111 | #if GL_OES_mapbuffer |
| 112 | glInterface->fMapBuffer = glMapBufferOES; |
| 113 | glInterface->fUnmapBuffer = glUnmapBufferOES; |
| 114 | #endif |
| 115 | GrGLSetDefaultGLInterface(glInterface)->unref(); |
djsollen@google.com | e32b583 | 2011-06-13 16:58:40 +0000 | [diff] [blame] | 116 | } |