Dear Friends
I am finding some difficulty in displaying the text in properposition mean at proper coordinate position. I am using bitmap fonts.. Using nehe tutorials I am able to draw a text. but now I want customize the text. Basically I want to display X, Y, Z at x=10, y=10 and z=10 location. I have an axes xyz threee lines I have already drawn.
But I can see XYandZ all are coming at (10,0,0) position....Y and Z shoulb be at 0,10,0 and 0,0,10 respectively. Please help me someone whats going wrong in this.
My glPrint is like this
///////////////////////////////////////////////////////////////
GLvoid CRevolutionProjView::glPrint(const char *fmt, ...) // Custom GL "Print" Routine
{
CDC* pDC = GetDC();
wglMakeCurrent(pDC->m_hDC, m_hrc);
char text[256]; // Holds Our String
va_list ap; // Pointer To List Of Arguments
if (fmt == NULL) // If There's No Text
return; // Do Nothing
va_start(ap, fmt); // Parses The String For Variables
vsprintf(text, fmt, ap); // And Converts Symbols To Actual Numbers
va_end(ap); // Results Are Stored In Text
glPushAttrib(GL_LIST_BIT); // Pushes The Display List Bits
glListBase(base - 32); // Sets The Base Character to 32
glCallLists(strlen(text), GL_UNSIGNED_BYTE, text); // Draws The Display List Text
glPopAttrib(); // Pops The Display List Bits
wglMakeCurrent(NULL,NULL);
}
//////////////////////////////////////////////////////////////
and I am creating font like this....
//////////////////////////////////////////////////////////////
GLvoid CRevolutionProjView::BuildFont(GLvoid) // Build Our Bitmap Font
{
CDC* pDC = GetDC();
wglMakeCurrent(pDC->m_hDC, m_hrc);
HFONT font; // Windows Font ID
HFONT oldfont; // Used For Good House Keeping
base = glGenLists(96); // Storage For 96 Characters
font = CreateFont( -24, // Height Of Font
0, // Width Of Font
0, // Angle Of Escapement
0, // Orientation Angle
FW_BOLD, // Font Weight
FALSE, // Italic
FALSE, // Underline
FALSE, // Strikeout
ANSI_CHARSET, // Character Set Identifier
OUT_TT_PRECIS, // Output Precision
CLIP_DEFAULT_PRECIS, // Clipping Precision
ANTIALIASED_QUALITY, // Output Quality
FF_DONTCARE|DEFAULT_PITCH, // Family And Pitch
L"Courier New"); // Font Name
oldfont = (HFONT)SelectObject(pDC->m_hDC, font); // Selects The Font We Want
wglUseFontBitmaps(pDC->m_hDC, 32, 96, base); // Builds 96 Characters Starting At Character 32
SelectObject(pDC->m_hDC, oldfont); // Selects The Font We Want
DeleteObject(font); // Delete The Font
wglMakeCurrent(NULL,NULL);
}
////////////////////////////////////////////////////////
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it.
- Brian W. Kernighan
The code tags only version of the description is: [code] Place your properly indented code here [/code]
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it.
- Brian W. Kernighan
Bookmarks