I believe I am having an issue with freetype and multi-texturing. If you look at the bottom left above the sbar in the image I provide you will see some garbage. It's correctly loading the font but the textures seem to smash together.
Can anyone explain this? I'm new to OpenGL and I'm trying to add a proper font renderer to Quake. Thank you very much.
Issue with multi-texture and freetype?
many engines have a -nomtex, if you think its multitexture, try that.
Normally, multitexture is only active for as long as its used. Traditionally the function that switched it on is the one that is meant to switch it off.
And yes, those look like hud images. Are you sure you switched textures correctly? If you're using Draw_Pic, you will need to make sure you generate the correct glpics.
If you want an average font to be readable, it needs to be at least 12 pixels high (instead of 8), you need to support variable-width chars correctly, and you need to align your font and texture coords to the screen pixels correctly. Failure with any of those will result in ugly unreadable bluryness, depending on the font. Don't just convert font to conchar-grid on load, unless you like laughing.
For further reading, FTE contains support for freetype2 already, note that it uses vertex arrays and its rendering backend.
Normally, multitexture is only active for as long as its used. Traditionally the function that switched it on is the one that is meant to switch it off.
And yes, those look like hud images. Are you sure you switched textures correctly? If you're using Draw_Pic, you will need to make sure you generate the correct glpics.
If you want an average font to be readable, it needs to be at least 12 pixels high (instead of 8), you need to support variable-width chars correctly, and you need to align your font and texture coords to the screen pixels correctly. Failure with any of those will result in ugly unreadable bluryness, depending on the font. Don't just convert font to conchar-grid on load, unless you like laughing.
For further reading, FTE contains support for freetype2 already, note that it uses vertex arrays and its rendering backend.
I doubt if there's a specific problem with freetype and multitexturing. All freetype does is create a font bitmap that you then convert to a texture using normal OpenGL calls, so for my money what's happening is that you have the extra texture unit(s) still active and/or enabled.
For debugging purposes, stick this block of code before you do any text drawing:
That'll confirm it quickly enough. Then you need to find out where the correct place in your code to do this is, so run your engine with GLIntercept and log your GL calls, then check the log to get a better handle for what's going on.
For debugging purposes, stick this block of code before you do any text drawing:
Code: Select all
glActiveTexture (GL_TEXTURE3);
glDisable (GL_TEXTURE_2D);
glActiveTexture (GL_TEXTURE2);
glDisable (GL_TEXTURE_2D);
glActiveTexture (GL_TEXTURE1);
glDisable (GL_TEXTURE_2D);
glActiveTexture (GL_TEXTURE0);
glEnable (GL_TEXTURE_2D);
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
Alright so it isn't multi-texturing. I ran under -nomtex mode (which the engine supports) and no avail.Spike wrote:many engines have a -nomtex, if you think its multitexture, try that.
Normally, multitexture is only active for as long as its used. Traditionally the function that switched it on is the one that is meant to switch it off.
And yes, those look like hud images. Are you sure you switched textures correctly? If you're using Draw_Pic, you will need to make sure you generate the correct glpics.
If you want an average font to be readable, it needs to be at least 12 pixels high (instead of , you need to support variable-width chars correctly, and you need to align your font and texture coords to the screen pixels correctly. Failure with any of those will result in ugly unreadable bluryness, depending on the font. Don't just convert font to conchar-grid on load, unless you like laughing.
For further reading, FTE contains support for freetype2 already, note that it uses vertex arrays and its rendering backend.
I am not using Draw_Pic, I am doing that my self. Thank you for the tips by the way, I prepared for most of this already thankfully.
I do what you say and it crashes on the first glDisable so I modified it to the followingmh wrote:I doubt if there's a specific problem with freetype and multitexturing. All freetype does is create a font bitmap that you then convert to a texture using normal OpenGL calls, so for my money what's happening is that you have the extra texture unit(s) still active and/or enabled.
For debugging purposes, stick this block of code before you do any text drawing: [snip]
That'll confirm it quickly enough. Then you need to find out where the correct place in your code to do this is, so run your engine with GLIntercept and log your GL calls, then check the log to get a better handle for what's going on.
Code: Select all
GL_SelectTexture(GL_TEXTURE1);
glDisable(GL_TEXTURE_2D);
GL_SelectTexture(GL_TEXTURE0);
glEnable(GL_TEXTURE_2D);
I don't believe I am using GL_CLAMP anywhere. GL_REPEAT is only used twice and I've tried changing that to no avail. I don't believe this is the issue, though as it certainly doesn't seem to look it. Thank you for the help so far guys. I'm still smashing my tits against code to try and figure this out.Downsider wrote:GL_CLAMP vs GL_REPEAT? Try setting one of those after using freetype. Might be the issue.
Funny that you say that. I've tried using glBindTexture and GL_Bind.Spike wrote:you're using GL_Bind throughout, and not glBindTexture (even for texture creation)?
When I use GL_Bind rather than glBindTexture I get this instead of the above. Hmmm, this makes me think.
(It changes depending on what's on screen now)
This is definitely a binding issue. I'll look through the freetype texture code. Many thanks! I'll return later with a new shiny fixed image.Spike wrote:GL_Bind has an internal cache. if you use glBindTexture directly other than through GL_Bind, you break that internal cache, and everything goes kaboom, or at least doesn't switch textures properly as you would expect it to.