Teensy 4.x meets OpenGL (pseudo OpenGL anyway)

mjs513

Senior Member+
In my post ArduinoGL (wireframe pieces using OpenGL) ported to Teensy 4 I described my efforts in getting ArduinoGl ported to the Teensy 4.x. Well, since then, among other things, that little project grew to incorporating Michael Rule's Arduino3D library as well as make a whole lot of other changes to support additional shading options and OpenGL functions which I will describe next. Since there were so many modifications and additions I am now calling the Library TeensyOpenGL_t4 since it will probably only run on a T4.x now.

What the library is not:
It is not a full implementation of the OpenGL language. I did a pick and choose of the functions I needed as well as changing a few of the function call parameters (only a couple).

What is supported:
Primatives:
GL_NONE, GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_LINE_LOOP, GL_QUADS, GL_POLYGON, GL_TRIANGLES, GL_TRIANGLE_STRIP

Shaders:
NONE = 0, SimpleVertexShader, FacetShader, VertexAngleShader, SmoothShader
Note: Smoothshader supports Phong and Gourand shading (pixel shaders)

Model Size: Limited to 950 faces or 950*3=2,850 Vertices

Lighting: Only Light0 (directional light) is support for now.

Colors: really pseudo color arrays were generated for now
  • glColor3ub(r, g, b) - one color for all faces in r,g,b colors in uint8 format (0-255)
  • glColorT(uint16_t idx, uint8_t r, uint8_t g, uint8_t b ) - color for each vertex, for now you have to give it an vertex index number

Several examples have been included that should help with explaining how it all works.

On the ToDo List
  • Add material options
  • Fix specular lighting
  • Add additional light sources and types
  • Fix color arrays
  • Verify some other shapes for shading, issue with what I was using was probably winding order for gl_triangle_strips,
  • Probably add GL_QUAD_STRIPS
  • Generate Readme

Lib is at https://github.com/mjs513/TeensyOpenGL_t4.

Videos follow. As you see from the videos some work still needs to be done.
 
Last edited:
Nice work @mjs513! The four empty posts made me wonder if you went nuts … apparently you have … but not with blank postings!
 
Thanks @defragster and yes was going nuts putting it together. Had to learn openGL and Shading as I was going - Argh. Still more in openGl but not everything will work on a microprocessor.

Just for reference I did test it with the ILI9488 display and it worked
 
Back
Top