Font conundrum

Jones
Unregistered
 
Post: #16
Png's support transparency? Blink

Where have I been living for the last while...
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #17
In real life LOL

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Jones
Unregistered
 
Post: #18
unknown Wrote:In real life LOL

Smile

Sadly, I remember why I didn't use PNG's... DevIL (which uses libpng for png support) just crahes with memory errors upon attempting to load them.

Grrr. Mad

Any *other* formats that support transparency, besides TIFF/PNG/GIF?
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #19
Just to answer the original question, FaceSize adjusts the size. The performance concerns of FTGL lies in the use of texture fonts, which as lightbringer said, is easy to fix. You can also use polygon fonts (for larger text), or smooth polygon fonts by combining polygon and outline fonts.
Quote this message in a reply
Jones
Unregistered
 
Post: #20
Well, I'm trying out glFont, which is 50% Incompatible with Mac OS X. (The glyph generator is win32. I wonder if I could get the source and port it to Mac...)

But I've looked at the headers for loading and display glFont files, and they seem completely system independent.

Except for glFont 2, which appears to use a couple of M$ Dll's. Maybe not, I'll see.

Either that or I'll use glutFonts and be done with it. Less API's and junk that way.
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #21
Quote:TIFF/PNG/GIF?
LOL! OMG just use a seperate image as an alpha channel
(expecting a new thread about that soon Rasp )

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #22
DevIL is truly a piece of junk if it can't even use libpng correctly :|
Quote this message in a reply
Jones
Unregistered
 
Post: #23
OneSadCookie Wrote:DevIL is truly a piece of junk if it can't even use libpng correctly :|

FTGL is crap, DevIL is junk... EVERY SINGLE API I USE IS SMURF! Mad

*borrows official IDG shovel*
*digs large cave*

<fake french accent>
"Ahh, yes, this is where I will live/hide while I re-design the entire concept of Binary, and computer hardware. Then I shall program an operating system, but only once I've made an actual programming language... with binary, of course. *Then* I shall design my very own image loading API. Yesss... my plan is perfect!"
</fake french accent>

Quote:LOL! OMG just use a seperate image as an alpha channel
(expecting a new thread about that soon )

You can do that? Blink

But not easily, you'd still have to overlay them to get a resulting transparency. Meh, I'd rather go ahead and write my own routine to load PNG files. Shouldn't be too hard (LIES... ALL LIES!), once I find out what's actually in a PNG file... links? Google doesn't return much on the subject.

Thanks!

EDIT: In the meantime, I shall write up some Big-Endian support for glFont...
Quote this message in a reply
Moderator
Posts: 770
Joined: 2003.04
Post: #24
Are you loading hundreds of textures? Otherwise, I personally find SDL_image fast enough.
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #25
Jones Wrote:Meh, I'd rather go ahead and write my own routine to load PNG files. Shouldn't be too hard (LIES... ALL LIES!), once I find out what's actually in a PNG file... links? Google doesn't return much on the subject.
Take a look at libpng if you want to load them at a lower level. It's probably not ideal for you to learn the file format and write your own parser, as it would be a lot of wasted effort on your part, have to be maintained, may not be as efficient or compatible as the official library, etc.
Quote this message in a reply
Jones
Unregistered
 
Post: #26
PowerMacX Wrote:Are you loading hundreds of textures? Otherwise, I personally find SDL_image fast enough.

Unfortunatly, I'm on GLUT so no luck there. Annoyed And there'd still be the problem of converting SDL_Surfaces to glTex's, which would make up for any speed gained from the SDL_Image library. Thanks though!

Quote:Take a look at libpng if you want to load them at a lower level. It's probably not ideal for you to learn the file format and write your own parser, as it would be a lot of wasted effort on your part, have to be maintained, may not be as efficient or compatible as the official library, etc.

Tried that... and hated it. I understood vaguely what the code meant, but only enough to realize that if it broke, I'd be stuck with no idea what to do. That's why I liked DevIL, but it broke too, and I'm still stuck. So perhaps I *will* give libpng another try, couldn't hurt.

