Click here to Skip to main content
15,916,019 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionGDI & Image Processing Pin
KienNT7812-Jun-07 21:05
KienNT7812-Jun-07 21:05 
AnswerRe: GDI & Image Processing Pin
CPallini12-Jun-07 21:23
mveCPallini12-Jun-07 21:23 
AnswerRe: GDI & Image Processing Pin
Nelek12-Jun-07 23:22
protectorNelek12-Jun-07 23:22 
Questionproblem in file open dialog box Pin
trioum12-Jun-07 20:57
trioum12-Jun-07 20:57 
AnswerRe: problem in file open dialog box Pin
Hamid_RT12-Jun-07 21:30
Hamid_RT12-Jun-07 21:30 
AnswerRe: problem in file open dialog box Pin
trioum13-Jun-07 1:26
trioum13-Jun-07 1:26 
GeneralRe: problem in file open dialog box Pin
Hamid_RT13-Jun-07 3:34
Hamid_RT13-Jun-07 3:34 
QuestionUsing OpenGL Text Output with DIB Section Pin
beko12-Jun-07 20:37
beko12-Jun-07 20:37 
Hello,

I am creating an outline font as below, and use it with PrintOutlineString, when i use these functions without DIB Section (which i use for printing) it works. However, when i use the DIBSection, i cannot display texts.

May be a bit off-topic in this forum, however if anyone used both together and how?

Thanks in advance.

Bekir.



<br />
unsigned int CreateOutlineFont(char *fontName, int fontSize, float depth)<br />
{<br />
	HFONT hFont;         // windows font<br />
	unsigned int base;<br />
<br />
	base = glGenLists(256);      // create storage for 96 characters<br />
<br />
	if (stricmp(fontName, "symbol") == 0)<br />
	{<br />
	     hFont = CreateFont(fontSize, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, SYMBOL_CHARSET, <br />
							OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY,<br />
							FF_DONTCARE | DEFAULT_PITCH, fontName);<br />
	}<br />
	else<br />
	{<br />
		 hFont = CreateFont(fontSize, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, ANSI_CHARSET, <br />
							OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY,<br />
							FF_DONTCARE | DEFAULT_PITCH, fontName);<br />
	}<br />
<br />
	if (!hFont)<br />
		return 0;<br />
<br />
	SelectObject((*m_dib.GetDC()), hFont);<br />
	wglUseFontOutlines((*m_dib.GetDC()), 0, 255, base, 0.0f, depth, WGL_FONT_POLYGONS, gmf);<br />
<br />
<br />
/*<br />
	SelectObject(m_hDC, hFont);<br />
	wglUseFontOutlines(m_hDC, 0, 255, base, 0.0f, depth, WGL_FONT_POLYGONS, gmf);<br />
/**/<br />
	<br />
<br />
	return base;<br />
}<br />
<br />
<br />
void PrintOutlineString(double x, double y, char *str)<br />
{<br />
	float length = 0;<br />
<br />
	if ((str == NULL))<br />
		return;<br />
<br />
	// center the text<br />
	for (unsigned int loop=0;loop<(strlen(str));loop++)	// find length of text<br />
	{<br />
		length+=gmf[str[loop]].gmfCellIncX;		        // increase length by character's width<br />
	}<br />
<br />
	glPushMatrix();<br />
	glLoadIdentity();<br />
	glTranslatef(x,y,0.0f);                  // translate to center text<br />
	//glScalef(0.25,0.25,0.25);<br />
<br />
<br />
	// draw the text<br />
	glPushAttrib(GL_LIST_BIT);<br />
		glListBase(listBase);<br />
		glCallLists(strlen(str), GL_UNSIGNED_BYTE, str);<br />
	glPopAttrib();<br />
<br />
	glPopMatrix();<br />
}<br />
<br />

QuestionNeWbie Rook Programmer! Pin
brandonsjo12-Jun-07 20:36
brandonsjo12-Jun-07 20:36 
AnswerRe: NeWbie Rook Programmer! Pin
Hamid_RT12-Jun-07 21:30
Hamid_RT12-Jun-07 21:30 
AnswerRe: NeWbie Rook Programmer! Pin
Nelek12-Jun-07 23:18
protectorNelek12-Jun-07 23:18 
QuestionCDialog Pin
Bravoone_200612-Jun-07 20:29
Bravoone_200612-Jun-07 20:29 
AnswerRe: CDialog Pin
Hans Dietrich12-Jun-07 20:54
mentorHans Dietrich12-Jun-07 20:54 
QuestionRe: CDialog Pin
Bravoone_200612-Jun-07 21:40
Bravoone_200612-Jun-07 21:40 
AnswerRe: CDialog Pin
Nelek12-Jun-07 23:15
protectorNelek12-Jun-07 23:15 
AnswerRe: CDialog Pin
David Crow13-Jun-07 3:38
David Crow13-Jun-07 3:38 
QuestionHow to enable menuitem... Pin
artihcv12-Jun-07 19:56
artihcv12-Jun-07 19:56 
AnswerRe: How to enable menuitem... Pin
Hamid_RT12-Jun-07 20:04
Hamid_RT12-Jun-07 20:04 
QuestionUnix to Windows client server application Pin
C#Coudou12-Jun-07 19:55
C#Coudou12-Jun-07 19:55 
QuestionExpression help Pin
amitmistry_petlad 12-Jun-07 19:47
amitmistry_petlad 12-Jun-07 19:47 
AnswerRe: Expression help Pin
Naveen12-Jun-07 20:04
Naveen12-Jun-07 20:04 
GeneralRe: Expression help Pin
amitmistry_petlad 13-Jun-07 19:42
amitmistry_petlad 13-Jun-07 19:42 
GeneralRe: Expression help Pin
Naveen13-Jun-07 19:47
Naveen13-Jun-07 19:47 
GeneralRe: Expression help Pin
amitmistry_petlad 17-Jun-07 17:03
amitmistry_petlad 17-Jun-07 17:03 
GeneralRe: Expression help Pin
Naveen17-Jun-07 17:18
Naveen17-Jun-07 17:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.