loading...

OpenGL Text Patterns

ASCII Art

Pattern code:
    const char *aa = " .:~+%&@";
    const int aa_chars = 8;

    for(int y = 0; y < CHARS_VERT; ++y)
    {
	for(int x = 0; x < CHARS_HORIZ; ++x)
	{
	    int xc = x - cx; // centered coords
	    int yc = y - cy;

	    float a = (float)atan2(xc, yc);
	    float r2 = (float)(xc*xc + yc*yc);

	    float c01 =
		    sinf(
		    sinf(a*3.0f-t*0.03f) * 1.7f + 1.0f +
		    sinf(a*5.0f+t*0.025f) * 1.7f + 1.0f +
		    sinf(a*7.0f-t*0.02f) * 1.7f + 1.0f +
		    sinf(a*11.0f+t*0.015f) * 1.7f + 1.0f +
		    r2 * 0.003f - t * 0.05f) * 0.5f + 0.5f;

	    data[y*CHARS_HORIZ+x] = aa[((int)(c01*0.999f*aa_chars)) % aa_chars];
	}
    }

Warped Text


Warped Hello World:

Shadow over Innsmouth: