![]() |
|
Font rendering problem - Printable Version +- iDevGames Forums (http://www.idevgames.com/forums) +-- Forum: Development Zone (/forum-3.html) +--- Forum: Graphics & Audio Programming (/forum-9.html) +--- Thread: Font rendering problem (/thread-1593.html) |
Font rendering problem - wadesworld - Mar 18, 2009 02:45 PM I'm embarrassed to post this question, but while I've worked around other's OpenGL code a lot, I'm a newbie to writing my own OpenGL code. I'm trying to render a font to a texture. However, the rectangle is all black. I've tried absolutely everything I can think of and can't figure out what is assuredly a stupid error. When I use OpenGL Profiler to pause the program, I can see that the texture exists in memory, looks correct and has the correct ID. In short, I don't think my problem is with rendering the text to the texture or binding the texture. I've prepared a very small sample project illustrating the problem. The code is in GLView.m and there's a #define at the top of the file that allows you to toggle between a working image texture and the non-working font rendered to a texture. If anyone would be willing to take a look, I'd be eternally grateful. The code is at: http://www.dogwatchsw.com/code/TextureTest.zip Font rendering problem - AnotherJake - Mar 18, 2009 03:00 PM Add: Code: [helv12Black setObject:[NSColor whiteColor] forKey:NSBackgroundColorAttributeName];It's upside down, but I think you can figure it out from there. ![]() Also, you have a few other problems going on with your code. You need to pay attention to the warnings. In fact, I would suggest treating warnings as errors. Font rendering problem - wadesworld - Mar 18, 2009 10:45 PM AnotherJake Wrote:Add: Jake, Thanks....that got me on the right track. The texture was being drawn in black because GL_BEND hadn't been enabled. As for the other problems - I'm aware - it's just test code and the problems don't affect the issue at hand. Font rendering problem - AnotherJake - Mar 18, 2009 11:00 PM Don't know why you're seeing white on black. I see black on white on my machine. Perhaps this is an endian issue? I'm on an Intel. Don't know how to fix the transparency thing off-hand. I assumed you'd search through other Quartz drawing options for that, I just tried to get you seeing something to work with. If you can't find anything soon or someone else doesn't offer up a solution soon, then bump the thread and I'll be happy to dig into it a little more.
Font rendering problem - wadesworld - Mar 18, 2009 11:02 PM You replied while I was editing my post. I've got it now. Thanks for the idea. Font rendering problem - AnotherJake - Mar 18, 2009 11:11 PM Great, that's good news!
|