PDA

View Full Version : wglUseFontOutlines Error



iss
05-18-2001, 04:02 PM
The following call fails at wglUseFontOutlines. The @ERR (WIN32 GetLastError())reveals 0x8 which is <Not enough storage is available to process this command.> GetNewDisplayListIDs suceeds.
This is using a Matrox 400 with 0.5 GBytes RAM. <This is a modification of Fosner's working code.>
Any ideas?
Thanks


===========================================
GLuint TGSS_OpenGL::GenerateDisplayListForFont( char* fontname, double xt )
{
const unsigned int nf = 0xff;
GLuint id=0xffffffff;
DWORD err = GetLastError();

if ( 0 == globalHDC | |
0 == fontname | |
(GLuint)0 == (id = GetNewDisplayListIDs(nf)) )
{
return 0;
}

LOGFONT logfont;
GLYPHMETRICSFLOAT gmf[nf];

// lfHeight can't be used to change the font size
logfont.lfHeight = -12; // use glScale to change size
logfont.lfWidth = 0;
logfont.lfEscapement = 0;
logfont.lfOrientation = logfont.lfEscapement;
logfont.lfWeight = FW_NORMAL;
logfont.lfItalic = FALSE;
logfont.lfUnderline = FALSE;
logfont.lfStrikeOut = FALSE;
logfont.lfCharSet = ANSI_CHARSET;
logfont.lfOutPrecision = OUT_DEFAULT_PRECIS;
logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
logfont.lfQuality = DEFAULT_QUALITY;
logfont.lfPitchAndFamily = FF_DONTCARE|DEFAULT_PITCH;
lstrcpy ( logfont.lfFaceName, "Arial" );

HFONT newfont;

::CreateFontIndirect( &logfont );
/*oldfont =*/ ::SelectObject(globalHDC, &newfont );
// ASSERT( 0 != oldfont );
err = GetLastError();

if ( 0 != err | |
FALSE == ::wglUseFontOutlines( globalHDC, 0, nf, id, 0.0f,
(float)xt, WGL_FONT_POLYGONS, gmf) )
{
err = GetLastError();
::glDeleteLists( id, nf );
id = 0xdddddddd;
}
else
{
::SelectObject(globalHDC,::GetStockObject( SYSTEM_FONT ));
}
DeleteObject(newfont);
return id;
}
GLuint TGSS_OpenGL::GetNewDisplayListIDs( GLsizei range )
{
ASSERT( 0 < range );

return ::glGenLists( range );
}



[This message has been edited by iss (edited 05-18-2001).]