Click to See Complete Forum and Search --> : text in OpenGL


bovinedragon
June 14th, 2007, 09:47 PM
Ive looked at many codes for it like the ones at nehe, but i cant figure out how to pick out the stuff i need to make it work in my code.

Is there some script for text in opengl that i can just copy and paste into my code ready to go?

[EDIT] i found glutBitmapCharacter, but it gives me a [linker error] undefined reference to glutBitmapCharacter. any help?

ljcobb
June 14th, 2007, 10:34 PM
Did you link to the GLUT libraries when you compiled the code? It is an additional library you must link to besides the GL libraries.

bovinedragon
June 15th, 2007, 01:24 AM
yeah i have this in my file

#include <gl\gl.h>
#include <gl\glut.h>

and if i add the glut linker files through the project menu, like i saw some ppl say to do on post similar to this one, it just causes more errors like that.

ne0n82
June 15th, 2007, 01:42 AM
maybe try
#include "gl\gl.h"
#include "gl\glut.h"

plus i believe your also going to have to include the .lib files if your using VC++ you have to add additional dependancies, and possibly set the code to multithreaded DLL???

Mike Harnad
June 15th, 2007, 09:20 AM
Take a look at this (http://www.opengl.org/resources/features/fontsurvey/) article.

bovinedragon
June 15th, 2007, 04:06 PM
i am using Dev-C++, and the linker files that are in the menu are all ".a". For glut there are libglut.a and libglut32.a. Are these the right files or am i missing something.

I also like the NeHe article 13 one, and i can compile and run the example code, but cant get it to work in my code, if the glut way doesnt work, maybe you guys can help me with that one.

thx for the help guys, im a noob at this

[EDIT] I have another side question also, how do u grab the x and y coordinates of the window.

[EDIT] I figured it out, i had to link the right files. I wasnt sure which ones i needed, so i made a new example glut project, copied its linker files and put it into my project, and it worked! yay. Thx for the help guys. If you could also answer my question above i would appreciate it :)

bitshifter420
June 23rd, 2007, 07:21 PM
BOOL GetWindowRect(HWND hWnd, LPRECT lpRect);

Will retrieve the window bounding dimensions.



BOOL GetClientRect(HWND hWnd, LPRECT lpRect);

Will retrieve the windows client area dimensions.



Simply pass the window handle and a RECT address as arguments

The functions return true if successful, false if failed.



EXAMPLE:

HWND hWnd; // valid window handle

RECT rc; // holds rectangle info

It is a good idea to test window handle before use, like so:

if(hWnd == NULL)
{
// window handle is invalid, do-not use it
}

if(GetClientRect(hWnd, &rc))
{
// the RECT is filled with info, ready to use
}

else
{
// the function failed, the RECT info is invalid
}

Happy Coding!