Jump to content
  • Advertisement
Sign in to follow this  
gatek33per

OpenGL Bitmap Fonts (NeHe tutorial 13) for Linux

This topic is 4983 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, I was trying to use some of the linux code provided (from NeHe) for displaying fonts with OpenGL (in Linux), but I get the following errors when starting up the program (i.e. executing BuildFont): X Error of failed request: BadFont (invalid Font parameter) Major opcode of failed request: 132 (GLX) Minor opcode of failed request: 12 (X_GLXUseXFont) Resource id in failed request: 0x1000001 Serial number of failed request: 33 Current serial number in output stream: 35 This problem seems to go away if I remove the last line in the BuildFont function, "XCloseDisplay(dpy);". Is it fine to just remove this line, or is there a "proper" fix for this? FYI: GLvoid BuildFont(GLvoid) { Display *dpy; XFontStruct *fontInfo; // storage for our font. base = glGenLists(96); // storage for 96 characters. // load the font. what fonts any of you have is going // to be system dependent, but on my system they are // in /usr/X11R6/lib/X11/fonts/*, with fonts.alias and // fonts.dir explaining what fonts the .pcf.gz files // are. in any case, one of these 2 fonts should be // on your system...or you won't see any text. // get the current display. This opens a second // connection to the display in the DISPLAY environment // value, and will be around only long enough to load // the font. dpy = XOpenDisplay(NULL); // default to DISPLAY env. fontInfo = XLoadQueryFont(dpy, "-*-helvetica-medium-r-normal--18-*-*-*-p-*-iso8859-1"); if (fontInfo == NULL) { fontInfo = XLoadQueryFont(dpy, "fixed"); if (fontInfo == NULL) { printf("no X font available?\n"); } } glXUseXFont(fontInfo->fid, 32, 96, base); XFreeFont(dpy, fontInfo); XCloseDisplay(dpy); } Thanks in advance...

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!