Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!

NeHe FreeTypeFont tutorial - blank screen

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Acharis   Crossbones+   -  Reputation: 4676


Posted 29 December 2012 - 11:08 AM

I'm trying to make the NeHe freetypefont tutorial to work, but I get a blank screen for some reason...

What I did:
- got precompiled Windows binaries of freetype (freetype-2.3.5-1-bin)
- made a project in Code::Blocks (SDL+OpenGL+FreeType lib included)
- downloaded the source code from http://nehe.gamedev.net/tutorial/freetype_fonts_in_opengl/24001/ (the Linux/SDL Code For This Lesson. ( Conversion by Aaron Graves) version) and I have not forgotten about the font either :)

So, I have built it and run and... I'm getting a blank screen. I added a standard "OpenGL triangle code" and it is displayed properly, so I assume OpenGl + SDL works as it should. I got no errors of any kind.

I don't know how to bite it. Is it because the tutorial is broken? Or I downloaded a broken version of it? Or I got a wrong/broken/incompatible version of FT library? Or something else?

Does anyone got this tutorial working?

Edited by Acharis, 29 December 2012 - 11:08 AM.


#2 Acharis   Crossbones+   -  Reputation: 4676


Posted 02 January 2013 - 03:54 PM

OK, maybe I should ask another question. Do you know of any working FreeTypeFont OpenGL rendering tutorial?

#3 __SKYe   Members   -  Reputation: 1148


Posted 03 January 2013 - 04:45 AM

First of all i never downloaded the code, i just read the tutorial (and understood it), and rewrote it myself, and it did work with me. And i also did it on windows.


And the Freetype library is correct, this tutorial uses freetype 2.


What is your OS?


You say you downloaded the FreeType windows binaries, and the Linux/SDL code? It doesn't make sense.

If you have windows, then download the windows code, if you have linux, i believe the windows freetype binaries won't help.

#4 Acharis   Crossbones+   -  Reputation: 4676


Posted 03 January 2013 - 03:19 PM


But the sources were for SDL, it's supposed to run on absolutelly everything...


Anyway, I can't use the VC++ source codes because these use glaux, which is not included in code::blocks.

#5 __SKYe   Members   -  Reputation: 1148


Posted 04 January 2013 - 01:50 AM

Download the VC++ source, and instead of using glaux to load images, use this code instead (also from nehe), and check if it works.


EDIT: Or if you want to use glaux, download the files here http://mycodelog.com/2010/05/15/gllibs/, place the files in their correct folders (you only need the glaux.h and glaux.lib), and see if the program works.


And keep in mind that this tutorial is deprecated in various ways.


Display lists, GL_LUMINANCE_ALPHA, drawing using glBegin()...glEnd(), glaux, etc are all deprecated in modern OpenGL (along with the way the freetype headera are included).


Also, i just downloaded the VC++ code, compiled it and it works for me EXCEPT you must change the following bit:


for(const char *c=text;*c;c++) {


const char *c=text;

	for(;*c;c++) {


or an error will occur.


See if it works, and let me know.

#6 Acharis   Crossbones+   -  Reputation: 4676


Posted 05 January 2013 - 10:30 AM

OK, maybe something easier first. Where can I get prebuild libraries of FreeType for Windows? Includes+lib+dlls, all that are guaranteed to be compatible and work together (doeas not matter which version, as long as all of these files are compatible).


I noticed the one I was using is kind of strange and does not look like the others (it has freetype2/freetype directory structure instead of freetype like all tutorials require, I manually changed it but... it's still suspicious, so maybe I just have some broken version of TTF library).


I tried the package from the official freetype site (http://download.savannah.gnu.org/releases/freetype/) but it has no prebuild libraries (and I definitely want to avoid building these myself now, I would then be completely in blind at which step I made a mistake if it does not work).

#7 __SKYe   Members   -  Reputation: 1148


Posted 05 January 2013 - 11:04 AM

Ok, go to http://gnuwin32.sourceforge.net/downlinks/freetype-bin-zip.php and it will download a zip file.


Unzip the files, and you will have the include, lib, and dll files


You just need the freetype6.dll and freetype.lib.


The include file directory has the following structure


...include\freetype\freetype2\<the freetype headers>


copy that same structure to your IDE include folder, but remove the 'freetype2' folder in between (it should become ...include\freetype\<the freetype headers>)


then link your project with the freetype.lib, and run it. It should work (i hope).


If you have doubts, or it doesn't work then post again.

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.