AquariaOSE / Aquaria

Aquaria open source, forked from icculus.org due to inactivity. Has many enhancements compared to the original version.
http://bit-blot.com/aquaria
GNU General Public License v2.0
299 stars 82 forks source link

Fix use of system FTGL #54

Open chewi opened 7 years ago

chewi commented 7 years ago

Without this, it complains about FTGLTextureFont being an incomplete class and other weirdness.

fgenesis commented 7 years ago

Could you show the build error? I can't see where/why this would be necessary... I think i had moved this at some point because somewhere down the include chain FTGL does #include (hence the #undef GetCharWidth, min, max), and having this spill into every header that somehow includes this is very sad.

chewi commented 7 years ago

The other GL stuff is due to the missing RenderBase.h include. I guess the FTGL header was implicitly pulling the GL stuff in.

[ 10%] Building CXX object CMakeFiles/aquaria.dir/BBGE/TTFFont.cpp.o
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp: In destructor ‘TTFFont::~TTFFont()’:
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:47:10: warning: possible problem detected in invocation of delete operator: [-Wdelete-incomplete]
   delete font;
          ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:47:10: warning: invalid use of incomplete type ‘class FTGLTextureFont’
In file included from /home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:22:0:
/home/chewi/Projects/Aquaria/BBGE/TTFFont.h:26:7: note: forward declaration of ‘class FTGLTextureFont’
 class FTGLTextureFont;
       ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:47:10: note: neither the destructor nor the class-specific operator delete will be called, even if they are declared when the class is defined
   delete font;
          ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp: In member function ‘void TTFFont::destroy()’:
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:56:10: warning: possible problem detected in invocation of delete operator: [-Wdelete-incomplete]
   delete font;
          ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:56:10: warning: invalid use of incomplete type ‘class FTGLTextureFont’
In file included from /home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:22:0:
/home/chewi/Projects/Aquaria/BBGE/TTFFont.h:26:7: note: forward declaration of ‘class FTGLTextureFont’
 class FTGLTextureFont;
       ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:56:10: note: neither the destructor nor the class-specific operator delete will be called, even if they are declared when the class is defined
   delete font;
          ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp: In member function ‘void TTFFont::load(const string&, int)’:
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:63:7: error: cannot convert ‘FTTextureFont*’ to ‘FTGLTextureFont*’ in assignment
  font = new FTGLTextureFont(str.c_str());
       ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:64:6: error: invalid use of incomplete type ‘class FTGLTextureFont’
  font->FaceSize(sz);
      ^
In file included from /home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:22:0:
/home/chewi/Projects/Aquaria/BBGE/TTFFont.h:26:7: note: forward declaration of ‘class FTGLTextureFont’
 class FTGLTextureFont;
       ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp: In member function ‘void TTFFont::create(const unsigned char*, long unsigned int, int)’:
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:69:7: error: cannot convert ‘FTTextureFont*’ to ‘FTGLTextureFont*’ in assignment
  font = new FTGLTextureFont(data, datalen);
       ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:70:6: error: invalid use of incomplete type ‘class FTGLTextureFont’
  font->FaceSize(sz);
      ^
In file included from /home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:22:0:
/home/chewi/Projects/Aquaria/BBGE/TTFFont.h:26:7: note: forward declaration of ‘class FTGLTextureFont’
 class FTGLTextureFont;
       ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp: In member function ‘void TTFText::updateAlign()’:
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:100:12: error: invalid use of incomplete type ‘class FTGLTextureFont’
  font->font->BBox(originalText.c_str(), llx, lly, llz, urx, ury, urz);
            ^
In file included from /home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:22:0:
/home/chewi/Projects/Aquaria/BBGE/TTFFont.h:26:7: note: forward declaration of ‘class FTGLTextureFont’
 class FTGLTextureFont;
       ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp: In member function ‘virtual float TTFText::getStringWidth(const string&)’:
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:137:14: error: invalid use of incomplete type ‘class FTGLTextureFont’
    font->font->BBox(p, llx, lly, llz, urx, ury, urz);
              ^
In file included from /home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:22:0:
/home/chewi/Projects/Aquaria/BBGE/TTFFont.h:26:7: note: forward declaration of ‘class FTGLTextureFont’
 class FTGLTextureFont;
       ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:145:13: error: invalid use of incomplete type ‘class FTGLTextureFont’
   font->font->BBox(start + begin, llx, lly, llz, urx, ury, urz);
             ^