Well, let's see how long it takes before I'm back here... bets, anyone?
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #27
This is my intel and ppc compatable deprecated quicktime code:
Code:
- (void)loadTexture:(GLuint*)texture :(int*)width :(int*)height :(NSString*)texture_path
{
    glBindTexture(GL_TEXTURE_RECTANGLE_EXT, *texture);
    glEnable(GL_TEXTURE_RECTANGLE_EXT);
    
    CFStringRef filePath = CFStringCreateWithCString(kCFAllocatorDefault, (const char*)[texture_path cString], kCFStringEncodingASCII);
    
    Handle dataRef;
    OSType dataRefType;
    ComponentInstance fileImporter;
    ComponentResult error;
    ImageDescriptionHandle imageInfo;
    OSErr err;
    
    dataRef = NewHandle(sizeof(AliasHandle));
    err = QTNewDataReferenceFromFullPathCFString(filePath, kQTPOSIXPathStyle, 0, &dataRef, &dataRefType);
        
    err = GetGraphicsImporterForDataRef(dataRef, dataRefType, &fileImporter);
    
    imageInfo = (ImageDescriptionHandle)NewHandle(sizeof(ImageDescription));
    
    err = GraphicsImportGetImageDescription(fileImporter, &imageInfo);
    
    int depth;
    
    *width = (**imageInfo).width;
    *height = (**imageInfo).height;
    depth = (**imageInfo).depth;
    
    unsigned long imageSize;
    Ptr imageData;
    
    imageSize = (*width) * (*height) * 4;
    imageData = (Ptr)malloc(imageSize);
    
    Rect imageRect;
    
    err = GraphicsImportGetNaturalBounds(fileImporter, &imageRect);
    
    GWorldPtr offscreenBuffer;
    long bytesPerRow;
    
    bytesPerRow = (**imageInfo).width * 4;
    error = QTNewGWorldFromPtr(&offscreenBuffer, k32ARGBPixelFormat, &imageRect, NULL, NULL, kNativeEndianPixMap, imageData, bytesPerRow);
    error = GraphicsImportSetGWorld(fileImporter, offscreenBuffer, NULL);
    error = GraphicsImportDraw(fileImporter);
    
    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
    glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, GL_RGBA8, *width, *height, 0, GL_BGRA,
#if __BIG_ENDIAN__
    GL_UNSIGNED_INT_8_8_8_8_REV
#else
    GL_UNSIGNED_INT_8_8_8_8
#endif
    , imageData);
    
    error = CloseComponent(fileImporter);
    DisposeHandle((Handle)imageInfo);
    DisposeHandle(dataRef);
    
    if (imageData != NULL) {
        DisposePtr(imageData);
        imageData = NULL;
    }
    
    if (offscreenBuffer != NULL) {
        DisposeGWorld(offscreenBuffer);
        offscreenBuffer = NULL;
    }
  
    glTexParameterf(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_S, GL_CLAMP);
    glTexParameterf(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_T, GL_CLAMP);
    glTexParameterf(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameterf(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
}

feel free to do whatever you want with it.

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Jones
Unregistered
 
Post: #28
unknown Wrote:This is my intel and ppc compatable deprecated quicktime code:
Code:
- (void)loadTexture:(GLuint*)texture :(int*)width :(int*)height :(NSString*)texture_path
{
    glBindTexture(GL_TEXTURE_RECTANGLE_EXT, *texture);
    glEnable(GL_TEXTURE_RECTANGLE_EXT);
    
    CFStringRef filePath = CFStringCreateWithCString(kCFAllocatorDefault, (const char*)[texture_path cString], kCFStringEncodingASCII);
    
    Handle dataRef;
    OSType dataRefType;
    ComponentInstance fileImporter;
    ComponentResult error;
    ImageDescriptionHandle imageInfo;
    OSErr err;
    
    dataRef = NewHandle(sizeof(AliasHandle));
    err = QTNewDataReferenceFromFullPathCFString(filePath, kQTPOSIXPathStyle, 0, &dataRef, &dataRefType);
        
    err = GetGraphicsImporterForDataRef(dataRef, dataRefType, &fileImporter);
    
    imageInfo = (ImageDescriptionHandle)NewHandle(sizeof(ImageDescription));
    
    err = GraphicsImportGetImageDescription(fileImporter, &imageInfo);
    
    int depth;
    
    *width = (**imageInfo).width;
    *height = (**imageInfo).height;
    depth = (**imageInfo).depth;
    
    unsigned long imageSize;
    Ptr imageData;
    
    imageSize = (*width) * (*height) * 4;
    imageData = (Ptr)malloc(imageSize);
    
    Rect imageRect;
    
    err = GraphicsImportGetNaturalBounds(fileImporter, &imageRect);
    
    GWorldPtr offscreenBuffer;
    long bytesPerRow;
    
    bytesPerRow = (**imageInfo).width * 4;
    error = QTNewGWorldFromPtr(&offscreenBuffer, k32ARGBPixelFormat, &imageRect, NULL, NULL, kNativeEndianPixMap, imageData, bytesPerRow);
    error = GraphicsImportSetGWorld(fileImporter, offscreenBuffer, NULL);
    error = GraphicsImportDraw(fileImporter);
    
    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
    glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, GL_RGBA8, *width, *height, 0, GL_BGRA,
#if __BIG_ENDIAN__
    GL_UNSIGNED_INT_8_8_8_8_REV
#else
    GL_UNSIGNED_INT_8_8_8_8
#endif
    , imageData);
    
    error = CloseComponent(fileImporter);
    DisposeHandle((Handle)imageInfo);
    DisposeHandle(dataRef);
    
    if (imageData != NULL) {
        DisposePtr(imageData);
        imageData = NULL;
    }
    
    if (offscreenBuffer != NULL) {
        DisposeGWorld(offscreenBuffer);
        offscreenBuffer = NULL;
    }
  
    glTexParameterf(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_S, GL_CLAMP);
    glTexParameterf(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_T, GL_CLAMP);
    glTexParameterf(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameterf(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
}

feel free to do whatever you want with it.

Thanks, but that uses cocoa (at least a little?), does it not? I know nothing about cocoa, and I'd like to keep windows support. Would quicktime stuff work on PC's? Quicktime *player* works on windows...

I continued one of my past threads, from a while back, here:

http://www.idevgames.com/forum/showthrea...post118166

I'm having some libpng trouble, I stuck it there instead of starting a whole new thread, like I so often do Wink.

Thanks!
Quote this message in a reply
Post Reply