Object for abstracting out all the gl calls to handle rendering entities with a particular program
177482
function RenderProgramWrapper(layer, shader) {
    this.shader = shader;
    this.layer = layer;
    this.context = layer.context;
    this.draw = function() {};

    this.array_size = 16;
    this.max_size = 1024;
    this._indexArray = new Uint16Array(6 * this.array_size);
    this._indexBuffer = layer.context.createBuffer();
}
776133
public void render() {
		if ((engine.usePoints() && (usePoints == INHERIT_POINTS))
				|| (usePoints == USE_POINTS)) {
			TextureImpl.bindNone();
			GL.glEnable(SGL.GL_POINT_SMOOTH);
			GL.glPointSize(size / 2);
			color.bind();
			GL.glBegin(SGL.GL_POINTS);
			GL.glVertex2f(x, y);
			GL.glEnd();
		} else if (oriented || scaleY != 1.0f) {
			GL.glPushMatrix();

			GL.glTranslatef(x, y, 0f);

			if (oriented) {
				float angle = (float) (Math.atan2(y, x) * 180 / Math.PI);
				GL.glRotatef(angle, 0f, 0f, 1.0f);
			}

			// scale
			GL.glScalef(1.0f, scaleY, 1.0f);

			image.draw((int) (-(size / 2)), (int) (-(size / 2)), (int) size,
					(int) size, color);
			GL.glPopMatrix();
		} else {
			color.bind();
			image.drawEmbedded((int) (x - (size / 2)), (int) (y - (size / 2)),
					(int) size, (int) size);
		}
	}
724891
def render(self, model, color, num_turtles):
        """"""
        self.program.bind()
        glBindVertexArray(self.vao)

        self.model_buffer.load(model.data, model.byte_size)
        self.color_buffer.load(color.data, color.byte_size)

        glDrawArraysInstanced(
            GL_TRIANGLES,
            0,
            len(self.geometry.edges) // 7,  # 7 = 4 for vertex, 3 for edge
            num_turtles
        )

        glBindVertexArray(0)
        self.program.unbind()
260722
def render(self,scope=None,local_vars=None,block=None):
		''' 
		'''

		if not scope:
			class Scope(object):
				pass

			scope = Scope()

		return self.evaluate(scope,local_vars or {}, block)
727977
def render_scene(self):
        ""
        self.init_gl() # should be a no-op after the first frame is rendered
        glfw.make_context_current(self.window)
        self.renderer.render_scene()
        # Done rendering
        # glfw.swap_buffers(self.window) # avoid double buffering to avoid stalling
        glFlush() # single buffering
        glfw.poll_events()
1258345
function() {
		if ( !this.force2D && WebGLRenderer.isSupported( this.el ) ) {
			this.renderer = new WebGLRenderer( this.el );
		} else if ( Canvas2DRenderer.isSupported( this.el ) ) {
			this.renderer = new Canvas2DRenderer( this.el );
		} else {
			throw new Error( "No supported renderer!" );
		}
	}
246232
def print_context_info(self):
        
        print("Context Version:")
        print('ModernGL:', moderngl.__version__)
        print('vendor:', self.ctx.info['GL_VENDOR'])
        print('renderer:', self.ctx.info['GL_RENDERER'])
        print('version:', self.ctx.info['GL_VERSION'])
        print('python:', sys.version)
        print('platform:', sys.platform)
        print('code:', self.ctx.version_code)
10069
function rawRender (vdom, isSvg) {
  if (Array.isArray(vdom)) return renderArray(vdom, isSvg)
  if (vdom instanceof window.Element) return renderDirectDom(vdom, isSvg)
  if (typeof vdom !== 'object') return renderPrimitive(vdom, isSvg)

  // one-level deep flatten children array
  var props = extend(
    extend({}, vdom.props),
    { children: [].concat.apply([], vdom.children || []) }
  )

  if (vdom.isDom) return renderDom(vdom, props, isSvg)
  if (vdom.isStateless) return renderStateless(vdom, props, isSvg)
  if (vdom.isComponent) return renderClass(vdom, props, isSvg)
}
1282670
function buildShaderProgram(gl, name, config, resources) {
  const progConfig = config.programs[name];
  const compiledVertexShader = compileShader(
    gl,
    progConfig.vertexShader,
    gl.VERTEX_SHADER
  );
  const compiledFragmentShader = compileShader(
    gl,
    progConfig.fragmentShader,
    gl.FRAGMENT_SHADER
  );
  const program = createShaderProgram(gl, [
    compiledVertexShader,
    compiledFragmentShader,
  ]);

  // Store the created program in the resources
  resources.programs[name] = program;

  // Handle mapping if any
  if (progConfig.mapping) {
    applyProgramDataMapping(gl, name, progConfig.mapping, config, resources);
  }

  // Return program
  return program;
}
1008197
function instanceRender (schema, opts) {
  if (_.isString(schema)) {
    schema = JSON.parse(schema)
  }

  if (!_.isPlainObject(schema)) {
    throw new Error('Must be plain object')
  }

  // find entry points
  var rootPath = walkBFS.call(this, schema, (v, k, p) => {
    if (k === '__schema') {
      return p
    }
  })

  if (!rootPath) {
    throw new Error('Cannot find "__schema" object')
  }

  var root = _.get(schema, rootPath)
  var graphRoot = getGraphRoot.call(this, root)
  var q = graphRoot.q
  var types = graphRoot.types

  // walk the graph & build up nodes & edges
  var current
  var entities = {}

  while (q.length) {
    current = q.shift()

    // if item has already been processed
    if (entities[current]) {
      continue
    }

    // process item
    q = q.concat(processType.call(this, current, entities, types))
  }

  // process all the enum fields
  var enums = this.theme.enums.hide
    ? []
    : _.chain(types)
        .filter(type => {
          return type.kind === 'ENUM' && !_.startsWith(type.name, '__')
        })
        .map(processEnumType.bind(this))
        .value()

  // process all the input fields
  var inputs = this.theme.inputs.hide
    ? []
    : _.chain(types)
        .filter(type => {
          return type.kind === 'INPUT_OBJECT' && !_.startsWith(type.name, '__')
        })
        .map(processInputType.bind(this))
        .value()

  var interfaces = _.filter(entities, {
    isInterfaceType: true
  })

  var unions = _.filter(entities, {
    isUnionType: true
  })

  var objects = _.filter(entities, {
    isInterfaceType: false,
    isUnionType: false
  })

  // build the dot
  var dotfile =
    'digraph erd {\n' +
    'graph [\n' +
    '  rankdir = "LR"\n' +
    '];\n' +
    'node [\n' +
    '  fontsize = "16"\n' +
    '  shape = "plaintext"\n' +
    '];\n' +
    'edge [\n' +
    '];\n'

  dotfile += graph.call(this, objects, this.theme.types)
  dotfile += graph.call(this, enums, this.theme.enums)
  dotfile += graph.call(this, interfaces, this.theme.interfaces)
  dotfile += graph.call(this, inputs, this.theme.inputs)
  dotfile += graph.call(this, unions, this.theme.unions)

  dotfile += '\n\n'

  // key by to prevent need to search by name
  var processedTypes = _.keyBy(
    _.union(objects, enums, interfaces, inputs, unions),
    'name'
  )

  dotfile += _.reduce(
    processedTypes,
    (result, processedType) => {
      if (!processedType.isEnumType) {
        _.each(processedType.fields, field => {
          var fieldType = processedTypes[field.type]
          if (
            fieldType &&
            isEnabled.call(this, fieldType) &&
            (this.theme.edgesToSelf || processedType.name !== fieldType.name)
          ) {
            result.push(
              createEdge.call(this, {
                from: {
                  typeName: getTypeDisplayName(processedType.name),
                  fieldName: field.name
                },
                to: {
                  typeName: getTypeDisplayName(fieldType.name)
                },
                color: getColor.call(this, field)
              })
            )
          }
          if (!this.theme.field.noargs && field.args && field.args.length) {
            _.each(field.args, arg => {
              var argType = processedTypes[arg.type]
              if (
                argType &&
                isEnabled.call(this, argType) &&
                (this.theme.edgesToSelf || argType.name !== processedType.name)
              ) {
                result.push(
                  createEdge.call(this, {
                    from: {
                      typeName: getTypeDisplayName(argType.name)
                    },
                    to: {
                      typeName: getTypeDisplayName(processedType.name),
                      fieldName: this.theme.anchor.input ? field.name : null
                    },
                    label: this.theme.edgeLabels.input,
                    color: this.theme.inputs.hide
                      ? getColor.call(this, argType)
                      : this.theme.inputs.color,
                    weight: 1000
                  })
                )
              }
            })
          }
        })
        _.each(processedType.possibleTypes, possibleTypeName => {
          var possibleType = _.find(entities, { name: possibleTypeName })
          if (
            possibleType &&
            isEnabled.call(this, possibleType) &&
            (this.theme.edgesToSelf || processedType.name !== possibleType.name)
          ) {
            result.push(
              createEdge.call(this, {
                from: {
                  typeName: getTypeDisplayName(processedType.name)
                },
                to: {
                  typeName: getTypeDisplayName(possibleType.name)
                },
                label: processedType.isUnionType
                  ? this.theme.edgeLabels.union
                  : this.theme.edgeLabels.interface,
                color: getColor.call(this, possibleType)
              })
            )
          }
        })
      }
      return result
    },
    []
  ).join('\n')

  dotfile += '\n\n'

  dotfile += '\n}'

  return dotfile
}
774580
function createShaderProgram(gl, shaders) {
  const program = gl.createProgram();

  for (let i = 0; i < shaders.length; i++) {
    gl.attachShader(program, shaders[i]);
  }

  gl.linkProgram(program);

  // Check the link status
  const linked = gl.getProgramParameter(program, gl.LINK_STATUS);
  if (!linked) {
    // something went wrong with the link
    const lastError = gl.getProgramInfoLog(program);
    console.error('Error in program linking:', lastError);
    gl.deleteProgram(program);

    return null;
  }

  program.shaders = shaders;
  gl.useProgram(program);

  return program;
}
573922
public void render (Graphics2D gfx)
    {
        Component host = _host.getComponent();

        int x = _bounds.x, y = _bounds.y;

        if (_centerLabel != null) {
            // render the centerpiece label
            _centerLabel.paint(gfx, x + _centerLabel.closedBounds.x,
                               y + _centerLabel.closedBounds.y, this);
        }

        // render each of our items in turn
        int icount = _items.size();
        for (int i = 0; i < icount; i++) {
            RadialMenuItem item = _items.get(i);
            if (!item.isIncluded(this)) {
                continue;
            }
            // we have to wait and render the active item last
            if (item != _activeItem) {
                item.render(host, this, gfx, x + item.closedBounds.x, y + item.closedBounds.y);
            }
        }

        if (_activeItem != null) {
            _activeItem.render(host, this, gfx, x + _activeItem.closedBounds.x,
                               y + _activeItem.closedBounds.y);
        }

        // render our bounds
//         gfx.setColor(Color.green);
//         gfx.draw(_bounds);
//         gfx.setColor(Color.blue);
//         gfx.draw(_tbounds);
    }
