OpenGL Text Rendering (in Cocoa) - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: OpenGL Text Rendering (in Cocoa) (/thread-1745.html)
OpenGL Text Rendering (in Cocoa) - daveh84 - Feb 18, 2009 11:17 AM
I'm curious as to how you guys generally go about rendering text in an OpenGL context. There are glut methods which in my experience are very limited, and the only other method I am aware of is using NSTextView subclasses as OpenGLView subviews and NSOpenGLCPSurfaceOrder.
The latter method is not resolution-independent, and (perhaps it is my fault due to some code-ordering issue, but) when moving these subviews around in response to the dynamic scrolling game world, they seem to lag behind - that is, they are not redrawn at the same time as the open gl content.
Has anyone experimented with using a characters texture and characters of varying widths? Is it possible for the widths of characters to vary as a result of those next to them? Would anyone be interested in helping me optimize an open source Cocoa Class that supports sizable text? I'm going to work on such a class and upload it here; perhaps it will be of use.
Maybe once static text drawing is implemented, I will implement the option to make this text editable.
OpenGL Text Rendering (in Cocoa) - backslash - Feb 18, 2009 11:39 AM
I've got a class which generates OpenGL textures using FreeType. OneSadCookie posted some code that creates textures from NSView and its subclasses, which is pretty cool. There are a couple of other font libraries out there, or of course there's always the tried and trusted method of pre-rendering your character set into a PNG.
OpenGL Text Rendering (in Cocoa) - DoG - Feb 19, 2009 03:46 AM
The Cocoa OpenGL example shows how to do it. Look for GLString.m
OpenGL Text Rendering (in Cocoa) - TomorrowPlusX - Feb 19, 2009 05:53 AM
DoG Wrote:The Cocoa OpenGL example shows how to do it. Look for GLString.m
Where's this demo? I'd like to check it out.
OpenGL Text Rendering (in Cocoa) - DoG - Feb 19, 2009 11:55 AM
I must admit, it is mighty hard to find. If you type it into google, it is inconveniently placed at the top of the page
Incidentally, GLString has a few weaknesses, I have a by now much more flexible and only slightly more complex code based on it that allows simple drawing of all kinds of Quartz stuff into textures. I'll post it as udg08 wraps up.
OpenGL Text Rendering (in Cocoa) - TomorrowPlusX - Feb 19, 2009 12:44 PM