randi120 / freetype-gl

Automatically exported from code.google.com/p/freetype-gl
Other
0 stars 0 forks source link

Invalid format used for texture_atlas_upload #62

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
On line 341 of texture-atlas.c (the depth==1 case), the pixel format is 
GL_ALPHA:

        glTexImage2D( GL_TEXTURE_2D, 0, GL_ALPHA, self->width, self->height,
                      0, GL_ALPHA, GL_UNSIGNED_BYTE, self->data );

According to the docs (eg: 
http://www.opengl.org/sdk/docs/man/xhtml/glTexImage2D.xml ) GL_ALPHA is not a 
valid format, and this should probably be GL_RED, e.g.: 

        glTexImage2D( GL_TEXTURE_2D, 0, GL_RED, self->width, self->height,
                     0, GL_RED, GL_UNSIGNED_BYTE, self->data );

The distance-field fragment shaders then need to reference color.r instead of 
color.a.

Note that the original version with GL_ALPHA works fine on Win64 with nVidia 
GTX 680.  However it generates an INVALID_ENUM error at the glTexImage2D call 
on Mac OSX 10.8.4 with Intel HD 3000 (Mid2011 MBA) when using the 3.2 core 
profile, opened with GLFW 3.

Original issue reported on code.google.com by brian.fo...@gmail.com on 28 Jul 2013 at 11:50

GoogleCodeExporter commented 8 years ago
Thanks and sorry for the delay.

Could consider reporting the issue on github and make a pull request ?

Original comment by Nicolas.Rougier@gmail.com on 4 Oct 2013 at 1:13