339157
def _render_final(self, render_func, *context, **kwargs):
        
        stack = ContextStack.create(*context, **kwargs)
        self._context = stack

        engine = self._make_render_engine()

        return render_func(engine, stack)
886616
function( program ){
    var gl = this.gl;
    gl.bindBuffer( TGT, this.buffer );

    for (var i = 0; i < this.attribs.length; i++) {
      var attrib = this.attribs[i];

      if( program[attrib.name] !== undefined ){
        var aLocation = program[attrib.name]();
        gl.enableVertexAttribArray( aLocation );
        gl.vertexAttribPointer( aLocation,
                                attrib.size,
                                attrib.type,
                                attrib.normalize,
                                this.stride,
                                attrib.offset
                              );
      }

    }
  }
1287564
function() {
		var gl = this.gl;

		var program = gl.createProgram();
		gl.attachShader( program, this.vertexShader );
		gl.attachShader( program, this.fragmentShader );
		gl.linkProgram( program );	
		gl.useProgram( program );

		this.program = program;
	}
163768
function(src, type) {
        var gl = this.context;
        var shader = gl.createShader(type);
        gl.shaderSource(shader, src);
        gl.compileShader(shader);
        if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
            throw gl.getShaderInfoLog(shader);
        }
        return shader;
    }
1206558
function _createShader(gl, type, src) {
  let shader = gl.createShader(type);
  gl.shaderSource(shader, src);
  gl.compileShader(shader);

  return shader;
}