<commit_before>#= require 'jax/renderer'

Jax.Renderer.register class Jax.Renderer.WebGL
  constructor: (canvas, options) ->
    throw new Error "WebGL not supported!" unless canvas.getContext
    @context = canvas.getContext 'experimental-webgl', options
    throw new Error "WebGL not supported!" unless @context
    
    @context.clearColor 0.0, 0.0, 0.0, 1.0
    @context.clearDepth 1.0
    @context.enable     GL_DEPTH_TEST
    @context.depthFunc  GL_LESS
    @context.enable     GL_BLEND
    @context.blendFunc  GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA
    @context.enable     GL_CULL_FACE
    
  clear: ->
    @context.clear GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT
    
  ###
  Prepare to render the scene.
  ###
  prepare: ->
    @viewport()
    
  viewport: ->
    canvasWidth  = @context.canvas.clientWidth  || @context.canvas.width
    canvasHeight = @context.canvas.clientHeight || @context.canvas.height
    @context.viewport 0, 0, canvasWidth, canvasHeight
<commit_msg>always pass real width and height to `viewport`<commit_after>#= require 'jax/renderer'

Jax.Renderer.register class Jax.Renderer.WebGL
  constructor: (canvas, options) ->
    throw new Error "WebGL not supported!" unless canvas.getContext
    @context = canvas.getContext 'experimental-webgl', options
    throw new Error "WebGL not supported!" unless @context
    
    @context.clearColor 0.0, 0.0, 0.0, 1.0
    @context.clearDepth 1.0
    @context.enable     GL_DEPTH_TEST
    @context.depthFunc  GL_LESS
    @context.enable     GL_BLEND
    @context.blendFunc  GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA
    @context.enable     GL_CULL_FACE
    
  clear: ->
    @context.clear GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT
    
  ###
  Prepare to render the scene.
  ###
  prepare: ->
    @viewport()
    
  viewport: ->
    canvasWidth  = @context.canvas.width
    canvasHeight = @context.canvas.height
    @context.viewport 0, 0, canvasWidth, canvasHeight

{'fraction_non_alphanumeric': 0.09898989898989899, 'fraction_numerical': 0.012121212121212121, 'mean_word_length': 3.315904139433551, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3744387', 'n_tokens_mistral': 674, 'n_tokens_neox': 655, 'n_words': 147}