~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to intern/bmfont/intern/BMF_BitmapFont.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2005-11-06 12:40:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051106124003-3pgs7tcg5rox96xg
Tags: 2.37a-1.1
* Non-maintainer upload.
* Split out parts of 01_SConstruct_debian.dpatch again: root_build_dir
  really needs to get adjusted before the clean target runs - closes: #333958,
  see #288882 for reference

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * $Id: BMF_BitmapFont.cpp,v 1.3 2002/11/25 09:52:47 mein Exp $
 
2
 * $Id: BMF_BitmapFont.cpp,v 1.9 2005/06/08 18:54:17 ton Exp $
3
3
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
4
4
 *
5
5
 * This program is free software; you can redistribute it and/or
31
31
 
32
32
/**
33
33
 
34
 
 * $Id: BMF_BitmapFont.cpp,v 1.3 2002/11/25 09:52:47 mein Exp $
 
34
 * $Id: BMF_BitmapFont.cpp,v 1.9 2005/06/08 18:54:17 ton Exp $
35
35
 * Copyright (C) 2001 NaN Technologies B.V.
36
36
 */
37
37
 
69
69
{
70
70
}
71
71
 
 
72
#ifdef __APPLE__
 
73
#include <stdio.h>
 
74
static int is_a_really_crappy_nvidia_card(void) {
 
75
        static int well_is_it= -1;
 
76
        
 
77
        /* Do you understand the implication? Do you? */
 
78
        if (well_is_it==-1) {
 
79
                well_is_it= (strncmp((char *)glGetString(GL_RENDERER), "NVIDIA GeForce 6800", 18) == 0);
 
80
        }
 
81
        return well_is_it;
 
82
}
 
83
#endif
72
84
 
73
85
void BMF_BitmapFont::DrawString(char* str)
74
86
{
75
87
        GLint alignment;
76
88
        unsigned char c;
77
 
                
 
89
 
 
90
#ifdef __APPLE__
 
91
        GLint vp[4];  // hack stuff
 
92
        GLubyte nullm = 0;      // hack stuff
 
93
        
 
94
        if(is_a_really_crappy_nvidia_card()) {
 
95
                glGetIntegerv(GL_VIEWPORT, vp);   // hack stuff
 
96
                
 
97
                glBitmap(1, 1, 0, 0, -vp[0], vp[1], &nullm); 
 
98
                
 
99
        }
 
100
#endif
78
101
        glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
79
102
        glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
80
 
 
81
 
        while (c = (unsigned char) *str++) {
 
103
        
 
104
        while ( (c = (unsigned char) *str++) ) {
82
105
                BMF_CharData & cd = m_fontData->chars[c];
83
106
                
84
107
                if (cd.data_offset==-1) {
101
124
        unsigned char c;
102
125
        int length = 0;
103
126
 
104
 
        while (c = (unsigned char) *str++) {
 
127
        while ( (c = (unsigned char) *str++) ) {
105
128
                length += m_fontData->chars[c].advance;
106
129
        }
107
130
        
185
208
        int baseLine = -(m_fontData->ymin);
186
209
 
187
210
        glBegin(GL_QUADS);
188
 
        while (c = (unsigned char) *str++) {
 
211
        while ( (c = (unsigned char) *str++) ) {
189
212
                BMF_CharData & cd = m_fontData->chars[c];
190
213
                
191
214
                if (cd.data_offset != -1) {