In file included from /home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:22:0:
/home/chewi/Projects/Aquaria/BBGE/TTFFont.h:26:7: note: forward declaration of ‘class FTGLTextureFont’
 class FTGLTextureFont;
       ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp: In member function ‘void TTFText::updateFormatting()’:
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:178:14: error: invalid use of incomplete type ‘class FTGLTextureFont’
    font->font->BBox(part.c_str(), llx, lly, llz, urx, ury, urz);
              ^
In file included from /home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:22:0:
/home/chewi/Projects/Aquaria/BBGE/TTFFont.h:26:7: note: forward declaration of ‘class FTGLTextureFont’
 class FTGLTextureFont;
       ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:190:14: error: invalid use of incomplete type ‘class FTGLTextureFont’
    font->font->BBox(part.c_str(), llx, lly, llz, urx, ury, urz);
              ^
In file included from /home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:22:0:
/home/chewi/Projects/Aquaria/BBGE/TTFFont.h:26:7: note: forward declaration of ‘class FTGLTextureFont’
 class FTGLTextureFont;
       ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:207:15: error: invalid use of incomplete type ‘class FTGLTextureFont’
     font->font->BBox(part.c_str(), llx, lly, llz, urx, ury, urz);
               ^
In file included from /home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:22:0:
/home/chewi/Projects/Aquaria/BBGE/TTFFont.h:26:7: note: forward declaration of ‘class FTGLTextureFont’
 class FTGLTextureFont;
       ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:219:13: error: invalid use of incomplete type ‘class FTGLTextureFont’
   font->font->BBox(part.c_str(), llx, lly, llz, urx, ury, urz);
             ^
In file included from /home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:22:0:
/home/chewi/Projects/Aquaria/BBGE/TTFFont.h:26:7: note: forward declaration of ‘class FTGLTextureFont’
 class FTGLTextureFont;
       ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:223:25: error: invalid use of incomplete type ‘class FTGLTextureFont’
  lineHeight = font->font->LineHeight();
                         ^
In file included from /home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:22:0:
/home/chewi/Projects/Aquaria/BBGE/TTFFont.h:26:7: note: forward declaration of ‘class FTGLTextureFont’
 class FTGLTextureFont;
       ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp: In member function ‘virtual void TTFText::onRender()’:
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:256:42: error: ‘glColor4f’ was not declared in this scope
    glColor4f(0,0,0,0.75f*alpha.x*alphaMod);
                                          ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:257:17: error: ‘glPushMatrix’ was not declared in this scope
    glPushMatrix();
                 ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:258:21: error: ‘glScalef’ was not declared in this scope
    glScalef(1, -1, 0);
                     ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:259:47: error: ‘glTranslatef’ was not declared in this scope
    glTranslatef(1 -hw, -1 + (i*-lineHeight), 0);
                                               ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:260:14: error: invalid use of incomplete type ‘class FTGLTextureFont’
    font->font->Render(text[i].c_str());
              ^
In file included from /home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:22:0:
/home/chewi/Projects/Aquaria/BBGE/TTFFont.h:26:7: note: forward declaration of ‘class FTGLTextureFont’
 class FTGLTextureFont;
       ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:261:16: error: ‘glPopMatrix’ was not declared in this scope
    glPopMatrix();
                ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:265:56: error: ‘glColor4f’ was not declared in this scope
   glColor4f(color.x, color.y, color.z, alpha.x*alphaMod);
                                                        ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:266:16: error: ‘glPushMatrix’ was not declared in this scope
   glPushMatrix();
                ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:267:20: error: ‘glScalef’ was not declared in this scope
   glScalef(1, -1, 0);
                    ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:268:43: error: ‘glTranslatef’ was not declared in this scope
   glTranslatef(-hw, 0 + (i*-lineHeight), 0);
                                           ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:269:13: error: invalid use of incomplete type ‘class FTGLTextureFont’
   font->font->Render(text[i].c_str());
             ^
In file included from /home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:22:0:
/home/chewi/Projects/Aquaria/BBGE/TTFFont.h:26:7: note: forward declaration of ‘class FTGLTextureFont’
 class FTGLTextureFont;
       ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:270:15: error: ‘glPopMatrix’ was not declared in this scope
   glPopMatrix();
               ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:273:16: error: ‘GL_TEXTURE_2D’ was not declared in this scope
  glBindTexture(GL_TEXTURE_2D, 0);
                ^
/home/chewi/Projects/Aquaria/BBGE/TTFFont.cpp:273:32: error: ‘glBindTexture’ was not declared in this scope
  glBindTexture(GL_TEXTURE_2D, 0);
                                ^
make[2]: *** [CMakeFiles/aquaria.dir/build.make:2559: CMakeFiles/aquaria.dir/BBGE/TTFFont.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:70: CMakeFiles/aquaria.dir/all] Error 2
make: *** [Makefile:128: all] Error 2