Order of the Butterfly
Posts: 463 from 2003/7/26
From: Wroclaw/Poland
Quote:
bigfoot wrote:
I also just noticed that if I enable the FPS counter, the FPS counter misrenders the same way the report screen does.
Yes, FPS counter uses the same GUI-view and font.
Quote:bigfoot wrote:
If you have any suggestions as to what might be causing the misrendering, I'd be happy to hear!
Here's a screenshot of the problem. The end scroller and the settings GUI both seem to render correctly as far as I can tell, it's really only this results screen that's giving a problem.
Characters in each string (also wrapped) are created as one vertex array with proper coords, texcoords and (in case of a font with gradient) vertex colors. The vertex array is kept in string view and is recreated only if this is necessary (e.g.: the view is resized, the string is modified, color of the text is changed). Font uses texture in grayscale as alpha for flat (or gradient) faces:
Code:
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
This allows you to easily change the color of fonts because I use this:
Code:
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
Problem visible on your screenshot can concerns the texture. I use mipmapping… Maybe in case of grayscale textures there is a problem with generating mipmaps?
Code:
glGenTextures(1, &textureGLName);
glBindTexture(GL_TEXTURE_2D, textureGLName);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_ALPHA, width, height, GL_ALPHA, GL_UNSIGNED_BYTE, data);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
However… I don't think so because I use grayscale textures in GL_LUMINANCE and GL_ALPHA format very often on 3D objects and we see that everything looks correctly.
Only differece between rendering font mesh and object mesh is:
before rendering a font I use this:
Code:
glOrtho(0, viewport.getWidth(), 0, viewport.getHeight(), -1, 1);
before rendering a 3D mesh I use this:
Code:
gluPerspective(fovY, aspect, nearZ, farZ);
The report is rendered with disabled depth buffer testing
Code:
glDisable(GL_DEPTH_TEST);
disabled polygon culling:
Code:
and with alpha blending:
Code:
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
But these functions:
Code:
glDepthMask();
glDepthFunc();
are not used in case rendering of only 2D layer. On end scroller and in launcher before rendering 2D layer is rendered a 3D scene.
I will look for potential reason of the problem. Maybe I will detect more differences between rendering 3D+2D and only 2D...
[ Edited by MDW 12.07.2023 - 14:38 ]