OpenGL Text Rendering (in Cocoa)
Hello,
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.
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.
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.
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.
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.

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.
You bastard.
(thanks)
(thanks)
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Fast rendering with OpenGL 1.1 | dotbianry | 4 | 1,301 |
Dec 18, 2012 03:58 AM Last Post: dotbianry |
|
| Opengl/Cocoa text rendering | tesil | 15 | 14,443 |
Mar 20, 2012 11:16 AM Last Post: OneSadCookie |
|
| SDL/OpenGL fullscreen text rendering | StealthyCoin | 2 | 5,370 |
Mar 26, 2009 09:47 AM Last Post: StealthyCoin |
|
| OpenGL & Cocoa - Improving frame rate | daveh84 | 4 | 4,921 |
Feb 2, 2009 06:53 AM Last Post: backslash |
|
| bad depth sorting in Cocoa OpenGL | aldermoore | 2 | 4,102 |
Dec 30, 2008 03:07 PM Last Post: ThemsAllTook |
|

