Couple of Questions:
1. Why are you parsing the height instead of the width in this function:
[color=#000000]FT_Set_Pixel_Sizes[color=#666600]([color=#000000] face[color=#666600],[color=#000000] [color=#006666]0[color=#666600],[color=#000000] fontSize [color=#666600]);
i.e. why are you calling it like this?
[color=#000000]FT_Set_Pixel_Sizes[color=#666600]([color=#000000] face[color=#666600],[color=#000000] [color=#000000]fontSize[color=#666600],[color=#000000] [color=#006666]0[color=#666600]);
2. What are you doing with textureWidth and textureHeight?
[color=#000088]int[color=#000000] textureWidth [color=#666600]=[color=#000000] [color=#006666]0[color=#666600];
[color=#000088]int[color=#000000] textureHeight [color=#666600]=[color=#000000] [color=#006666]0[color=#666600];

I am having a really harsh time in trying to implement Font rendering into my Engine... Now I'm mainly getting pissed off with FreeType, I just can't seem to understand it 100%. I'm loading the Font with TrueType and then looping through all the glyphs in the font and saving them into one single big Texture, in ASCII order, and uploading them to OpenGL, but that's not working out so well.
I would really appreciate it if someone looked at my code and explain to me what I am doing wrong. At the moment I can't load a TrueType font and I doubt I'm rendering them correctly either but I am not sure as I have not tested it...
Here is how I am loading fonts; the maximum size of a font is defaulted to 20, to save into a Texture:
void OGLGraphicalAssetLoader::loadFontFromFile(const std::string& filepath, Font* output) const
{
FT_Library library; // a FreeType Library object
FT_Face face; // This holds the TrueType Font.
FT_Error error; // Holds any errors that could occur.
error = FT_Init_FreeType(&library); // Initialize the FreeType Library
if(error)
{
throw AnaxException("FreeType 2 Library could not be initialized", -2);
}
// Load the TrueType Font into memory
error = FT_New_Face(library, filepath.c_str(), 0, &face);
if(error)
{
throw AnaxException("Could not load TrueType Font: " + filepath, -2);
}
FT_Set_Char_Size(face, output->getMaxSize() * 64, output->getMaxSize() * 64, 96, 96); // Set the size of the Font
// Create a blank Texture (Image)
Image tempImage;
tempImage.create(face->glyph->bitmap.width, face->glyph->bitmap.rows);
Rect2DFloat textureCoords; // Holds temporary Texture Coordinates
Uint32 drawX = 0, drawY = 0; // The x and y coordinates that the glypth will be drawn to in the Texture.
// Loop through the Glyph's putting them in the Texture (Image)
for(int i = 0; i < 256; ++i)
{
Uint32 index = FT_Get_Char_Index(face, (char)i);
error = FT_Load_Glyph(face, index, FT_LOAD_DEFAULT);
if(error)
continue; // just ignore it.. (should throw an except or something along those lines
error = FT_Render_Glyph(face->glyph, FT_RENDER_MODE_NORMAL);
if(error)
continue; // just ignore it...
// Place Texture Coordinates
textureCoords.position.x = drawX + face->glyph->bitmap_left;
textureCoords.position.y = drawY - face->glyph->bitmap_top;
textureCoords.size.width = face->glyph->bitmap.width;
textureCoords.size.height = face->glyph->bitmap.rows;
setFontTextureCoordinateValueForGlyth(output, i, textureCoords); // Set the Texture Coordinates
// Render into Image
BlitGlypth(face->glyph, &tempImage, textureCoords.position.x, textureCoords.position.y);
// Increment drawing position
drawX += face->glyph->advance.x >> 6;
drawY += face->glyph->advance.y >> 6;
}
// Upload the Texture to OpenGL
Texture2D tempTexture;
loadTextureFromImage(tempImage, &tempTexture);
// Set the ID of the Font
setFontIdNumber(output, tempTexture.getID());
}
I'm not quite sure if I'm formatting each character correctly into my texture, also I do not know how to get or calculate the size that the Texture will be. When I am calling tempImage.create() it parses 0, 0 for the dimensions of the image... S:? Is it because there is not current glyph selected or..? How do I calculate what the Texture size should be.
Here is how I am drawing the Font's, using a Rectangle to draw them:
void OGLRenderer::renderText(const Renderable2DText& text)
{
const std::string& theCharactersToRender = text.getText();
Renderable2DRect& rect = getRectFromText(text);
// Loop through all the characters
for(int i = 0; i < theCharactersToRender.length(); ++i)
{
const Rect2DFloat& subRect = text.getFont()->getGlypth(i);
rect.setSubRect(subRect);
// Render the Rect
renderRect(rect);
rect.move(subRect.position.x, subRect.position.y);
}
}
If you need anymore detail on how I am implementing this, please say so

I am currently trying to get true-type fonts implemented in my Rendering Engine. I'm not sure on how to approach this, I've done a lot of Google-ing and from what I've read I can load a Texture from the True Type Font (.ttf) into VRAM for OpenGL to use and then draw each character with a quad or something similar, cropped appropriately (probably storing dimensions of where to crop each character in RAM, instead of calculating on the spot? S: e.g. Where along the x axis to crop to the actual pixels of the letter). Now I was thinking of doing it this way, but how would I dynamically make the font bolt or italic, I would have to re-load the texture into memory wouldn't I, or just put them side by side, or something? I don't know S:.
Now I've read somewhere, can't remember where that I could generate geometry from the font or something? I don't know, but would this be easier than doing what I mentioned above, if so, why? Also how should I implement that, I'm not sure on how to go on that. Would it be better than rendering each character as a quad from a texture, or drawing the text as geometry.
Many thanks for reading. (:

Thanks a lot, it seems not complain any more . Oh and V-man, my Mac OpenGL headers didn't seem to declare GL_TEXTURE_2D_ARRAY, but it did declare GL_TEXTURE_2D_EXT. Anyhow I wasn't using textures, so that wasn't the problem. Thanks again .

Well, I'm not sure if this will work or not, but assuming that you're using alpha values for the Water (or maybe you need alpha values for the reflection?), you should be enabling blending. Usually you use it like so, you can however use it many different ways though:
glEnable(GL_BLEND); // Enables blending for OpenGL
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Set the Blending function
There's a lot more OpenGL blending functions, but this might do the job, ask Google if you don't like it.
FAQ on Transperancy:
http://www.opengl.or...ransparency.htm
Sorry if you already know this, it just doesn't seem like your enabling blending o:

So currently I'm writing a Rendering Engine with OpenGL and possibly some other API's in the future (very far away ;)). Anyhow I have encountered a problem, I for some reason cannot seem to figure out how I should render my scene multiple times into different viewports. The first thing I did was create one display list and just encapsulate every function that was called prior to it into that display list.
For example:
// Render everything
renderer->beginDrawing(); // Creates a display list.
renderer->renderRectangle(); // Draws a rectangle (stores it in the display list), with transformations
renderer->finishDrawing(); // Ends the display list and renders everything to the screen.
Now I tried it and it seemed to work at first, but then I tried adding more objects in my scene and the transformations of the objects were stuffing up. I.E. If I were to rotate one object everything else would rotate, for some reason whenever I tried loading the identity matrix for every object in the scene, but it just wouldn't do reset the matrix for every object? I wasn't sure if a display list saved calls to glLoadIdentity or glTranslatef and etc., so I scratched that plan.
Then I decided adding display lists for every object on the fly, then loop through all the objects and render them (calling the display list). Now it works and all, but I'd imagine if I had a huge scene that it would cause a lot of overhead or something. I was thinking of using VBO's instead of display lists, from what I hear they're pretty light weight and not deprecated? I would still imagine some overhead, if I was making VBO's on the fly, every frame. Should I do this, or try to "add" objects to some sort of list and then render that list (full of objects) all at once with one function call.
For example:
// Outside of the game-loop (initialization code)
renderer->addObjectToRender(rect); // Add a rectangle to render.
// Inside the game-loop
renderer->renderScene(); // Renders the ENTIRE scene all at ONCE.
Now I would think that this wouldn't cause that much over-head as it only allocates memory for a VBO/Display List once (for every object) during the entire program (or at least scene). The only problem I think I have is, I don't think it would be as "dynamic" of some sort, perhaps? I'm not sure, that's why I'm asking.
Any help would be appreciated, I have no idea how expensive it is to create a VBO/Display List on every frame, that's why I was thinking to add objects to render and then just render the entire scene.
Many thanks for reading this .