Skip to content
Alexander Orzechowski edited this page Oct 16, 2015 · 2 revisions

NOTICE: The Tessellator library is in beta and it subject to potentially big changes.

Overview

Tessellator is a library created by Alexander Orzechowski and it is designed to make creating Webgl graphics less tedious and a whole lot less code. Tessellator is not only for 3D like most people think when they see Webgl, 2D done well in Webgl far exceeds the performance of the standard canvas 2D api. Tessellator will let you port canvas 2D projects relatively easily to Tessellator using the Model.

Design concept

The Tessellator has a design concept similar to other libraries. You call a bunch of functions to set up and create the geometry and a render loop that iterates a tree structure containing instructions basically.

Rendereres

Renderers in Tessellator render whatever is on the screen. Everything should run through some kind of Renderer in order to see any sort of graphics. There are a bunch of little helper classes that help the Renderer as it does not need to deal with the raw WebGL library. There are two basic classes that the Renderers are going to work with. First, there is a Tessellator.RenderMatrix that controls the WebGL context and keeps track of everything like uniforms, enabling, disabling, blend functions, etc. The main use fo the RenderMatrix instaid of making a few functions on top of the shader that directly call the WebGL uniform functions is if you crate a clone of the RenderMatrix. Using RenderMatrix.clone() will create another UniformMatrix that inherits all the properties of the previous RenderMatrix and return it. If you set a property in the new RenderMatrix, the old one will be unaffected. When you start to render the geometry, the new RenderMatrix will set all the properties that have changed and when you revert to the old RenderMatrix object, rendering will seem unaffected by the new RenderMatrix as the old one remembers its last state.

Objects

Objects are another big piece of the puzzle as instead of keeping track of the uniforms it keeps track of the attributes and draw calls. Although this class is not mandatory with use of Renderers as they can grab the context and render directly on there, Object simplify it while not compromising functionality. Tessellator.Object.setAttribute will set an attribute with a passed name, array, and other properties that when you call Tessellator.Object.render these values will be seen in the shader without babysitting anything.

History

Tessellator at first was not desiged to be anything at first. is was supposed to assist in rendering a game but not a full library. A lot of Webgl code was in the game files scattered in places and the Tessellator only assisted in creating geometry and some basic methods to set the color of the geometry and render to a passed WebGLRenderingContext object. At first Tessellator was designed as a replacement to the glStart, glVertex, and glEnd from OpenGL immediate functions. These functions were deprecated in OpneGL and completely removed from OpenGL ES and subsequently, WebGL. The preformace was terrible and Tessellator was switched to two function layout: one for creating the geometry, and one for rendering. This basic design concept is till part of the Tessellator. These functions can be found in Tessellator.Model.* for these legacy geopmetry creating functions that are still used throughout the Tessellator. The original rendering function was split up into a module design with Tessellator.ModelRendererer being at the core.

Clone this wiki locally