outline font flips my normals
#1
Posted 14 September 2003 - 01:35 PM
the second they show , all other objects on screen have their normals flipped!
any suggestions?
#2
Posted 14 September 2003 - 01:46 PM
anyway, merely displaying text can't flip the normals of other faces...
maybe it's a transformation or projection error you do ?
#3
Posted 14 September 2003 - 01:56 PM
GLvoid CObserverDoc::BuildOutLineFont() // Build Our OutLine Font
{
baseOutLine = glGenLists(256); // Storage For 256 Characters
HFONT oldfont; // Used For Good House Keeping
OutLinefont = CreateFont( -12, // 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
"Arial"); // Font Name
oldfont = (HFONT)SelectObject(m_hDC, OutLinefont); // Selects The Font We Created
wglUseFontOutlines( m_hDC, // Select The Current DC
0, // Starting Character
255, // Number Of Display Lists To Build
baseOutLine, // Starting Display Lists
0.0f, // Deviation From The True Outlines
0.2f, // Font Thickness In The Z Direction
WGL_FONT_POLYGONS, // Use Polygons, Not Lines
gmf); // Address Of Buffer To Recieve Data
SelectObject(m_hDC, oldfont); // Selects The Font We Want
DeleteObject(OutLinefont); // Delete The Font
}
here is how i print itGLvoid CObserverDoc::glOutLinePrint(char *text, ...) // Custom GL "Print" Routine
{
float length=0; // Used To Find The Length Of The Text
char strText[256]; // This will hold our text to display
va_list argumentPtr; // This will hold the pointer to the argument list
// First we need to check if there was even a string given
if (text == NULL) // Check if a string was given
return; // Don't render anything then
// First we need to parse the string for arguments given
// To do this we pass in a va_list variable that is a pointer to the list of arguments.
// Then we pass in the string that holds all of those arguments.
va_start(argumentPtr, text); // Parse the arguments out of the string
// Then we use a special version of sprintf() that takes a pointer to the argument list.
// This then does the normal sprintf() functionality.
vsprintf(strText, text, argumentPtr); // Now add the arguments into the full string
va_end(argumentPtr); // This resets and frees the pointer to the argument list.
for (unsigned int loop=0;loop<(strlen(text));loop++) // Loop To Find Text Length
{
length+=gmf[text[loop]].gmfCellIncX; // Increase Length By Each Characters Width
}
glTranslatef(-length/2,0.0f,0.0f); // Center Our Text On The Screen
glPushAttrib(GL_LIST_BIT); // Pushes The Display List Bits
glListBase(baseOutLine); // Sets The Base Character to 0
glCallLists(strlen(text), GL_UNSIGNED_BYTE, text); // Draws The Display List Text
glPopAttrib(); // Pops The Display List Bits
}
#4
Posted 14 September 2003 - 02:08 PM
glPushMatrix(); // Draw fonts glPopMatrix();
That might help. If it doesn't, try pushing and popping other things.
He who knows not and knows that he knows not is ignorant. Teach him.
He who knows not and knows not that he knows not is a fool. Shun him.
#5
Posted 14 September 2003 - 02:29 PM
if i comment the print call , all works fine so it has to be related to the printing of the outline font..
#6
Posted 14 September 2003 - 04:47 PM
He who knows not and knows that he knows not is ignorant. Teach him.
He who knows not and knows not that he knows not is a fool. Shun him.
#7
Posted 14 September 2003 - 05:10 PM
i wrote it didnt work.
i said thad if i comment the draw fonts parts in my program the normals dont flip,
i thought this info could hint on the problem..
#8
Posted 14 September 2003 - 05:47 PM
also you might want to use the textured quad aproach for text rendering baldurk described in another thread to maintain platform independence
#9
Posted 15 September 2003 - 02:57 AM
please let us know how that works out.
:yes:
#10
Posted 15 September 2003 - 08:26 AM
i want to post images to show what happens but i dont know how..
how do i post images??
to anubis- yes its wierd but the normals do flip
i changed the code to flip the normals (they are wrong in the begining)
and when the text appears the normals are right (flipped again)
#11
Posted 15 September 2003 - 09:07 AM
if i use wglUseFontOutlines(...,WGL_FONT_LINES,...)
the normals dont flip!
however if i use wglUseFontOutlines(...,WGL_FONT_POLYGONS,...)
the normals do flip
#12
Posted 15 September 2003 - 12:17 PM
#13
Posted 15 September 2003 - 01:01 PM
#14
Posted 15 September 2003 - 02:42 PM
#16
Posted 15 September 2003 - 07:45 PM
But bitmapped fonts are easier to use (at least in OpenGL).
#17
Posted 15 September 2003 - 07:58 PM
-Loving a Person is having the wish to see this Person happy, no matter what that means to yourself.
-No matter what it means to myself....
#18
Posted 03 May 2004 - 06:10 AM
urika said:
if i use wglUseFontOutlines(...,WGL_FONT_LINES,...)
the normals dont flip!
however if i use wglUseFontOutlines(...,WGL_FONT_POLYGONS,...)
the normals do flip
#20
Posted 16 January 2005 - 09:28 AM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users













