Skip to content
Browse files

moved to glfw and updated spidermonkey bindings to have the right arg…

…uments
  • Loading branch information...
1 parent 312accc commit b890792df17f2d8a542d0d265313aca61a0e284b @tmpvar committed Aug 20, 2011
Showing with 125 additions and 148 deletions.
  1. +7 −7 bin/SConstruct
  2. +7 −7 example/SConstruct
  3. +97 −124 example/js/main.cc
  4. +6 −3 example/triangle.js
  5. +1 −4 src/arch/wrapper.h
  6. +7 −3 src/js/spidermonkey.cc
View
14 bin/SConstruct
@@ -9,12 +9,12 @@ spidermonkey_src = path.abspath(path.join(current_dir, '..', 'deps', 'spidermonk
spidermonkey = File(path.join(spidermonkey_src, 'libjs_static.a'))
spidermonkey_includes = spidermonkey_src
-FRAMEWORKS = ['OpenGL', 'GLUT']
+glfw_src = path.abspath(path.join(current_dir, '..', 'deps', 'glfw', ))
+glfw = File(path.join(glfw_src, 'lib', 'cocoa', 'libglfw.a'))
+glfw_includes = path.abspath(path.join(glfw_src, 'include'))
-#Program('triangle', 'triangle.cc',
-# LIBS = [webgl],
-# FRAMEWORKS = FRAMEWORKS
-# )
+
+FRAMEWORKS = ['OpenGL', 'Cocoa']
# Configure spidermonkey
if not path.isfile(path.join(spidermonkey_src, 'Makefile')):
@@ -26,8 +26,8 @@ spidermonkey_make = ['make', '-f', path.join(spidermonkey_src, 'Makefile')]
subprocess.call(spidermonkey_make, cwd=spidermonkey_src)
# Make webgljs
-env = Environment(CPPPATH=[spidermonkey_includes, path.join(current_dir, '..', 'include')])
+env = Environment(CPPPATH=[spidermonkey_includes, path.join(current_dir, '..', 'include'), glfw_includes])
env.Program('webgljs', Glob('js/*.cc'),
- LIBS = [webgl, spidermonkey],
+ LIBS = [webgl, spidermonkey, glfw],
FRAMEWORKS = FRAMEWORKS
)
View
14 example/SConstruct
@@ -9,12 +9,12 @@ spidermonkey_src = path.abspath(path.join(current_dir, '..', 'deps', 'spidermonk
spidermonkey = File(path.join(spidermonkey_src, 'libjs_static.a'))
spidermonkey_includes = spidermonkey_src
-FRAMEWORKS = ['OpenGL', 'GLUT']
+glfw_src = path.abspath(path.join(current_dir, '..', 'deps', 'glfw', ))
+glfw = File(path.join(glfw_src, 'lib', 'cocoa', 'libglfw.a'))
+glfw_includes = path.abspath(path.join(glfw_src, 'include'))
-#Program('triangle', 'triangle.cc',
-# LIBS = [webgl],
-# FRAMEWORKS = FRAMEWORKS
-# )
+
+FRAMEWORKS = ['OpenGL', 'Cocoa']
# Configure spidermonkey
if not path.isfile(path.join(spidermonkey_src, 'Makefile')):
@@ -26,8 +26,8 @@ spidermonkey_make = ['make', '-f', path.join(spidermonkey_src, 'Makefile')]
subprocess.call(spidermonkey_make, cwd=spidermonkey_src)
# Make webgljs
-env = Environment(CPPPATH=[spidermonkey_includes, path.join(current_dir, '..', 'include')])
+env = Environment(CPPPATH=[spidermonkey_includes, path.join(current_dir, '..', 'include'), glfw_includes])
env.Program('webgljs', Glob('js/*.cc'),
- LIBS = [webgl, spidermonkey],
+ LIBS = [webgl, spidermonkey, glfw],
FRAMEWORKS = FRAMEWORKS
)
View
221 example/js/main.cc
@@ -74,42 +74,42 @@ static JSFunctionSpec module_global_functions[] = {
JS_FS("stdout_print", stdout_print, 1, 0),
JS_FS("fail", js_abort, 1, 0),
JS_FS("readfile", js_get_file_contents, 1, 0),
- JS_FS("webgl_rendering_context_getContextAttributes", webgl_rendering_context_getContextAttributes, 1 /* */, 0),
- JS_FS("webgl_rendering_context_isContextLost", webgl_rendering_context_isContextLost, 1 /* */, 0),
- JS_FS("webgl_rendering_context_getSupportedExtensions", webgl_rendering_context_getSupportedExtensions, 1 /* */, 0),
+ JS_FS("webgl_rendering_context_getContextAttributes", webgl_rendering_context_getContextAttributes, 0 /* */, 0),
+ JS_FS("webgl_rendering_context_isContextLost", webgl_rendering_context_isContextLost, 0 /* */, 0),
+ JS_FS("webgl_rendering_context_getSupportedExtensions", webgl_rendering_context_getSupportedExtensions, 0 /* */, 0),
JS_FS("webgl_rendering_context_getExtension", webgl_rendering_context_getExtension, 1 /* DOMString name */, 0),
JS_FS("webgl_rendering_context_activeTexture", webgl_rendering_context_activeTexture, 1 /* GLenum texture */, 0),
- JS_FS("webgl_rendering_context_attachShader", webgl_rendering_context_attachShader, 1 /* WebGLProgram program, WebGLShader shader */, 0),
- JS_FS("webgl_rendering_context_bindAttribLocation", webgl_rendering_context_bindAttribLocation, 1 /* WebGLProgram program, GLuint index, DOMString name */, 0),
- JS_FS("webgl_rendering_context_bindBuffer", webgl_rendering_context_bindBuffer, 1 /* GLenum target, WebGLBuffer buffer */, 0),
- JS_FS("webgl_rendering_context_bindFramebuffer", webgl_rendering_context_bindFramebuffer, 1 /* GLenum target, WebGLFramebuffer framebuffer */, 0),
- JS_FS("webgl_rendering_context_bindRenderbuffer", webgl_rendering_context_bindRenderbuffer, 1 /* GLenum target, WebGLRenderbuffer renderbuffer */, 0),
- JS_FS("webgl_rendering_context_bindTexture", webgl_rendering_context_bindTexture, 1 /* GLenum target, WebGLTexture texture */, 0),
- JS_FS("webgl_rendering_context_blendColor", webgl_rendering_context_blendColor, 1 /* GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha */, 0),
+ JS_FS("webgl_rendering_context_attachShader", webgl_rendering_context_attachShader, 2 /* WebGLProgram program, WebGLShader shader */, 0),
+ JS_FS("webgl_rendering_context_bindAttribLocation", webgl_rendering_context_bindAttribLocation, 3 /* WebGLProgram program, GLuint index, DOMString name */, 0),
+ JS_FS("webgl_rendering_context_bindBuffer", webgl_rendering_context_bindBuffer, 2 /* GLenum target, WebGLBuffer buffer */, 0),
+ JS_FS("webgl_rendering_context_bindFramebuffer", webgl_rendering_context_bindFramebuffer, 2 /* GLenum target, WebGLFramebuffer framebuffer */, 0),
+ JS_FS("webgl_rendering_context_bindRenderbuffer", webgl_rendering_context_bindRenderbuffer, 2 /* GLenum target, WebGLRenderbuffer renderbuffer */, 0),
+ JS_FS("webgl_rendering_context_bindTexture", webgl_rendering_context_bindTexture, 2 /* GLenum target, WebGLTexture texture */, 0),
+ JS_FS("webgl_rendering_context_blendColor", webgl_rendering_context_blendColor, 4 /* GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha */, 0),
JS_FS("webgl_rendering_context_blendEquation", webgl_rendering_context_blendEquation, 1 /* GLenum mode */, 0),
- JS_FS("webgl_rendering_context_blendEquationSeparate", webgl_rendering_context_blendEquationSeparate, 1 /* GLenum modeRGB, GLenum modeAlpha */, 0),
- JS_FS("webgl_rendering_context_blendFunc", webgl_rendering_context_blendFunc, 1 /* GLenum sfactor, GLenum dfactor */, 0),
- JS_FS("webgl_rendering_context_blendFuncSeparate", webgl_rendering_context_blendFuncSeparate, 1 /* GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha */, 0),
- JS_FS("webgl_rendering_context_bufferData", webgl_rendering_context_bufferData, 1 /* GLenum target, GLsizeiptr size, GLenum usage */, 0),
- JS_FS("webgl_rendering_context_bufferData", webgl_rendering_context_bufferData, 1 /* GLenum target, ArrayBufferView data, GLenum usage */, 0),
- JS_FS("webgl_rendering_context_bufferData", webgl_rendering_context_bufferData, 1 /* GLenum target, ArrayBuffer data, GLenum usage */, 0),
- JS_FS("webgl_rendering_context_bufferSubData", webgl_rendering_context_bufferSubData, 1 /* GLenum target, GLintptr offset, ArrayBufferView data */, 0),
- JS_FS("webgl_rendering_context_bufferSubData", webgl_rendering_context_bufferSubData, 1 /* GLenum target, GLintptr offset, ArrayBuffer data */, 0),
+ JS_FS("webgl_rendering_context_blendEquationSeparate", webgl_rendering_context_blendEquationSeparate, 2 /* GLenum modeRGB, GLenum modeAlpha */, 0),
+ JS_FS("webgl_rendering_context_blendFunc", webgl_rendering_context_blendFunc, 2 /* GLenum sfactor, GLenum dfactor */, 0),
+ JS_FS("webgl_rendering_context_blendFuncSeparate", webgl_rendering_context_blendFuncSeparate, 4 /* GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha */, 0),
+ JS_FS("webgl_rendering_context_bufferData", webgl_rendering_context_bufferData, 3 /* GLenum target, GLsizeiptr size, GLenum usage */, 0),
+ JS_FS("webgl_rendering_context_bufferData", webgl_rendering_context_bufferData, 3 /* GLenum target, ArrayBufferView data, GLenum usage */, 0),
+ JS_FS("webgl_rendering_context_bufferData", webgl_rendering_context_bufferData, 3 /* GLenum target, ArrayBuffer data, GLenum usage */, 0),
+ JS_FS("webgl_rendering_context_bufferSubData", webgl_rendering_context_bufferSubData, 3 /* GLenum target, GLintptr offset, ArrayBufferView data */, 0),
+ JS_FS("webgl_rendering_context_bufferSubData", webgl_rendering_context_bufferSubData, 3 /* GLenum target, GLintptr offset, ArrayBuffer data */, 0),
JS_FS("webgl_rendering_context_checkFramebufferStatus", webgl_rendering_context_checkFramebufferStatus, 1 /* GLenum target */, 0),
JS_FS("webgl_rendering_context_clear", webgl_rendering_context_clear, 1 /* GLbitfield mask */, 0),
- JS_FS("webgl_rendering_context_clearColor", webgl_rendering_context_clearColor, 1 /* GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha */, 0),
+ JS_FS("webgl_rendering_context_clearColor", webgl_rendering_context_clearColor, 4 /* GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha */, 0),
JS_FS("webgl_rendering_context_clearDepth", webgl_rendering_context_clearDepth, 1 /* GLclampf depth */, 0),
JS_FS("webgl_rendering_context_clearStencil", webgl_rendering_context_clearStencil, 1 /* GLint s */, 0),
- JS_FS("webgl_rendering_context_colorMask", webgl_rendering_context_colorMask, 1 /* GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha */, 0),
+ JS_FS("webgl_rendering_context_colorMask", webgl_rendering_context_colorMask, 4 /* GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha */, 0),
JS_FS("webgl_rendering_context_compileShader", webgl_rendering_context_compileShader, 1 /* WebGLShader shader */, 0),
- JS_FS("webgl_rendering_context_copyTexImage2D", webgl_rendering_context_copyTexImage2D, 1 /* GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border */, 0),
- JS_FS("webgl_rendering_context_copyTexSubImage2D", webgl_rendering_context_copyTexSubImage2D, 1 /* GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height */, 0),
- JS_FS("webgl_rendering_context_createBuffer", webgl_rendering_context_createBuffer, 1 /* */, 0),
- JS_FS("webgl_rendering_context_createFramebuffer", webgl_rendering_context_createFramebuffer, 1 /* */, 0),
- JS_FS("webgl_rendering_context_createProgram", webgl_rendering_context_createProgram, 1 /* */, 0),
- JS_FS("webgl_rendering_context_createRenderbuffer", webgl_rendering_context_createRenderbuffer, 1 /* */, 0),
+ JS_FS("webgl_rendering_context_copyTexImage2D", webgl_rendering_context_copyTexImage2D, 8 /* GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border */, 0),
+ JS_FS("webgl_rendering_context_copyTexSubImage2D", webgl_rendering_context_copyTexSubImage2D, 8 /* GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height */, 0),
+ JS_FS("webgl_rendering_context_createBuffer", webgl_rendering_context_createBuffer, 0 /* */, 0),
+ JS_FS("webgl_rendering_context_createFramebuffer", webgl_rendering_context_createFramebuffer, 0 /* */, 0),
+ JS_FS("webgl_rendering_context_createProgram", webgl_rendering_context_createProgram, 0 /* */, 0),
+ JS_FS("webgl_rendering_context_createRenderbuffer", webgl_rendering_context_createRenderbuffer, 0 /* */, 0),
JS_FS("webgl_rendering_context_createShader", webgl_rendering_context_createShader, 1 /* GLenum type */, 0),
- JS_FS("webgl_rendering_context_createTexture", webgl_rendering_context_createTexture, 1 /* */, 0),
+ JS_FS("webgl_rendering_context_createTexture", webgl_rendering_context_createTexture, 0 /* */, 0),
JS_FS("webgl_rendering_context_cullFace", webgl_rendering_context_cullFace, 1 /* GLenum mode */, 0),
JS_FS("webgl_rendering_context_deleteBuffer", webgl_rendering_context_deleteBuffer, 1 /* WebGLBuffer buffer */, 0),
JS_FS("webgl_rendering_context_deleteFramebuffer", webgl_rendering_context_deleteFramebuffer, 1 /* WebGLFramebuffer framebuffer */, 0),
@@ -119,40 +119,40 @@ static JSFunctionSpec module_global_functions[] = {
JS_FS("webgl_rendering_context_deleteTexture", webgl_rendering_context_deleteTexture, 1 /* WebGLTexture texture */, 0),
JS_FS("webgl_rendering_context_depthFunc", webgl_rendering_context_depthFunc, 1 /* GLenum func */, 0),
JS_FS("webgl_rendering_context_depthMask", webgl_rendering_context_depthMask, 1 /* GLboolean flag */, 0),
- JS_FS("webgl_rendering_context_depthRange", webgl_rendering_context_depthRange, 1 /* GLclampf zNear, GLclampf zFar */, 0),
- JS_FS("webgl_rendering_context_detachShader", webgl_rendering_context_detachShader, 1 /* WebGLProgram program, WebGLShader shader */, 0),
+ JS_FS("webgl_rendering_context_depthRange", webgl_rendering_context_depthRange, 2 /* GLclampf zNear, GLclampf zFar */, 0),
+ JS_FS("webgl_rendering_context_detachShader", webgl_rendering_context_detachShader, 2 /* WebGLProgram program, WebGLShader shader */, 0),
JS_FS("webgl_rendering_context_disable", webgl_rendering_context_disable, 1 /* GLenum cap */, 0),
JS_FS("webgl_rendering_context_disableVertexAttribArray", webgl_rendering_context_disableVertexAttribArray, 1 /* GLuint index */, 0),
- JS_FS("webgl_rendering_context_drawArrays", webgl_rendering_context_drawArrays, 1 /* GLenum mode, GLint first, GLsizei count */, 0),
- JS_FS("webgl_rendering_context_drawElements", webgl_rendering_context_drawElements, 1 /* GLenum mode, GLsizei count, GLenum type, GLintptr offset */, 0),
+ JS_FS("webgl_rendering_context_drawArrays", webgl_rendering_context_drawArrays, 3 /* GLenum mode, GLint first, GLsizei count */, 0),
+ JS_FS("webgl_rendering_context_drawElements", webgl_rendering_context_drawElements, 4 /* GLenum mode, GLsizei count, GLenum type, GLintptr offset */, 0),
JS_FS("webgl_rendering_context_enable", webgl_rendering_context_enable, 1 /* GLenum cap */, 0),
JS_FS("webgl_rendering_context_enableVertexAttribArray", webgl_rendering_context_enableVertexAttribArray, 1 /* GLuint index */, 0),
- JS_FS("webgl_rendering_context_finish", webgl_rendering_context_finish, 1 /* */, 0),
- JS_FS("webgl_rendering_context_flush", webgl_rendering_context_flush, 1 /* */, 0),
- JS_FS("webgl_rendering_context_framebufferRenderbuffer", webgl_rendering_context_framebufferRenderbuffer, 1 /* GLenum target, GLenum attachment, GLenum renderbuffertarget, WebGLRenderbuffer renderbuffer */, 0),
- JS_FS("webgl_rendering_context_framebufferTexture2D", webgl_rendering_context_framebufferTexture2D, 1 /* GLenum target, GLenum attachment, GLenum textarget, WebGLTexture texture, GLint level */, 0),
+ JS_FS("webgl_rendering_context_finish", webgl_rendering_context_finish, 0 /* */, 0),
+ JS_FS("webgl_rendering_context_flush", webgl_rendering_context_flush, 0 /* */, 0),
+ JS_FS("webgl_rendering_context_framebufferRenderbuffer", webgl_rendering_context_framebufferRenderbuffer, 4 /* GLenum target, GLenum attachment, GLenum renderbuffertarget, WebGLRenderbuffer renderbuffer */, 0),
+ JS_FS("webgl_rendering_context_framebufferTexture2D", webgl_rendering_context_framebufferTexture2D, 5 /* GLenum target, GLenum attachment, GLenum textarget, WebGLTexture texture, GLint level */, 0),
JS_FS("webgl_rendering_context_frontFace", webgl_rendering_context_frontFace, 1 /* GLenum mode */, 0),
JS_FS("webgl_rendering_context_generateMipmap", webgl_rendering_context_generateMipmap, 1 /* GLenum target */, 0),
- JS_FS("webgl_rendering_context_getActiveAttrib", webgl_rendering_context_getActiveAttrib, 1 /* WebGLProgram program, GLuint index */, 0),
- JS_FS("webgl_rendering_context_getActiveUniform", webgl_rendering_context_getActiveUniform, 1 /* WebGLProgram program, GLuint index */, 0),
+ JS_FS("webgl_rendering_context_getActiveAttrib", webgl_rendering_context_getActiveAttrib, 2 /* WebGLProgram program, GLuint index */, 0),
+ JS_FS("webgl_rendering_context_getActiveUniform", webgl_rendering_context_getActiveUniform, 2 /* WebGLProgram program, GLuint index */, 0),
JS_FS("webgl_rendering_context_getAttachedShaders", webgl_rendering_context_getAttachedShaders, 1 /* WebGLProgram program */, 0),
- JS_FS("webgl_rendering_context_getAttribLocation", webgl_rendering_context_getAttribLocation, 1 /* WebGLProgram program, DOMString name */, 0),
+ JS_FS("webgl_rendering_context_getAttribLocation", webgl_rendering_context_getAttribLocation, 2 /* WebGLProgram program, DOMString name */, 0),
JS_FS("webgl_rendering_context_getParameter", webgl_rendering_context_getParameter, 1 /* GLenum pname */, 0),
- JS_FS("webgl_rendering_context_getBufferParameter", webgl_rendering_context_getBufferParameter, 1 /* GLenum target, GLenum pname */, 0),
- JS_FS("webgl_rendering_context_getError", webgl_rendering_context_getError, 1 /* */, 0),
- JS_FS("webgl_rendering_context_getFramebufferAttachmentParameter", webgl_rendering_context_getFramebufferAttachmentParameter, 1 /* GLenum target, GLenum attachment, GLenum pname */, 0),
- JS_FS("webgl_rendering_context_getProgramParameter", webgl_rendering_context_getProgramParameter, 1 /* WebGLProgram program, GLenum pname */, 0),
+ JS_FS("webgl_rendering_context_getBufferParameter", webgl_rendering_context_getBufferParameter, 2 /* GLenum target, GLenum pname */, 0),
+ JS_FS("webgl_rendering_context_getError", webgl_rendering_context_getError, 0 /* */, 0),
+ JS_FS("webgl_rendering_context_getFramebufferAttachmentParameter", webgl_rendering_context_getFramebufferAttachmentParameter, 3 /* GLenum target, GLenum attachment, GLenum pname */, 0),
+ JS_FS("webgl_rendering_context_getProgramParameter", webgl_rendering_context_getProgramParameter, 2 /* WebGLProgram program, GLenum pname */, 0),
JS_FS("webgl_rendering_context_getProgramInfoLog", webgl_rendering_context_getProgramInfoLog, 1 /* WebGLProgram program */, 0),
- JS_FS("webgl_rendering_context_getRenderbufferParameter", webgl_rendering_context_getRenderbufferParameter, 1 /* GLenum target, GLenum pname */, 0),
- JS_FS("webgl_rendering_context_getShaderParameter", webgl_rendering_context_getShaderParameter, 1 /* WebGLShader shader, GLenum pname */, 0),
+ JS_FS("webgl_rendering_context_getRenderbufferParameter", webgl_rendering_context_getRenderbufferParameter, 2 /* GLenum target, GLenum pname */, 0),
+ JS_FS("webgl_rendering_context_getShaderParameter", webgl_rendering_context_getShaderParameter, 2 /* WebGLShader shader, GLenum pname */, 0),
JS_FS("webgl_rendering_context_getShaderInfoLog", webgl_rendering_context_getShaderInfoLog, 1 /* WebGLShader shader */, 0),
JS_FS("webgl_rendering_context_getShaderSource", webgl_rendering_context_getShaderSource, 1 /* WebGLShader shader */, 0),
- JS_FS("webgl_rendering_context_getTexParameter", webgl_rendering_context_getTexParameter, 1 /* GLenum target, GLenum pname */, 0),
- JS_FS("webgl_rendering_context_getUniform", webgl_rendering_context_getUniform, 1 /* WebGLProgram program, WebGLUniformLocation location */, 0),
- JS_FS("webgl_rendering_context_getUniformLocation", webgl_rendering_context_getUniformLocation, 1 /* WebGLProgram program, DOMString name */, 0),
- JS_FS("webgl_rendering_context_getVertexAttrib", webgl_rendering_context_getVertexAttrib, 1 /* GLuint index, GLenum pname */, 0),
- JS_FS("webgl_rendering_context_getVertexAttribOffset", webgl_rendering_context_getVertexAttribOffset, 1 /* GLuint index, GLenum pname */, 0),
- JS_FS("webgl_rendering_context_hint", webgl_rendering_context_hint, 1 /* GLenum target, GLenum mode */, 0),
+ JS_FS("webgl_rendering_context_getTexParameter", webgl_rendering_context_getTexParameter, 2 /* GLenum target, GLenum pname */, 0),
+ JS_FS("webgl_rendering_context_getUniform", webgl_rendering_context_getUniform, 2 /* WebGLProgram program, WebGLUniformLocation location */, 0),
+ JS_FS("webgl_rendering_context_getUniformLocation", webgl_rendering_context_getUniformLocation, 2 /* WebGLProgram program, DOMString name */, 0),
+ JS_FS("webgl_rendering_context_getVertexAttrib", webgl_rendering_context_getVertexAttrib, 2 /* GLuint index, GLenum pname */, 0),
+ JS_FS("webgl_rendering_context_getVertexAttribOffset", webgl_rendering_context_getVertexAttribOffset, 2 /* GLuint index, GLenum pname */, 0),
+ JS_FS("webgl_rendering_context_hint", webgl_rendering_context_hint, 2 /* GLenum target, GLenum mode */, 0),
JS_FS("webgl_rendering_context_isBuffer", webgl_rendering_context_isBuffer, 1 /* WebGLBuffer buffer */, 0),
JS_FS("webgl_rendering_context_isEnabled", webgl_rendering_context_isEnabled, 1 /* GLenum cap */, 0),
JS_FS("webgl_rendering_context_isFramebuffer", webgl_rendering_context_isFramebuffer, 1 /* WebGLFramebuffer framebuffer */, 0),
@@ -163,76 +163,53 @@ static JSFunctionSpec module_global_functions[] = {
JS_FS("webgl_rendering_context_lineWidth", webgl_rendering_context_lineWidth, 1 /* GLfloat width */, 0),
JS_FS("webgl_rendering_context_linkProgram", webgl_rendering_context_linkProgram, 1 /* WebGLProgram program */, 0),
JS_FS("webgl_rendering_context_pixelStorei", webgl_rendering_context_pixelStorei, 1 /* GLenum pname, GLint param */, 0),
- JS_FS("webgl_rendering_context_polygonOffset", webgl_rendering_context_polygonOffset, 1 /* GLfloat factor, GLfloat units */, 0),
- JS_FS("webgl_rendering_context_readPixels", webgl_rendering_context_readPixels, 1 /* GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, ArrayBufferView pixels */, 0),
- JS_FS("webgl_rendering_context_renderbufferStorage", webgl_rendering_context_renderbufferStorage, 1 /* GLenum target, GLenum internalformat, GLsizei width, GLsizei height */, 0),
- JS_FS("webgl_rendering_context_sampleCoverage", webgl_rendering_context_sampleCoverage, 1 /* GLclampf value, GLboolean invert */, 0),
- JS_FS("webgl_rendering_context_scissor", webgl_rendering_context_scissor, 1 /* GLint x, GLint y, GLsizei width, GLsizei height */, 0),
- JS_FS("webgl_rendering_context_shaderSource", webgl_rendering_context_shaderSource, 1 /* WebGLShader shader, DOMString source */, 0),
- JS_FS("webgl_rendering_context_stencilFunc", webgl_rendering_context_stencilFunc, 1 /* GLenum func, GLint ref, GLuint mask */, 0),
- JS_FS("webgl_rendering_context_stencilFuncSeparate", webgl_rendering_context_stencilFuncSeparate, 1 /* GLenum face, GLenum func, GLint ref, GLuint mask */, 0),
+ JS_FS("webgl_rendering_context_polygonOffset", webgl_rendering_context_polygonOffset, 2 /* GLfloat factor, GLfloat units */, 0),
+ JS_FS("webgl_rendering_context_readPixels", webgl_rendering_context_readPixels, 7 /* GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, ArrayBufferView pixels */, 0),
+ JS_FS("webgl_rendering_context_renderbufferStorage", webgl_rendering_context_renderbufferStorage, 4 /* GLenum target, GLenum internalformat, GLsizei width, GLsizei height */, 0),
+ JS_FS("webgl_rendering_context_sampleCoverage", webgl_rendering_context_sampleCoverage, 2 /* GLclampf value, GLboolean invert */, 0),
+ JS_FS("webgl_rendering_context_scissor", webgl_rendering_context_scissor, 4 /* GLint x, GLint y, GLsizei width, GLsizei height */, 0),
+ JS_FS("webgl_rendering_context_shaderSource", webgl_rendering_context_shaderSource, 2 /* WebGLShader shader, DOMString source */, 0),
+ JS_FS("webgl_rendering_context_stencilFunc", webgl_rendering_context_stencilFunc, 3 /* GLenum func, GLint ref, GLuint mask */, 0),
+ JS_FS("webgl_rendering_context_stencilFuncSeparate", webgl_rendering_context_stencilFuncSeparate, 4 /* GLenum face, GLenum func, GLint ref, GLuint mask */, 0),
JS_FS("webgl_rendering_context_stencilMask", webgl_rendering_context_stencilMask, 1 /* GLuint mask */, 0),
- JS_FS("webgl_rendering_context_stencilMaskSeparate", webgl_rendering_context_stencilMaskSeparate, 1 /* GLenum face, GLuint mask */, 0),
- JS_FS("webgl_rendering_context_stencilOp", webgl_rendering_context_stencilOp, 1 /* GLenum fail, GLenum zfail, GLenum zpass */, 0),
- JS_FS("webgl_rendering_context_stencilOpSeparate", webgl_rendering_context_stencilOpSeparate, 1 /* GLenum face, GLenum fail, GLenum zfail, GLenum zpass */, 0),
- JS_FS("webgl_rendering_context_texImage2D", webgl_rendering_context_texImage2D, 1 /* GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, ArrayBufferView pixels */, 0),
- JS_FS("webgl_rendering_context_texImage2D", webgl_rendering_context_texImage2D, 1 /* GLenum target, GLint level, GLenum internalformat, GLenum format, GLenum type, ImageData pixels */, 0),
- JS_FS("webgl_rendering_context_texImage2D", webgl_rendering_context_texImage2D, 1 /* GLenum target, GLint level, GLenum internalformat, GLenum format, GLenum type, HTMLImageElement image) raises (DOMException */, 0),
- JS_FS("webgl_rendering_context_texImage2D", webgl_rendering_context_texImage2D, 1 /* GLenum target, GLint level, GLenum internalformat, GLenum format, GLenum type, HTMLCanvasElement canvas) raises (DOMException */, 0),
- JS_FS("webgl_rendering_context_texImage2D", webgl_rendering_context_texImage2D, 1 /* GLenum target, GLint level, GLenum internalformat, GLenum format, GLenum type, HTMLVideoElement video) raises (DOMException */, 0),
- JS_FS("webgl_rendering_context_texParameterf", webgl_rendering_context_texParameterf, 1 /* GLenum target, GLenum pname, GLfloat param */, 0),
- JS_FS("webgl_rendering_context_texParameteri", webgl_rendering_context_texParameteri, 1 /* GLenum target, GLenum pname, GLint param */, 0),
- JS_FS("webgl_rendering_context_texSubImage2D", webgl_rendering_context_texSubImage2D, 1 /* GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, ArrayBufferView pixels */, 0),
- JS_FS("webgl_rendering_context_texSubImage2D", webgl_rendering_context_texSubImage2D, 1 /* GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, ImageData pixels */, 0),
- JS_FS("webgl_rendering_context_texSubImage2D", webgl_rendering_context_texSubImage2D, 1 /* GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, HTMLImageElement image) raises (DOMException */, 0),
- JS_FS("webgl_rendering_context_texSubImage2D", webgl_rendering_context_texSubImage2D, 1 /* GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, HTMLCanvasElement canvas) raises (DOMException */, 0),
- JS_FS("webgl_rendering_context_texSubImage2D", webgl_rendering_context_texSubImage2D, 1 /* GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, HTMLVideoElement video) raises (DOMException */, 0),
- JS_FS("webgl_rendering_context_uniform1f", webgl_rendering_context_uniform1f, 1 /* WebGLUniformLocation location, GLfloat x */, 0),
- JS_FS("webgl_rendering_context_uniform1fv", webgl_rendering_context_uniform1fv, 1 /* WebGLUniformLocation location, FloatArray v */, 0),
- JS_FS("webgl_rendering_context_uniform1fv", webgl_rendering_context_uniform1fv, 1 /* WebGLUniformLocation location, sequence<float> v */, 0),
- JS_FS("webgl_rendering_context_uniform1i", webgl_rendering_context_uniform1i, 1 /* WebGLUniformLocation location, GLint x */, 0),
- JS_FS("webgl_rendering_context_uniform1iv", webgl_rendering_context_uniform1iv, 1 /* WebGLUniformLocation location, Int32Array v */, 0),
- JS_FS("webgl_rendering_context_uniform1iv", webgl_rendering_context_uniform1iv, 1 /* WebGLUniformLocation location, sequence<long> v */, 0),
- JS_FS("webgl_rendering_context_uniform2f", webgl_rendering_context_uniform2f, 1 /* WebGLUniformLocation location, GLfloat x, GLfloat y */, 0),
- JS_FS("webgl_rendering_context_uniform2fv", webgl_rendering_context_uniform2fv, 1 /* WebGLUniformLocation location, FloatArray v */, 0),
- JS_FS("webgl_rendering_context_uniform2fv", webgl_rendering_context_uniform2fv, 1 /* WebGLUniformLocation location, sequence<float> v */, 0),
- JS_FS("webgl_rendering_context_uniform2i", webgl_rendering_context_uniform2i, 1 /* WebGLUniformLocation location, GLint x, GLint y */, 0),
- JS_FS("webgl_rendering_context_uniform2iv", webgl_rendering_context_uniform2iv, 1 /* WebGLUniformLocation location, Int32Array v */, 0),
- JS_FS("webgl_rendering_context_uniform2iv", webgl_rendering_context_uniform2iv, 1 /* WebGLUniformLocation location, sequence<long> v */, 0),
- JS_FS("webgl_rendering_context_uniform3f", webgl_rendering_context_uniform3f, 1 /* WebGLUniformLocation location, GLfloat x, GLfloat y, GLfloat z */, 0),
- JS_FS("webgl_rendering_context_uniform3fv", webgl_rendering_context_uniform3fv, 1 /* WebGLUniformLocation location, FloatArray v */, 0),
- JS_FS("webgl_rendering_context_uniform3fv", webgl_rendering_context_uniform3fv, 1 /* WebGLUniformLocation location, sequence<float> v */, 0),
- JS_FS("webgl_rendering_context_uniform3i", webgl_rendering_context_uniform3i, 1 /* WebGLUniformLocation location, GLint x, GLint y, GLint z */, 0),
- JS_FS("webgl_rendering_context_uniform3iv", webgl_rendering_context_uniform3iv, 1 /* WebGLUniformLocation location, Int32Array v */, 0),
- JS_FS("webgl_rendering_context_uniform3iv", webgl_rendering_context_uniform3iv, 1 /* WebGLUniformLocation location, sequence<long> v */, 0),
- JS_FS("webgl_rendering_context_uniform4f", webgl_rendering_context_uniform4f, 1 /* WebGLUniformLocation location, GLfloat x, GLfloat y, GLfloat z, GLfloat w */, 0),
- JS_FS("webgl_rendering_context_uniform4fv", webgl_rendering_context_uniform4fv, 1 /* WebGLUniformLocation location, FloatArray v */, 0),
- JS_FS("webgl_rendering_context_uniform4fv", webgl_rendering_context_uniform4fv, 1 /* WebGLUniformLocation location, sequence<float> v */, 0),
- JS_FS("webgl_rendering_context_uniform4i", webgl_rendering_context_uniform4i, 1 /* WebGLUniformLocation location, GLint x, GLint y, GLint z, GLint w */, 0),
- JS_FS("webgl_rendering_context_uniform4iv", webgl_rendering_context_uniform4iv, 1 /* WebGLUniformLocation location, Int32Array v */, 0),
- JS_FS("webgl_rendering_context_uniform4iv", webgl_rendering_context_uniform4iv, 1 /* WebGLUniformLocation location, sequence<long> v */, 0),
- JS_FS("webgl_rendering_context_uniformMatrix2fv", webgl_rendering_context_uniformMatrix2fv, 1 /* WebGLUniformLocation location, GLboolean transpose, FloatArray value */, 0),
- JS_FS("webgl_rendering_context_uniformMatrix2fv", webgl_rendering_context_uniformMatrix2fv, 1 /* WebGLUniformLocation location, GLboolean transpose, sequence<float> value */, 0),
- JS_FS("webgl_rendering_context_uniformMatrix3fv", webgl_rendering_context_uniformMatrix3fv, 1 /* WebGLUniformLocation location, GLboolean transpose, FloatArray value */, 0),
- JS_FS("webgl_rendering_context_uniformMatrix3fv", webgl_rendering_context_uniformMatrix3fv, 1 /* WebGLUniformLocation location, GLboolean transpose, sequence<float> value */, 0),
- JS_FS("webgl_rendering_context_uniformMatrix4fv", webgl_rendering_context_uniformMatrix4fv, 1 /* WebGLUniformLocation location, GLboolean transpose, FloatArray value */, 0),
- JS_FS("webgl_rendering_context_uniformMatrix4fv", webgl_rendering_context_uniformMatrix4fv, 1 /* WebGLUniformLocation location, GLboolean transpose, sequence<float> value */, 0),
+ JS_FS("webgl_rendering_context_stencilMaskSeparate", webgl_rendering_context_stencilMaskSeparate, 2 /* GLenum face, GLuint mask */, 0),
+ JS_FS("webgl_rendering_context_stencilOp", webgl_rendering_context_stencilOp, 3 /* GLenum fail, GLenum zfail, GLenum zpass */, 0),
+ JS_FS("webgl_rendering_context_stencilOpSeparate", webgl_rendering_context_stencilOpSeparate, 4 /* GLenum face, GLenum fail, GLenum zfail, GLenum zpass */, 0),
+ JS_FS("webgl_rendering_context_texImage2D", webgl_rendering_context_texImage2D, 9 /* GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, ArrayBufferView pixels */, 0),
+ JS_FS("webgl_rendering_context_texParameterf", webgl_rendering_context_texParameterf, 3 /* GLenum target, GLenum pname, GLfloat param */, 0),
+ JS_FS("webgl_rendering_context_texParameteri", webgl_rendering_context_texParameteri, 3 /* GLenum target, GLenum pname, GLint param */, 0),
+ JS_FS("webgl_rendering_context_texSubImage2D", webgl_rendering_context_texSubImage2D, 7 /* GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, HTMLVideoElement video) raises (DOMException */, 0),
+ JS_FS("webgl_rendering_context_uniform1f", webgl_rendering_context_uniform1f, 2 /* WebGLUniformLocation location, GLfloat x */, 0),
+ JS_FS("webgl_rendering_context_uniform1fv", webgl_rendering_context_uniform1fv, 2 /* WebGLUniformLocation location, sequence<float> v */, 0),
+ JS_FS("webgl_rendering_context_uniform1i", webgl_rendering_context_uniform1i, 2 /* WebGLUniformLocation location, GLint x */, 0),
+ JS_FS("webgl_rendering_context_uniform1iv", webgl_rendering_context_uniform1iv, 2 /* WebGLUniformLocation location, sequence<long> v */, 0),
+ JS_FS("webgl_rendering_context_uniform2f", webgl_rendering_context_uniform2f, 3 /* WebGLUniformLocation location, GLfloat x, GLfloat y */, 0),
+ JS_FS("webgl_rendering_context_uniform2fv", webgl_rendering_context_uniform2fv, 2 /* WebGLUniformLocation location, FloatArray v */, 0),
+ JS_FS("webgl_rendering_context_uniform2i", webgl_rendering_context_uniform2i, 3 /* WebGLUniformLocation location, GLint x, GLint y */, 0),
+ JS_FS("webgl_rendering_context_uniform2iv", webgl_rendering_context_uniform2iv, 2 /* WebGLUniformLocation location, sequence<long> v */, 0),
+ JS_FS("webgl_rendering_context_uniform3f", webgl_rendering_context_uniform3f, 4 /* WebGLUniformLocation location, GLfloat x, GLfloat y, GLfloat z */, 0),
+ JS_FS("webgl_rendering_context_uniform3fv", webgl_rendering_context_uniform3fv, 2 /* WebGLUniformLocation location, sequence<float> v */, 0),
+ JS_FS("webgl_rendering_context_uniform3i", webgl_rendering_context_uniform3i, 4 /* WebGLUniformLocation location, GLint x, GLint y, GLint z */, 0),
+ JS_FS("webgl_rendering_context_uniform3iv", webgl_rendering_context_uniform3iv, 2 /* WebGLUniformLocation location, sequence<long> v */, 0),
+ JS_FS("webgl_rendering_context_uniform4f", webgl_rendering_context_uniform4f, 5 /* WebGLUniformLocation location, GLfloat x, GLfloat y, GLfloat z, GLfloat w */, 0),
+ JS_FS("webgl_rendering_context_uniform4fv", webgl_rendering_context_uniform4fv, 2 /* WebGLUniformLocation location, sequence<float> v */, 0),
+ JS_FS("webgl_rendering_context_uniform4i", webgl_rendering_context_uniform4i, 5 /* WebGLUniformLocation location, GLint x, GLint y, GLint z, GLint w */, 0),
+ JS_FS("webgl_rendering_context_uniform4iv", webgl_rendering_context_uniform4iv, 2 /* WebGLUniformLocation location, sequence<long> v */, 0),
+ JS_FS("webgl_rendering_context_uniformMatrix2fv", webgl_rendering_context_uniformMatrix2fv, 3 /* WebGLUniformLocation location, GLboolean transpose, FloatArray value */, 0),
+ JS_FS("webgl_rendering_context_uniformMatrix3fv", webgl_rendering_context_uniformMatrix3fv, 3 /* WebGLUniformLocation location, GLboolean transpose, FloatArray value */, 0),
+ JS_FS("webgl_rendering_context_uniformMatrix4fv", webgl_rendering_context_uniformMatrix4fv, 3 /* WebGLUniformLocation location, GLboolean transpose, FloatArray value */, 0),
JS_FS("webgl_rendering_context_useProgram", webgl_rendering_context_useProgram, 1 /* WebGLProgram program */, 0),
JS_FS("webgl_rendering_context_validateProgram", webgl_rendering_context_validateProgram, 1 /* WebGLProgram program */, 0),
- JS_FS("webgl_rendering_context_vertexAttrib1f", webgl_rendering_context_vertexAttrib1f, 1 /* GLuint indx, GLfloat x */, 0),
- JS_FS("webgl_rendering_context_vertexAttrib1fv", webgl_rendering_context_vertexAttrib1fv, 1 /* GLuint indx, FloatArray values */, 0),
- JS_FS("webgl_rendering_context_vertexAttrib1fv", webgl_rendering_context_vertexAttrib1fv, 1 /* GLuint indx, sequence<float> values */, 0),
- JS_FS("webgl_rendering_context_vertexAttrib2f", webgl_rendering_context_vertexAttrib2f, 1 /* GLuint indx, GLfloat x, GLfloat y */, 0),
- JS_FS("webgl_rendering_context_vertexAttrib2fv", webgl_rendering_context_vertexAttrib2fv, 1 /* GLuint indx, FloatArray values */, 0),
- JS_FS("webgl_rendering_context_vertexAttrib2fv", webgl_rendering_context_vertexAttrib2fv, 1 /* GLuint indx, sequence<float> values */, 0),
- JS_FS("webgl_rendering_context_vertexAttrib3f", webgl_rendering_context_vertexAttrib3f, 1 /* GLuint indx, GLfloat x, GLfloat y, GLfloat z */, 0),
- JS_FS("webgl_rendering_context_vertexAttrib3fv", webgl_rendering_context_vertexAttrib3fv, 1 /* GLuint indx, FloatArray values */, 0),
- JS_FS("webgl_rendering_context_vertexAttrib3fv", webgl_rendering_context_vertexAttrib3fv, 1 /* GLuint indx, sequence<float> values */, 0),
- JS_FS("webgl_rendering_context_vertexAttrib4f", webgl_rendering_context_vertexAttrib4f, 1 /* GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w */, 0),
- JS_FS("webgl_rendering_context_vertexAttrib4fv", webgl_rendering_context_vertexAttrib4fv, 1 /* GLuint indx, FloatArray values */, 0),
- JS_FS("webgl_rendering_context_vertexAttrib4fv", webgl_rendering_context_vertexAttrib4fv, 1 /* GLuint indx, sequence<float> values */, 0),
- JS_FS("webgl_rendering_context_vertexAttribPointer", webgl_rendering_context_vertexAttribPointer, 1 /* GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset */, 0),
- JS_FS("webgl_rendering_context_viewport", webgl_rendering_context_viewport, 1 /* GLint x, GLint y, GLsizei width, GLsizei height */, 0),
+ JS_FS("webgl_rendering_context_vertexAttrib1f", webgl_rendering_context_vertexAttrib1f, 2 /* GLuint indx, GLfloat x */, 0),
+ JS_FS("webgl_rendering_context_vertexAttrib1fv", webgl_rendering_context_vertexAttrib1fv, 2 /* GLuint indx, sequence<float> values */, 0),
+ JS_FS("webgl_rendering_context_vertexAttrib2f", webgl_rendering_context_vertexAttrib2f, 3 /* GLuint indx, GLfloat x, GLfloat y */, 0),
+ JS_FS("webgl_rendering_context_vertexAttrib2fv", webgl_rendering_context_vertexAttrib2fv, 2 /* GLuint indx, FloatArray values */, 0),
+ JS_FS("webgl_rendering_context_vertexAttrib3f", webgl_rendering_context_vertexAttrib3f, 4 /* GLuint indx, GLfloat x, GLfloat y, GLfloat z */, 0),
+ JS_FS("webgl_rendering_context_vertexAttrib3fv", webgl_rendering_context_vertexAttrib3fv, 2 /* GLuint indx, sequence<float> values */, 0),
+ JS_FS("webgl_rendering_context_vertexAttrib4f", webgl_rendering_context_vertexAttrib4f, 5 /* GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w */, 0),
+ JS_FS("webgl_rendering_context_vertexAttrib4fv", webgl_rendering_context_vertexAttrib4fv, 2 /* GLuint indx, sequence<float> values */, 0),
+ JS_FS("webgl_rendering_context_vertexAttribPointer", webgl_rendering_context_vertexAttribPointer, 6 /* GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset */, 0),
+ JS_FS("webgl_rendering_context_viewport", webgl_rendering_context_viewport, 4 /* GLint x, GLint y, GLsizei width, GLsizei height */, 0),
JS_FS_END
};
@@ -358,17 +335,13 @@ int main(int argc, char **argv)
setupGlobals(cx, global);
- glutInit(&argc, argv);
+ glfwInit();
+
+ glfwOpenWindow( 300,300, 0,0,0,0,0,0, GLFW_WINDOW );
ok = JS_EvaluateScript(cx, global, script, strlen(script),
filename, lineno, &rval);
- glutInitDisplayMode (GLUT_SINGLE);
- glutInitWindowSize (500, 500); // Set the width and height of the window
- glutInitWindowPosition (100, 100);
- glutCreateWindow ("You’re first OpenGL Window");
- glutDisplayFunc(render);
- glutMainLoop();
delete [] script;
if (rval == NULL || rval == JS_FALSE)
View
9 example/triangle.js
@@ -1,4 +1,4 @@
-var WebGLRenderingContext = require('lib/webgl.js');
+var WebGLRenderingContext = require('../lib/webgl.js');
var ctx = new WebGLRenderingContext();
var program = ctx.createProgram();
@@ -49,13 +49,16 @@ var vertices = [
ctx.bindBuffer(ctx.ARRAY_BUFFER, vertexBuffer);
ctx.bufferData(ctx.ARRAY_BUFFER, new Float32Array(vertexBuffer));
+var a = 10000;
+while(a--) {
-while(1) {
ctx.clearColor(0.5, 0.5, 0.5, 1);
ctx.clear(ctx.COLOR_BUFFER_BIT, ctx.DEPTH_BUFFER_BIT);
ctx.bindBuffer(ctx.ARRAY_BUFFER, vertexBuffer);
ctx.enableVertexAttribArray(attr);
ctx.vertexAttribPointer(attr, vertexBuffer.itemSize, ctx.FLOAT, false, 0, 0);
ctx.drawArrays(ctx.TRIANGLES, 0, 3);
ctx.flush();
-}
+}
+
+fail();
View
5 src/arch/wrapper.h
@@ -5,12 +5,9 @@
using namespace std;
#ifdef __APPLE__
- #include <GLUT/glut.h>
+ #include "../../deps/glfw/include/GL/glfw.h"
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
- #include <OpenGL/glu.h>
- #include <CoreFoundation/CoreFoundation.h>
- #include <ApplicationServices/ApplicationServices.h>
#else
#ifdef _WIN32
#include <windows.h>
View
10 src/js/spidermonkey.cc
@@ -101,12 +101,14 @@ JSBool webgl_rendering_context_checkFramebufferStatus(JSContext *cx, uintN argc,
}
JSBool webgl_rendering_context_clear(JSContext *cx, uintN argc, jsval *argv) {
- glClear();
+
+
+ glClear(GL_DEPTH);
return JS_TRUE;
}
JSBool webgl_rendering_context_clearColor(JSContext *cx, uintN argc, jsval *argv) {
-
+ glClearColor(0,0,0,1);
return JS_TRUE;
}
@@ -268,7 +270,9 @@ JSBool webgl_rendering_context_finish(JSContext *cx, uintN argc, jsval *argv) {
}
JSBool webgl_rendering_context_flush(JSContext *cx, uintN argc, jsval *argv) {
-
+ // TODO: make this more flexible?
+ // Swap front and back rendering buffers
+ glfwSwapBuffers();
return JS_TRUE;
}

0 comments on commit b890792

Please sign in to comment.
Something went wrong with that request. Please try again.