aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-05-01 11:42:19 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-05-01 11:42:19 -0700
commit3f554a5321867cf61588a111c80048399269f3ad (patch)
treebeb34a32355e6bedd56646eec2236f081ae1acd2
parent4e0abd190f62c3593ca130f684b5aa6d0e87e69b (diff)
parentac20257d788dcecf991df2caa964008dc9a047c3 (diff)
Merge pull request #1117 from rib/wip/cogl
Enable simple Cogl based apps by fixing some SDL_GL_GetProcAddress issues
-rw-r--r--AUTHORS3
-rw-r--r--src/library_gl.js111
-rw-r--r--tools/shared.py3
3 files changed, 114 insertions, 3 deletions
diff --git a/AUTHORS b/AUTHORS
index f0055f2e..43ea83dd 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -68,4 +68,5 @@ a license to everyone to use it as detailed in LICENSE.)
* Llorens Marti Garcia <lgarcia@imvu.com> (copyright owned by IMVU)
* Jinsuck Kim <jkim@imvu.com> (copyright owned by IMVU)
* Todd Lee <tlee@imvu.com> (copyright owned by IMVU)
-* Anthony Pesch <inolen@gmail.com> \ No newline at end of file
+* Anthony Pesch <inolen@gmail.com>
+* Robert Bragg <robert.bragg@intel.com> (copyright owned by Intel Corporation)
diff --git a/src/library_gl.js b/src/library_gl.js
index 33aadb4b..ae492f6f 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -583,6 +583,16 @@ var LibraryGL = {
{{{ makeSetValue('params', '0', 'Module.getTexParameter(target, pname)', 'i32') }}};
},
+ glTexParameterfv: function(target, pname, params) {
+ var param = {{{ makeGetValue('params', '0', 'float') }}};
+ Module.ctx.texParameterf(target, pname, param);
+ },
+
+ glTexParameteriv: function(target, pname, params) {
+ var param = {{{ makeGetValue('params', '0', 'i32') }}};
+ Module.ctx.texParameteri(target, pname, param);
+ },
+
glIsTexture: function(texture) {
var texture = GL.textures[texture];
if (!texture) return 0;
@@ -1697,6 +1707,19 @@ var LibraryGL = {
case 'glEnableVertexAttribArray': ret = {{{ Functions.getIndex('_glEnableVertexAttribArray', true) }}}; break;
case 'glDisableVertexAttribArray': ret = {{{ Functions.getIndex('_glDisableVertexAttribArray', true) }}}; break;
case 'glVertexAttribPointer': ret = {{{ Functions.getIndex('_glVertexAttribPointer', true) }}}; break;
+ case 'glVertexAttrib1f': ret = {{{ Functions.getIndex('_glVertexAttrib1f', true) }}}; break;
+ case 'glVertexAttrib2f': ret = {{{ Functions.getIndex('_glVertexAttrib2f', true) }}}; break;
+ case 'glVertexAttrib3f': ret = {{{ Functions.getIndex('_glVertexAttrib3f', true) }}}; break;
+ case 'glVertexAttrib4f': ret = {{{ Functions.getIndex('_glVertexAttrib4f', true) }}}; break;
+ case 'glVertexAttrib1fv': ret = {{{ Functions.getIndex('_glVertexAttrib1fv', true) }}}; break;
+ case 'glVertexAttrib2fv': ret = {{{ Functions.getIndex('_glVertexAttrib2fv', true) }}}; break;
+ case 'glVertexAttrib3fv': ret = {{{ Functions.getIndex('_glVertexAttrib3fv', true) }}}; break;
+ case 'glVertexAttrib4fv': ret = {{{ Functions.getIndex('_glVertexAttrib4fv', true) }}}; break;
+ case 'glGetVertexAttribfv': ret = {{{ Functions.getIndex('_glGetVertexAttribfv', true) }}}; break;
+ case 'glGetVertexAttribiv': ret = {{{ Functions.getIndex('_glGetVertexAttribiv', true) }}}; break;
+ case 'glGetVertexAttribPointerv': ret = {{{ Functions.getIndex('_glGetVertexAttribPointerv', true) }}}; break;
+ case 'glGetAttribLocation': ret = {{{ Functions.getIndex('_glGetAttribLocation', true) }}}; break;
+ case 'glGetActiveAttrib': ret = {{{ Functions.getIndex('_glGetActiveAttrib', true) }}}; break;
case 'glBindRenderbuffer': ret = {{{ Functions.getIndex('_glBindRenderbuffer', true) }}}; break;
case 'glDeleteRenderbuffers': ret = {{{ Functions.getIndex('_glDeleteRenderbuffers', true) }}}; break;
case 'glGenRenderbuffers': ret = {{{ Functions.getIndex('_glGenRenderbuffers', true) }}}; break;
@@ -1714,12 +1737,94 @@ var LibraryGL = {
case 'glGenVertexArrays': ret = {{{ Functions.getIndex('_glGenVertexArrays', true) }}}; break;
case 'glDeleteVertexArrays': ret = {{{ Functions.getIndex('_glDeleteVertexArrays', true) }}}; break;
case 'glBindVertexArray': ret = {{{ Functions.getIndex('_glBindVertexArray', true) }}}; break;
+ case 'glGetString': ret = {{{ Functions.getIndex('_glGetString', true) }}}; break;
+ case 'glBindTexture': ret = {{{ Functions.getIndex('_glBindTexture', true) }}}; break;
+ case 'glGetBufferParameteriv': ret = {{{ Functions.getIndex('_glGetBufferParameteriv', true) }}}; break;
+ case 'glIsBuffer': ret = {{{ Functions.getIndex('_glIsBuffer', true) }}}; break;
+ case 'glDeleteShader': ret = {{{ Functions.getIndex('_glDeleteShader', true) }}}; break;
+ case 'glUniformMatrix2fv': ret = {{{ Functions.getIndex('_glUniformMatrix2fv', true) }}}; break;
+ case 'glIsRenderbuffer': ret = {{{ Functions.getIndex('_glIsRenderbuffer', true) }}}; break;
+ case 'glBlendEquation': ret = {{{ Functions.getIndex('_glBlendEquation', true) }}}; break;
+ case 'glBlendFunc': ret = {{{ Functions.getIndex('_glBlendFunc', true) }}}; break;
+ case 'glBlendFuncSeparate': ret = {{{ Functions.getIndex('_glBlendFuncSeparate', true) }}}; break;
+ case 'glBlendEquationSeparate': ret = {{{ Functions.getIndex('_glBlendEquationSeparate', true) }}}; break;
+ case 'glDepthRangef': ret = {{{ Functions.getIndex('_glDepthRangef', true) }}}; break;
+ case 'glClear': ret = {{{ Functions.getIndex('_glClear', true) }}}; break;
+ case 'glGenerateMipmap': ret = {{{ Functions.getIndex('_glGenerateMipmap', true) }}}; break;
+ case 'glBlendColor': ret = {{{ Functions.getIndex('_glBlendColor', true) }}}; break;
+ case 'glClearDepthf': ret = {{{ Functions.getIndex('_glClearDepthf', true) }}}; break;
+ case 'glDeleteProgram': ret = {{{ Functions.getIndex('_glDeleteProgram', true) }}}; break;
+ case 'glUniformMatrix3fv': ret = {{{ Functions.getIndex('_glUniformMatrix3fv', true) }}}; break;
+ case 'glClearColor': ret = {{{ Functions.getIndex('_glClearColor', true) }}}; break;
+ case 'glGetRenderbufferParameteriv': ret = {{{ Functions.getIndex('_glGetRenderbufferParameteriv', true) }}}; break;
+ case 'glGetShaderInfoLog': ret = {{{ Functions.getIndex('_glGetShaderInfoLog', true) }}}; break;
+ case 'glUniformMatrix4fv': ret = {{{ Functions.getIndex('_glUniformMatrix4fv', true) }}}; break;
+ case 'glClearStencil': ret = {{{ Functions.getIndex('_glClearStencil', true) }}}; break;
+ case 'glGetProgramInfoLog': ret = {{{ Functions.getIndex('_glGetProgramInfoLog', true) }}}; break;
+ case 'glGetUniformfv': ret = {{{ Functions.getIndex('_glGetUniformfv', true) }}}; break;
+ case 'glStencilFuncSeparate': ret = {{{ Functions.getIndex('_glStencilFuncSeparate', true) }}}; break;
+ case 'glSampleCoverage': ret = {{{ Functions.getIndex('_glSampleCoverage', true) }}}; break;
+ case 'glColorMask': ret = {{{ Functions.getIndex('_glColorMask', true) }}}; break;
+ case 'glGetShaderiv': ret = {{{ Functions.getIndex('_glGetShaderiv', true) }}}; break;
+ case 'glGetUniformiv': ret = {{{ Functions.getIndex('_glGetUniformiv', true) }}}; break;
+ case 'glCopyTexSubImage2D': ret = {{{ Functions.getIndex('_glCopyTexSubImage2D', true) }}}; break;
+ case 'glDetachShader': ret = {{{ Functions.getIndex('_glDetachShader', true) }}}; break;
+ case 'glGetShaderSource': ret = {{{ Functions.getIndex('_glGetShaderSource', true) }}}; break;
+ case 'glDeleteTextures': ret = {{{ Functions.getIndex('_glDeleteTextures', true) }}}; break;
+ case 'glGetAttachedShaders': ret = {{{ Functions.getIndex('_glGetAttachedShaders', true) }}}; break;
+ case 'glValidateProgram': ret = {{{ Functions.getIndex('_glValidateProgram', true) }}}; break;
+ case 'glDepthFunc': ret = {{{ Functions.getIndex('_glDepthFunc', true) }}}; break;
+ case 'glIsShader': ret = {{{ Functions.getIndex('_glIsShader', true) }}}; break;
+ case 'glDepthMask': ret = {{{ Functions.getIndex('_glDepthMask', true) }}}; break;
+ case 'glStencilMaskSeparate': ret = {{{ Functions.getIndex('_glStencilMaskSeparate', true) }}}; break;
+ case 'glIsProgram': ret = {{{ Functions.getIndex('_glIsProgram', true) }}}; break;
+ case 'glDisable': ret = {{{ Functions.getIndex('_glDisable', true) }}}; break;
+ case 'glStencilOpSeparate': ret = {{{ Functions.getIndex('_glStencilOpSeparate', true) }}}; break;
+ case 'glDrawArrays': ret = {{{ Functions.getIndex('_glDrawArrays', true) }}}; break;
+ case 'glDrawElements': ret = {{{ Functions.getIndex('_glDrawElements', true) }}}; break;
+ case 'glEnable': ret = {{{ Functions.getIndex('_glEnable', true) }}}; break;
+ case 'glFinish': ret = {{{ Functions.getIndex('_glFinish', true) }}}; break;
+ case 'glFlush': ret = {{{ Functions.getIndex('_glFlush', true) }}}; break;
+ case 'glFrontFace': ret = {{{ Functions.getIndex('_glFrontFace', true) }}}; break;
+ case 'glCullFace': ret = {{{ Functions.getIndex('_glCullFace', true) }}}; break;
+ case 'glGenTextures': ret = {{{ Functions.getIndex('_glGenTextures', true) }}}; break;
+ case 'glGetError': ret = {{{ Functions.getIndex('_glGetError', true) }}}; break;
+ case 'glGetIntegerv': ret = {{{ Functions.getIndex('_glGetIntegerv', true) }}}; break;
+ case 'glGetBooleanv': ret = {{{ Functions.getIndex('_glGetBooleanv', true) }}}; break;
+ case 'glGetFloatv': ret = {{{ Functions.getIndex('_glGetFloatv', true) }}}; break;
+ case 'glHint': ret = {{{ Functions.getIndex('_glHint', true) }}}; break;
+ case 'glIsTexture': ret = {{{ Functions.getIndex('_glIsTexture', true) }}}; break;
+ case 'glPixelStorei': ret = {{{ Functions.getIndex('_glPixelStorei', true) }}}; break;
+ case 'glReadPixels': ret = {{{ Functions.getIndex('_glReadPixels', true) }}}; break;
+ case 'glScissor': ret = {{{ Functions.getIndex('_glScissor', true) }}}; break;
+ case 'glStencilFunc': ret = {{{ Functions.getIndex('_glStencilFunc', true) }}}; break;
+ case 'glStencilMask': ret = {{{ Functions.getIndex('_glStencilMask', true) }}}; break;
+ case 'glStencilOp': ret = {{{ Functions.getIndex('_glStencilOp', true) }}}; break;
+ case 'glTexImage2D': ret = {{{ Functions.getIndex('_glTexImage2D', true) }}}; break;
+ case 'glTexParameterf': ret = {{{ Functions.getIndex('_glTexParameterf', true) }}}; break;
+ case 'glTexParameterfv': ret = {{{ Functions.getIndex('_glTexParameterfv', true) }}}; break;
+ case 'glTexParameteri': ret = {{{ Functions.getIndex('_glTexParameteri', true) }}}; break;
+ case 'glTexParameteriv': ret = {{{ Functions.getIndex('_glTexParameteriv', true) }}}; break;
+ case 'glGetTexParameterfv': ret = {{{ Functions.getIndex('_glGetTexParameterfv', true) }}}; break;
+ case 'glGetTexParameteriv': ret = {{{ Functions.getIndex('_glGetTexParameteriv', true) }}}; break;
+ case 'glTexSubImage2D': ret = {{{ Functions.getIndex('_glTexSubImage2D', true) }}}; break;
+ case 'glCopyTexImage2D': ret = {{{ Functions.getIndex('_glCopyTexImage2D', true) }}}; break;
+ case 'glViewport': ret = {{{ Functions.getIndex('_glViewport', true) }}}; break;
+ case 'glIsEnabled': ret = {{{ Functions.getIndex('_glIsEnabled', true) }}}; break;
+ case 'glLineWidth': ret = {{{ Functions.getIndex('_glLineWidth', true) }}}; break;
+ case 'glPolygonOffset': ret = {{{ Functions.getIndex('_glPolygonOffset', true) }}}; break;
+ case 'glReleaseShaderCompiler': ret = {{{ Functions.getIndex('_glReleaseShaderCompiler', true) }}}; break;
+ case 'glGetShaderPrecisionFormat': ret = {{{ Functions.getIndex('_glGetShaderPrecisionFormat', true) }}}; break;
+ case 'glShaderBinary': ret = {{{ Functions.getIndex('_glShaderBinary', true) }}}; break;
}
if (!ret) Module.printErr('WARNING: getProcAddress failed for ' + name);
return ret;
}
},
+ glGetShaderPrecisionFormat: function() { throw 'glGetShaderPrecisionFormat: TODO' },
+ glShaderBinary: function() { throw 'glShaderBinary: TODO' },
+
glDeleteObject__sig: 'vi',
glDeleteObject: function(id) {
if (GL.programs[id]) {
@@ -1731,6 +1836,10 @@ var LibraryGL = {
}
},
+ glReleaseShaderCompiler: function() {
+ //NOP (as allowed by GLES 2.0 spec)
+ },
+
glGetObjectParameteriv__sig: 'viii',
glGetObjectParameteriv: function(id, type, result) {
if (GL.programs[id]) {
@@ -3056,7 +3165,7 @@ var LibraryGL = {
// Simple pass-through functions. Starred ones have return values. [X] ones have X in the C name but not in the JS name
[[0, 'getError* finish flush'],
[1, 'clearDepth clearDepth[f] depthFunc enable disable frontFace cullFace clear lineWidth clearStencil depthMask stencilMask checkFramebufferStatus* generateMipmap activeTexture blendEquation sampleCoverage isEnabled*'],
- [2, 'blendFunc blendEquationSeparate depthRange depthRange[f] stencilMaskSeparate hint polygonOffset'],
+ [2, 'blendFunc blendEquationSeparate depthRange depthRange[f] stencilMaskSeparate hint polygonOffset vertexAttrib1f'],
[3, 'texParameteri texParameterf vertexAttrib2f stencilFunc stencilOp'],
[4, 'viewport clearColor scissor vertexAttrib3f colorMask renderbufferStorage blendFuncSeparate blendColor stencilFuncSeparate stencilOpSeparate'],
[5, 'vertexAttrib4f'],
diff --git a/tools/shared.py b/tools/shared.py
index 09277d06..25c17688 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -124,7 +124,8 @@ else:
config_file = config_file.replace('{{{ NODE }}}', node)
python = 'python'
try:
- python = Popen(['which', 'python'], stdout=PIPE).communicate()[0].replace('\n', '')
+ python = Popen(['which', 'python2'], stdout=PIPE).communicate()[0].replace('\n', '') or \
+ Popen(['which', 'python'], stdout=PIPE).communicate()[0].replace('\n', '') or python
except:
pass
config_file = config_file.replace('{{{ PYTHON }}}', python)