Jump to content


outline font flips my normals


22 replies to this topic

#1 urika

    Member

  • Members
  • PipPip
  • 54 posts

Posted 14 September 2003 - 01:35 PM

i use outline fonts to display 3d text,
the second they show , all other objects on screen have their normals flipped!
any suggestions?

#2 anubis

    Senior Member

  • Members
  • PipPipPipPip
  • 2225 posts

Posted 14 September 2003 - 01:46 PM

a piece of code would be helpful...
anyway, merely displaying text can't flip the normals of other faces...
maybe it's a transformation or projection error you do ?
If Prolog is the answer, what is the question ?

#3 urika

    Member

  • Members
  • PipPip
  • 54 posts

Posted 14 September 2003 - 01:56 PM

here is where i build the font...
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 it
GLvoid 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 baldurk

    Senior Member

  • Members
  • PipPipPipPip
  • 1057 posts

Posted 14 September 2003 - 02:08 PM

I'd do this:

glPushMatrix();

// Draw fonts

glPopMatrix();

That might help. If it doesn't, try pushing and popping other things.
baldurk
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 urika

    Member

  • Members
  • PipPip
  • 54 posts

Posted 14 September 2003 - 02:29 PM

doesn't help.
if i comment the print call , all works fine so it has to be related to the printing of the outline font..

#6 baldurk

    Senior Member

  • Members
  • PipPipPipPip
  • 1057 posts

Posted 14 September 2003 - 04:47 PM

I didn't mean to comment the draw fonts. That was just to indicate where it should go. I meant that you should put glPushMatrix()/glPopMatrix() around the font drawing line.
baldurk
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 urika

    Member

  • Members
  • PipPip
  • 54 posts

Posted 14 September 2003 - 05:10 PM

i know i know.
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 anubis

    Senior Member

  • Members
  • PipPipPipPip
  • 2225 posts

Posted 14 September 2003 - 05:47 PM

what exactly do you mean by flip ? a normal that previously pointed directly to the camera would suddenly face away from it ? i can't imagine how text drawing could be related to this... check your modelview matrix...
also you might want to use the textured quad aproach for text rendering baldurk described in another thread to maintain platform independence
If Prolog is the answer, what is the question ?

#9 donBerto

    Senior Member

  • Members
  • PipPipPipPip
  • 369 posts

Posted 15 September 2003 - 02:57 AM

try drawing all your objects _FIRST_ and call your font display VERY _LAST_


please let us know how that works out.

:yes:
Imagine.

#10 urika

    Member

  • Members
  • PipPip
  • 54 posts

Posted 15 September 2003 - 08:26 AM

nope , doesnt change a thing.
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 urika

    Member

  • Members
  • PipPip
  • 54 posts

Posted 15 September 2003 - 09:07 AM

one more thing
if i use wglUseFontOutlines(...,WGL_FONT_LINES,...)
the normals dont flip!
however if i use wglUseFontOutlines(...,WGL_FONT_POLYGONS,...)
the normals do flip

#12 anubis

    Senior Member

  • Members
  • PipPipPipPip
  • 2225 posts

Posted 15 September 2003 - 12:17 PM

confusing... i don't know... driver bug ???
If Prolog is the answer, what is the question ?

#13 urika

    Member

  • Members
  • PipPip
  • 54 posts

Posted 15 September 2003 - 01:01 PM

thanks anyway , i think i'll use bitmap fonts instead

#14 anubis

    Senior Member

  • Members
  • PipPipPipPip
  • 2225 posts

Posted 15 September 2003 - 02:42 PM

it's better anyway... it gives you more freedom about how your fonts will look like
If Prolog is the answer, what is the question ?

#15 baldurk

    Senior Member

  • Members
  • PipPipPipPip
  • 1057 posts

Posted 15 September 2003 - 05:29 PM

here is the topic anubis was talking about.
baldurk
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.

#16 Dia

    DevMaster Staff

  • Administrators
  • 1089 posts

Posted 15 September 2003 - 07:45 PM

Textured fonts are proven to be faster though.
But bitmapped fonts are easier to use (at least in OpenGL).

#17 davepermen

    Senior Member

  • Members
  • PipPipPipPip
  • 1306 posts

Posted 15 September 2003 - 07:58 PM

uhm, textured fonts are more easy imho.. if you wanna be crossplatform, that is:D
davepermen.net
-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 Disem

    New Member

  • Members
  • Pip
  • 1 posts

Posted 03 May 2004 - 06:10 AM

urika said:

one more thing
if i use wglUseFontOutlines(...,WGL_FONT_LINES,...)
the normals dont flip!
however if i use wglUseFontOutlines(...,WGL_FONT_POLYGONS,...)
the normals do flip
I have run into a similar problem, where WGL_FONT_LINES works and displays the text in lines, without skewing anything. But if I use WGL_FONT_POLYGONS, the normals are skewed. Pushing and popping the matrixes have no effect. Any suggestions?

#19 Dwondong

    New Member

  • Members
  • Pip
  • 1 posts

Posted 16 January 2005 - 08:23 AM

urika said:

how do i post images??

View Post


Just go somewhere like IMGme and upload your pic. then it gives you a forum code that you can just copy n paste into your posts.

#20 anubis

    Senior Member

  • Members
  • PipPipPipPip
  • 2225 posts

Posted 16 January 2005 - 09:28 AM

dude... this thread is from 2003... what makes you think that your post has relevance here ?
If Prolog is the answer, what is the question ?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users