TinyGL: a Small, Free and Fast Subset of OpenGL

TinyGL

tgl logo A major overhaul of Fabrice Bellard's TinyGL to be more useful as a software rasterizer.

Now with limited multithreading support

Tightly tweaked and tuned for performance

The library has been tightly tuned using valgrind, perf stat, and other tools.

On a single thread on an i7-6700 (Skylake, 2015), the standard "gears" demo runs at a higher framerate than glxgears on Mesa using a Ryzen 3900x (2019) (NOTE: TinyGL Compared without SDL overhead)

I think I can safely say, this is the fastest single-threaded FOSS software GL implementation in existence.

It's probably also the most portable

Safety features

TinyGL contains the following safety features:

  1. compiletime options for glGetError() functionality which obviously slows down speed but increases debugging capability.

  2. OpenGL 2.0 buffers, for easy memory management (Anything you put in a buffer using glBufferData will be free'd upon glClose())

  3. Fully leak checked using Valgrind- The only leaks you'll see are from your system's SDL. the Raw demos have zero leaks.

Incredibly portable

TinyGL is written in pure C99, and requires very few functions from the C standard library, it doesn't even require malloc and free (The calls are aliased to gl_malloc() and gl_free(), which you can replace with your own memory management model if you desire)

How portable?

  • TinyGL still compiles under bellard's Tiny C Compiler.

The SDL examples are now confirmed building with TCC, using TinyCC built from the latest source.

  • TinyGL has been compiled for the Nintendo 3DS (proof of concept in another repository)

You can test compiling TinyGL and running it on platforms without SDL by running the RAW DEMOS, which do not require ANYTHING Except the C standard library and stdio. You may have to change the destination written to by the raw demos on platforms without standard file systems.

These are the C standard library includes used in the RAW DEMOS.

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>

If your system supports it, the library can also take advantage of alignas to get improved SIMD support, which can be disabled in zfeatures. This adds a dependency to stdalign.h but greatly increases vertex processing speed.

(This is disabled by default for maximum portability)

If you are unsure if your target platform can support TinyGL, compile it with the buildtime and runtime tests enabled (They are, by default)

if you get a TGL_BUILDT error, then you've failed the buildtime test.

if you try to initialize the library and you get a crash with a print to standard out "TINYGL_FAILED_RUNTIME_COMPAT_TEST" then you've failed the runtime test.

The SDL examples have been tested building on Debian 10 and Windows 10, while tinygl itself has been confirmed to compile on many more platforms.

Includes a small SIMD-accelerated public domain replacement for GLU

the "Chad Math Library" has been included (CC0, public domain) for your programming needs.

it is simd accelerated on supported platforms, but it contains ZERO platform-specific code- it relies on an optimizing compiler to get vectorized ops. SIMD acceleration is improved by enabling alignas.

NOTE: There are graphical artifacts visible in these gifs which have been corrected in this version of the library.

Without Polygon Stipple:

GIF Video of demo

With Polygon Stipple:

GIF Video of demo

Hello World test:

model loading demo

Texturing Test:

Screenshot of Texture test

Model loading tests:

model loading demo

model loading demo

Without lighting:

model loading demo

model loading demo

This is a demo of the NO_DRAW_COLOR feature. Notice that the object appears to have a hole in it.

model loading demo

Blending:

model loading demo

Specular:

GIF Video of demo

OpenIMGUI standard demo:

OpenIMGUI

TinyGL 0.8 (c) 1997-2021 Fabrice Bellard, C-Chads, Gek (see License, it's free software)

This is a maintained fork of TinyGL, by the C-Chads. It is a small, suckless Software-only partial GL 1.1 implementation.

The original project was by Fabrice Bellard. We have forked it.

The changelog is as such:

  • Disabled 8, 15, and 24 bit rendering modes. 16 and 32 are the only supported rendering modes (Coincidentally, they are also the fastest)

  • Allowed the fixed texture size to be changed at compile time. It must be a power of 2, but that is the only limitation.

  • Removed the entire GLX/NanoGLX part of the library. Not portable and mostly useless.

  • Implemented new functions and some more of GL 1.1's prototypes including polygon stipple.

  • Triangles can now be lit and textured at the same time!

  • Removed unused functions which bloat binary size and lengthen compile times.

  • Added support for glDepthMask and glDisable(GL_DEPTH_TEST) as per-GL-spec

  • ADDED BLENDING SUPPORT!

  • Added glDrawPixels

  • Added glPixelZoom

  • Added glRasterPos2f,3f,4f,2fv,3fv,4fv

  • Added glGetString() for GL_VENDOR, GL_RENDERER, GL_VERSION, and optionally GL_LICENSE

  • Added comprehensive, usable glGetError() functionality for debugging.

  • Fixed a myriad of bugs and... weirdnesses

  • Fixed clientside arrays

  • Tuned the triangle rasterizer to near-perfection.

  • Tuned the transformations to absolute perfection

  • Added glDrawArrays

  • Added Buffers (For memory management purposes)

  • Added glTexImage1D (... it just resizes it to 2D, but it works!)

  • Added glPixelSize (TODO is to implement distance scaling)

  • Fixed specular rendering

  • Added way more compile time options

  • Fixed all the memory leaks.

  • added Openmp multithreading and glPostProcess()

  • Line rendering now obeys glDepthMask and glDepthTest.

  • Implemented glRectf

  • Implemented compiletime toggles for GL_SELECT and GL_FEEDBACK which significantly boosts performance. Also, implemented GL_FEEDBACK.

  • Accept PR from RobLoach to add Cmake support

Note that this Softrast is not GL 1.1 compliant and does not constitute a complete GL implementation.

You will have to tweak your code to work with this library. That said, once you have, it will run anywhere that you can get C99. TinyGL has very few external dependencies.

Notable limitations:

  • The only supported texture size and format is decided at compile time. you can set it in zfeatures.h

  • A lot of prototypes are missing.

  • glPolygonOffset doesn't change anything about how rendering occurs. It does nothing, at the moment. The "implementation specific multiplier" is 0.

  • There is no stencil buffer.

  • Blending can't use alpha values. the rasterizer has no concept of alpha.

  • There is no mipmapping, antialiasing, or any form of texture filtering.

  • No edge clamping. S and T are wrapped.

  • Display lists can be infinitely nested and doing so will crash TinyGL.

  • Lit triangles will use the current material properties, even if they are textured. If the diffuse color is black, then your textured triangles will appear black.

  • Textured triangles are affected by their vertex colors- the per-vertex color is used as a "mask" for the texture on triangles. It is recommended you call glColor3f(1,1,1); before rendering a textured object to get the expected result- you only need to make this call once, and it can be before glBegin.

  • the X dimension of the rendering window with must be a multiple of 4.

  • Line rendering is not blended

  • The ARB extension for point sprite size attenuation is not enabled.

  • Point smoothing is not implemented, points are always squares of a solid color.

  • glCopyTexImage2D only works with the size of texture you decided at compile time.

HOW DO I USE THIS LIBRARY???

TinyGL is not header only, it is a combination of C files, internal headers, and external headers.

The internal headers are only used while compiling the library,

the external headers (gl.h, zfeatures.h, zbuffer.h) are required to use the library.

You CAN compile the library along with your final program into a single compilation unit without separating out the library.

Doing so is the most likely compiling method for embedded platforms and how I got TinyGL running on the 3DS.

The codebase uses very simple compiler flags to compile- in fact it will compile if you just compile all c files together

in the src/ directory.

You can compile the code yourself without makefiles using these directives:

# inside the src directory
gcc -O3 -c *.c 
ar rcs libTinyGL.a *.o
# the library is now compiled
cp libTinyGL.a ../lib
cd ..
cd SDL_Examples/
# build the menu demo
gcc -O3 menu.c -o menu -lSDL ../lib/libTinyGL.a -lm
# gears
gcc -O3 gears.c -o gears -lSDL ../lib/libTinyGL.a -lm

This is how you use TinyGL in a program:

//First you have to include
//(Note that you must either link against libTinyGL.a or compile it in the same compilation unit as your program)
#include "../include/GL/gl.h"
#include "../include/zbuffer.h"

/*
	Somewhere in your program...
*/

//Next, open a framebuffer.
//The "0" parameter is where you pass in a framebuffer pointer if you've already made one.
ZBuffer* frameBuffer = ZB_open(winSizeX, winSizeY, mode, 0);

//Tell TinyGL to initialize on that framebuffer
glInit(frameBuffer);

//Begin making TinyGL calls!

//When you want to copy to your target screen
//Pitch is the width of the target in bytes, or bytes per pixel times width;
ZB_copyFrameBuffer(frameBuffer, screen->pixels, screen->pitch);




//At the end of your application, when you want to clean up.
ZB_close(frameBuffer);
glClose();

Note that while you... can invoke ZB_Resize to resize the framebuffer, you really shouldn't. It isn't tested.

WHAT ARE THE MINIMUM REQUIREMENTS OF THIS LIBRARY?

SDL 1.2 is required to run most of the demos I've written, but if you don't have SDL you can still check out the library by compiling one of the "Raw Demos" which write their output to a file (At the time of writing this, only gears has been added.)

SDL is by no means required to compile or use this library. SDL is used as a reasonable means of displaying the output of TinyGL for testing.

(I also included some bonus libraries that work well with SDL in the SDL examples if you want to write games using TinyGL!) (Try compiling the demos with -D PLAY_MUSIC if you have mixer!)

  • A c99 compiler
  • 32 bit signed and unsigned integer types
  • 32 bit binary float type (STDC_IEC_559)
  • Some floating point type at least as large as a 32 bit float
  • sin and cos functions in math.h
  • memcpy in string.h
  • assert in assert.h (for debugging only, it can be stubbed)
  • a minimal C stdlib
  • A memory allocator of some sort with some equivalents or replacements for malloc, calloc, and free.

There is no FILE* usage, or I/O outside of 'msghandling.c' so if you want to remove all stdio dependency, just stub out the calls there.

Multithreading support

OpenMP is used on supported platforms to multithread certain operations.

(OpenMP is also used in the math library (zmath.h and zmath.c) to explicitly force certain operations to be SIMD accelerated, so it is recommended that you compile the library with OpenMP support!)

These are the operations that are accelerated by multithreading:

  • glDrawPixels

Every scanline is drawn by a separate thread.

  • glPostProcess

Every call of the function pointer is run by a separate thread.

  • glCopyTexImage2D

Every scan line is copied by a separate thread.

  • ZBCopyBuffer

Every scan line is copied by a separate thread.

Compile the library with -fopenmp to see them in action (default). They are used in the texture demo, make sure to add the argument -pp

You do not need a multithreaded processor to use TinyGL!

Performance Recommendations

it is recommended that for best performance you keep TinyGL on a separate thread from SDL, and to guard TinyGL's buffer with a mutex.

This is not done in the demos but you can test the... thickness of the SDL stack by invoking gears or helloworld with -nosdl

The framerate doubles.

NEW FUNCTIONS

These are functions not in the GL 1.1 spec that i've added to make this library more useful.

These functions cannot be added as opcodes to display lists unless specifically listed.

glDeleteList

An easier to use version of glDeleteLists. glDeleteLists is also implemented.

glSetEnableSpecular(int shouldenablespecular);

This function can be added to display lists.

Allows you to configure specular rendering. Turn it off if you want to use GL_LIGHTING but don't plan on using specular lighting. it will save cycles.

glGetTexturePixmap(int text, int level, int* xsize, int* ysize)

Allows the user to retrieve the raw pixel data of a texture, for their own modification.

glDrawText(const unsigned char* text, int x, int y, unsigned int pixel)

This function can be added to display lists as glPlotPixel calls, the text is not saved in a display list.

Is capable of rendering the entire 8 bit latin extended character set (7 bit ascii plus characters 0xa0 and onward...)

You can check how to embed non-standard characters in your strings in the gears demo.

Draws a pre-made 8x8 font to the screen. You can change its displayed size with...

glTextSize(GLTEXTSIZE mode)

This function can be added to display lists.

Set size of text drawn to the buffer in aforementioned function.

glPlotPixel(int x, int y, unsigned int pixel)

This function can be added to display lists.

Plot pixel directly to the buffer.

glGenBuffers, glDeleteBuffers, glBindBuffer (valid target: ARRAY_BUFFER), glBindBufferAsArray

Serverside buffers! Makes it a bit easier to do clientside array stuff at the moment. may be the site of future hardware acceleration.

Please look at the model.c demo to see how to use these functions. They function very similarly to their GL 2.0+ counterparts.

glPostProcess(GLuint (*postprocess)(GLint x, GLint y, GLuint pixel, GLushort z))

Fast, Multithreaded Postprocessing for TinyGL.

You simply send in a function pointer (The function's name) and glPostProcess does the heavy lifting

The return value is the pixel (ARGB or 5R6G5B depending on mode).

x and y are the screen coordinataes.

pixel is the current color value of the pixel, ARGB or 5R6G5B depending on mode.

z is TinyGL's internal Z buffer representation. Larger values are considered to be "in front" of smaller ones.

This function is multithreaded on supported platforms for maximum execution speed. It of course still works without multithreading, but

it will not be as fast.

Note that you may have to take special care to prevent race conditions when using multithreading with this function.

NEW glGet calls!!!

You can query glGetIntegerV with these new definitions

	GL_POLYGON_MAX_VERTEX = 0xf001,
	GL_MAX_BUFFERS = 0xf002,
	GL_TEXTURE_HASH_TABLE_SIZE = 0xf003,
	GL_MAX_TEXTURE_LEVELS = 0xf004,
	GL_MAX_SPECULAR_BUFFERS = 0xf005,
	GL_MAX_DISPLAY_LISTS = 0xf006,
	GL_ERROR_CHECK_LEVEL = 0xf007,
	GL_IS_SPECULAR_ENABLED = 0xf008,

to query the configuration of TinyGL.

TOGGLEABLE FEATURES

See include/zfeatures.h

This changes too often to maintain documentation here.

The compiletime test is now disabled by default since it may not be "liked" by some obscure compilers... you can enable it in GL/gl.h

//at the top of include/GL/gl.h
//Enable TinyGL's Compiletime Compatibility Test (Scroll down)
#define COMPILETIME_TINYGL_COMPAT_TEST 1

FIXED BUGS FROM THE ORIGINAL!

TinyGL 0.4 by Bellard had incorrect color interpolation and issues with GL_FLAT, causing the hello world triangle to look rather... wrong. Additionally, per vertex color is just cool.

The whole library was filled with memory leaks and read-past-by-one type errors, and they have been corrected.

Notorious bugs from the original that have been fixed

  • GLParam is a union of float, int, uint, and void* which is assumed to be 32 bit... but isn't on 64 bit systems

  • Per vertex color is broken due to a faulty optimization in clip.c

  • The conventions for 32 bit color were RGBA for textured triangles and ABGR for non-textured. Now both render as ARGB.

  • Little endian was assumed in a thousand places in the code

  • Non-normalized position was used for lights at infinity.

  • Lack of error checking functionality

  • Insert unknown bugs here.

FULLY COMPATIBLE WITH RGBA!

The library is now able to be configured properly for RGBA rendering. Note that the output is actually ARGB but adjusting it is easy, see the SDL examples under SDL_EXAMPLES (They require SDL 1.2 and Mixer to compile)

The library is sometimes by default configured for RGBA or 5R6G5B, check include/zfeatures.h and change the values in this table:

#define TGL_FEATURE_8_BITS         0
#define TGL_FEATURE_24_BITS        0
//These are the only maintained modes.
#define TGL_FEATURE_16_BITS        1
#define TGL_FEATURE_32_BITS        0

make sure that only ONE of these values is 1.

ALSO COMPATIBLE WITH 16 BIT

Todo: add updated benchmarks

OpenIMGUI Standard

TinyGL includes an implementation of the OpenIMGUI standard, visible in SDL_EXAMPLES/menu.c

it is a standards proposal I've created for cross-platform immediate mode GUIs as a replacement for common solutions like "imgui" and Nuklear, which have glaring flaws when discussing their portability.

Consider using it!


Here is the old description of TinyGL, saved for historical/attribution purposes:

I do not endorse or promote its contents, they are here for attribution only.

General Description:


TinyGL is intended to be a very small implementation of a subset of OpenGL* for embedded systems or games. It is a software only implementation. Only the main OpenGL calls are implemented. All the calls I considered not important are simply not implemented.

The main strength of TinyGL is that it is fast and simple because it has not to be exactly compatible with OpenGL. In particular, the texture mapping and the geometrical transformations are very fast.

The main features of TinyGL are:

  • Header compatible with OpenGL (the headers are adapted from the very good Mesa by Brian Paul et al.)

  • Zlib-like licence for easy integration in commercial designs (read the LICENCE file).

  • Subset of GLX for easy testing with X Window.

  • GLX like API (NGLX) to use it with NanoX in MicroWindows/NanoX.

  • Subset of BGLView under BeOS.

  • OpenGL like lightening.

  • Complete OpenGL selection mode handling for object picking.

  • 16 bit Z buffer. 16/24/32 bit RGB rendering. High speed dithering to paletted 8 bits if needed. High speed conversion to 24 bit packed pixel or 32 bit RGBA if needed.

  • Fast Gouraud shadding optimized for 16 bit RGB.

  • Fast texture mapping capabilities, with perspective correction and texture objects.

  • 32 bit float only arithmetic.

  • Very small: compiled code size of about 40 kB on x86. The file src/zfeatures.h can be used to remove some unused features from TinyGL.

  • C sources for GCC on 32/64 bit architectures. It has been tested succesfully on x86-Linux and sparc-Solaris.

Examples:

I took three simple examples from the Mesa package to test the main functions of TinyGL. You can link them to either TinyGL, Mesa or any other OpenGL/GLX implementation. You can also compile them with Microwindows.

  • texobj illustrates the use of texture objects. Its shows the speed of TinyGL in this case.

  • glutmech comes from the GLUT packages. It is much bigger and slower because it uses the lightening. I have just included some GLU functions and suppressed the GLUT related code to make it work. It shows the display list handling of TinyGL in particular. You can look at the source code to learn the keys to move the robot. The key 't' toggles between shaded rendering and wire frame.

  • You can download and compile the VReng project to see that TinyGL has been successfully used in a big project (http://www-inf.enst.fr/vreng).

Architecture:

TinyGL is made up four main modules:

  • Mathematical routines (zmath).

  • OpenGL-like emulation (zgl).

  • Z buffer and rasterisation (zbuffer).

  • GLX interface (zglx).

To use TinyGL in an embedded system, you should look at the GLX layer and modify it to suit your need. Adding a more user friendly developper layer (as in Mesa) may be useful.

Notes - limitations:

  • See the file 'LIMITATIONS' to see the current functions supported by the API.

  • The multithreading could be easily implemented since no global state is maintainted. The library gets the current context with a function which can be modified.

  • The lightening is not very fast. I supposed that in most games the lightening is computed by the 3D engine.

  • Some changes are needed for 64 bit pointers for the handling of arrays of float with the GLParam union.

  • List sharing is partialy supported in the source, but not by the current TinyGLX implementation (is it really useful ?).

  • No user clipping planes are supported.

  • No color index mode (no longer useful !)

  • The mipmapping is not implemented.

  • The perspecture correction in the mapping code does not use W but 1/Z. In any 'normal scene' it should work.

  • The resizing of the viewport in TinyGLX ensures that the width and the height are multiples of 4. This is not optimal because some pixels of the window may not be refreshed.

Why ?

TinyGL was developped as a student project for a Virtual Reality network system called VReng (see the VReng home page at http://www-inf.enst.fr/vreng).

At that time (January 1997), my initial project was to write my own 3D rasterizer based on some old sources I wrote. But I realized that it would be better to use OpenGL to work on any platform. My problem was that I wanted to use texture mapping which was (and is still) quite slower on many software OpenGL implementation. I could have modified Mesa to suit my needs, but I really wanted to use my old sources for that project.

I finally decided to use the same syntax as OpenGL but with my own libraries, thinking that later it could ease the porting of VReng to OpenGL.

Now VReng is at last compatible with OpenGL, and I managed to patch TinyGL so that VReng can still work with it without any modifications.

Since TinyGL may be useful for some people, especially in the world of embedded designs, I decided to release it 'as is', otherwise, it would have been lost on my hard disk !


  • OpenGL(R) is a registered trademark of Silicon Graphics, Inc.

Fabrice Bellard.

Related Projects

  • PortableGL is an implementation of OpenGL 3.x core in clean C99 as a single header library.
  • TinyGLES is a software OpenGL ES driver.
  • Vincent ES is a software renderer based on OpenGL ES 2.0 API.
  • softgl is a software renderer based on OpenGL 1.x.
Similar Resources

dwm is an extremely fast, small, and dynamic window manager for X.

dwm - dynamic window manager dwm is an extremely fast, small, and dynamic window manager for X. My Patches This is in the order that I patched everyth

Sep 22, 2022

⛵ The missing small and fast image decoding library for humans (not for machines).

⛵ The missing small and fast image decoding library for humans (not for machines).

Squirrel Abstract Image Library The missing fast and easy-to-use image decoding library for humans (not for machines). Target Audience • Features • Im

Sep 22, 2022

A small and fast programming language.

A small and fast programming language.

Pocketlang is a small (~3000 semicolons) and fast functional language written in C. It's syntactically similar to Ruby and it can be learned within 15

Sep 27, 2022

ArkScript is a small, fast, functional and scripting language for C++ projects

ArkScript is a small, fast, functional and scripting language for C++ projects

ArkScript Documentation Discord server: invite link, to discuss the specification of the language and receive help Modules Nota bene: the project is r

Sep 29, 2022

A family of small, fast, and simple bitmap fonts in single-file C headers

A family of small, fast, and simple bitmap fonts in single-file C headers

Blit A family of small, fast, and simple bitmap fonts in single-file C headers [go to repository] These are not intended as a replacement for fancy us

Sep 7, 2022

A small, fast, vectorizeable libm

jodiemath a small, fast, vectorizeable libm goals: all functions have absolute or relative error ~= 0.000010 or less, this isn't a fast math library,

Mar 29, 2022

A small, fast codeforces command line tool for competitive programming.

A small, fast codeforces command line tool for competitive programming.

chainsaw: A Codeforces Commandline Tool chainsaw is a small and faster drop-in replacement for your copy and paste while attending Codeforces contests

Aug 19, 2022

The Wren Programming Language. Wren is a small, fast, class-based concurrent scripting language.

Wren is a small, fast, class-based concurrent scripting language Think Smalltalk in a Lua-sized package with a dash of Erlang and wrapped up in a fami

Oct 1, 2022

FFTW is a free collection of fast C routines for computing the Discrete Fourier Transform in one or more dimensions

FFTW is a free collection of fast C routines for computing the Discrete Fourier Transform in one or more dimensions

Aug 12, 2022
Comments
  • Port the SDL examples to SDL2

    Port the SDL examples to SDL2

    I am watching issue #1 and trying to give a simple solution without heavily modifying the code base. In other words, if we only want a simple solution to port examples from SDL1.2 to SDL2, we can keep using the remaining API between SDL1.2 and SDL2 and exchanging the expired API directly.

    However, I am not sure if this is a good solution because it keeps using the SDL_Surface object. And I feel like according to the SDL 1.2 to 2.0 Migration Guide, we don't need to work on the 'SDL_Surface' object but could still do the same result of examples. It means that we could use the SDL2 APIs more like the document shows us.

    But maybe we can just enable to use SDL2 now and refine those examples in the future.

  • Fix global buffer overflow at glMaterialfv

    Fix global buffer overflow at glMaterialfv

    I try to build tinygl with -fsanitize=address and run raw_examples. It report global-buffer-overflow.

    ==271095==ERROR: AddressSanitizer: global-buffer-overflow on address 0x00000044f3e4 at pc 0x000000412845 bp 0x7ffd26123730 sp 0x7ffd26123720
    READ of size 4 at 0x00000044f3e4 thread T0
        #0 0x412844 in tglMaterialfv /home/yuan/tinygl/src/api.c:464
        #1 0x40e1c3 in init_scene /home/yuan/tinygl/examples/raw/gears.c:254
        #2 0x40a54f in main /home/yuan/tinygl/examples/raw/gears.c:362
        #3 0x7f3b7f3cd082 in __libc_start_main ../csu/libc-start.c:308
        #4 0x4023ad in _start (/home/yuan/tinygl/examples/raw/gears+0x4023ad)
    
  • Fix incorrect buffer range check of glDrawText

    Fix incorrect buffer range check of glDrawText

    There's a mistake on the check of glDrawText to not overflow the pixel buffer. Taking sdl/hello.c for example, which uses the 640x480 size window, we can change the usage of glDrawText as the following:

    glDrawText((unsigned char *) "Hello World!\nFrom TinyGL", 0, 474, 0x00FFFFFF);
    

    Here's the result from the original codes. We can see that although 474 is not larger than 480, no words are shown on the screen.

    image

    After this patch fix, we can see that a part of the words will be displayed on the screen now.

    image

  • Fix makefile object order for correct dependency

    Fix makefile object order for correct dependency

    I couldn't build the example with the original makefile. This is the output when I try to use it:

    > make sdl_examples
    make[1]: Entering directory '/home/rin/Github/tinygl/examples/sdl'
    cc -Wall -O3 -std=c99 -DNDEBUG -Wno-unused-function -I../../include -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT   ../../lib/libTinyGL.a -lm -L/usr/lib/x86_64-linux-gnu -lSDL  gears.c   -o gears
    /usr/bin/ld: /tmp/ccJdxco2.o: in function `gear.constprop.0':
    gears.c:(.text+0x23): undefined reference to `tglNormal3f'
    /usr/bin/ld: gears.c:(.text+0x45): undefined reference to `tglBegin'
    /usr/bin/ld: gears.c:(.text+0xc5): undefined reference to `sincos'
    /usr/bin/ld: gears.c:(.text+0x122): undefined reference to `tglVertex3f'
    /usr/bin/ld: gears.c:(.text+0x159): undefined reference to `tglVertex3f'
    /usr/bin/ld: gears.c:(.text+0x175): undefined reference to `tglVertex3f'
    /usr/bin/ld: gears.c:(.text+0x1ae): undefined reference to `sincos'
    ...
    

    As the output shows, the linker can't find the related symbol in the shared library/static library. To solve this problem, we should put $(LDFLAGS) after *.c file(s) to provide the correct dependency.

Related tags
OpenGL Template Engine - a C++ OpenGL graphics engine which aimed to be a simple startup template for 3D OpenGL projects.
OpenGL Template Engine - a C++ OpenGL graphics engine which aimed to be a simple startup template for 3D OpenGL projects.

OpenGL Template Engine is a C++ OpenGL graphics engine which aimed to be a simple startup template for 3D OpenGL projects. This is the template I personally use for my own projects and provides me with the general OpenGL 3D render setup with model import and UI.

May 16, 2022
A subset of WidgetsFlutterBinding specifically for initializing the ServicesBinding.

flutter_services_binding A subset of WidgetsFlutterBinding specifically for initializing the ServicesBinding. When executing runApp within a custom Zo

Apr 4, 2022
Code for the paper Succinct k-mer Set Representations Using Subset Rank Queries on the Spectral Burrows-Wheeler Transform (SBWT)

SBWT This is the code for the paper Succinct k-mer Set Representations Using Subset Rank Queries on the Spectral Burrows-Wheeler Transform (SBWT). The

Jun 18, 2022
Several GX2 test programs to compare it with OpenGL. (With additional GLFW+OpenGL implementation provided)

GX2-Tests Provided are GX2 test programs and samples for comparison with OpenGL and with additional GLFW+OpenGL implementation for test on PC. These s

Nov 15, 2021
Small Header-Only Window and OpenGL Manager.
Small Header-Only Window and OpenGL Manager.

LxDemOWin Linux Demo OpenGL and Window manager A small header-Only Window and OpenGL manager made in C, written in about 2 hours. With some basic code

Jun 4, 2022
Small Header-Only Window and OpenGL Manager.
Small Header-Only Window and OpenGL Manager.

LxDemOWin Linux Demo OpenGL and Window manager A small header-Only Window and OpenGL manager made in C, written in about 2 hours. With some basic code

Dec 11, 2021
A FREE Windows C development course where we will learn the Win32API and reverse engineer each step utilizing IDA Free in both an x86 and x64 environment.
A FREE Windows C development course where we will learn the Win32API and reverse engineer each step utilizing IDA Free in both an x86 and x64 environment.

FREE Reverse Engineering Self-Study Course HERE Hacking Windows The book and code repo for the FREE Hacking Windows book by Kevin Thomas. FREE Book Do

Sep 25, 2022
C++11 header-only library that offers small vector, small flat map/set/multimap/multiset.

sfl library This is header-only C++11 library that offers several new containers: small_vector small_flat_set small_flat_map small_flat_multiset small

Aug 23, 2022
A small, dependency-free node editor extension for dear imgui.
A small, dependency-free node editor extension for dear imgui.

imnodes A small, dependency-free node editor extension for dear imgui. Features: Create nodes, links, and pins in an immediate-mode style Single heade

Oct 1, 2022
A fast and small port of Zstandard to WASM.

Zstandard WASM A fast and small port of Zstandard to WASM. (Decompress-only for now). Features Fast: Zstandard has been compiled with the -03 flag, so

Jul 27, 2022