Skip to content

lidavidm/jsglet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 

Repository files navigation

jsglet: WebGL wrapper for JavaScript

This project aims to implement a WebGL toolkit for JavaScript in the style of Pyglet for Python. However, there are some important differences:

  • WebGL is based on OpenGL ES/similar to OpenGL 3+ and has no fixed-function pipeline and fewer built-in features. This means that:

    • Rendering is highly dependent on the shaders used. Therefore, wrappers around the buffer object functionality are highly coupled to the wrappers around the shader functionality.

      # OpenGL < 3:
      glVertexPointer(...)
      
      // WebGL:
      vertexLocation = gl.getAttribLocation(program, "a_Position");
      gl.enableVertexAttribArray(vertexLocation);
      gl.bindBuffer(gl.ARRAY_BUFFER, bufferObject);
      gl.vertexAttribPointer(vertexLocation, ...)
      

    The problem with porting the Pyglet API/semantics to JavaScript is that now the required data is scattered around, and Pyglet never dealt with shaders anyways.

    Solution: use some sort of "Renderer" object that manages all this data/state and can create VBOs, etc. when needed.

Dependencies

About

WebGL toolkit

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published