BlueMonkMN's picture

Font problems

It appears the text that I draw is being anti-aliased. It's as if the viewport is the wrong size or something. What could be causing this (see attachment)?

Also, I noticed that the following statement cause all my text to come out as solid blocks of color instead of as letters?


I'm still relatively new to OpenGL, and I'm guessing it's because that code tells GL to texture the output from the TextureRectangleNv texture target (if that even makes sense, I'm not sure). I could use a clue when it comes to texture targets. I'm using that code so that I can access my graphics when drawing sprites and tiles. I've just updated my code to disable that (rather than re-binding to texture number 0) when performing non-textured operations.

Also, I'm aware that NvTextureRectangle is not really an EnableCap, but EnableCap seems to be missing the necessary value, and this happens to be relevant and have the correct value. Is there a better way to do this?

text.PNG8.42 KB


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

Hm, this is an interaction I hadn't foreseen. IIRC, NvTextureRectangle changes the texcoord calculations so that they range from [0, texture-size], instead of [0.0, 1.0]. I don't think there's anything we can do on the OpenTK side about this (without hurting performance too much) - the best solution is to simply disable this prior to rendering fonts.

One suggestion though: non-power-of-two textures are part of the OpenGL 2.0 spec, i.e. if your card reports 2.0 or higher to GL.GetString(StringName.Version) you'll be able to create and use such textures at will (this should work on R300/Geforce FX and newer cards). For older cards, there's also a cross-vendor extension (I don't remember if it's Ext or Arb), which should be preferred over the vendor-specific Nv extension.

This only lists tokens for core functions, a few select extensions and the Sgi crap we haven't managed to tear out yet. As you found out, you'll have to cast any extension token you wish to use. :)

Check the other thread.