Talk About Network

Google





Graphics > OpenGL 3D API > Re: Draw OpenGL...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 9 of 18 Topic 4755 of 5061
Post > Topic >>

Re: Draw OpenGLScene without WM_PAINT

by Albe <alberto_ressia@[EMAIL PROTECTED] > May 19, 2008 at 08:47 AM

Hi Jonno,
probably owing to my bad english I did't explain correctly my problem:
I have an application named EKXXX with 3 cl*****

CEKXXXApp
CEKXXXDlg
COpenGLControl

in CEKXXXDlg there is a function named OnPaint associate at WM_PAINT
message and is

void CEKXXXDlg::OnPaint()
{
CPaintDC	dc(this); // device context for painting
if (IsIconic())
 {
	SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
	// Center icon in client rectangle
	int cxIcon = GetSystemMetrics(SM_CXICON);
	int cyIcon = GetSystemMetrics(SM_CYICON);

	CRect rect;
	GetClientRect(&rect);
	int x = (rect.Width() - cxIcon + 1) / 2;
	int y = (rect.Height() - cyIcon + 1) / 2;

	// Draw the icon
	dc.DrawIcon(x, y, m_hIcon);
 }
 else
 {
       CDialog::OnPaint();
 }
}

in COpenGLControl there is a function named OnPaint associate at
WM_PAINT message and is

void COpenGLControl::OnPaint()
{
 if(*datoOK)
 {
	/** OpenGL section **/

	openGLDevice.makeCurrent();
	DrawGLScene();
	*datoOK=false;

	temp_stato_old=tab;
 }
}

When the software don't show opengl (there are two tab, in the first
there is a text box with the program description, in the second there
is an opengl windows that draw the data received from USB) the CPU
usage is about 10%, when the opengl is showed the CPU usage is about
98%, MORE.

I think that WM_PAINT is the same windows message and when it comes
the software runs OnPaint in CEKXXXDlg and OnPaint in COpenGLControl.

I can't use Sleep(x) becuse the system became too late, how I can do
to decrease CPU usage when the software shows OpenGL windows???

Sorry and thank you

Alberto
 




 18 Posts in Topic:
Draw OpenGLScene without WM_PAINT
Albe <alberto_ressia@[  2008-05-19 00:12:21 
Re: Draw OpenGLScene without WM_PAINT
Wolfgang Draxinger <wd  2008-05-19 09:47:36 
Re: Draw OpenGLScene without WM_PAINT
Albe <alberto_ressia@[  2008-05-19 01:47:07 
Re: Draw OpenGLScene without WM_PAINT
aku ankka <jukka@[EMAI  2008-05-19 03:21:22 
Re: Draw OpenGLScene without WM_PAINT
Albe <alberto_ressia@[  2008-05-19 05:57:37 
Re: Draw OpenGLScene without WM_PAINT
Jonno <jonno@[EMAIL PR  2008-05-19 14:23:06 
Re: Draw OpenGLScene without WM_PAINT
Albe <alberto_ressia@[  2008-05-19 07:27:09 
Re: Draw OpenGLScene without WM_PAINT
Jonno <jonno@[EMAIL PR  2008-05-19 15:54:39 
Re: Draw OpenGLScene without WM_PAINT
Albe <alberto_ressia@[  2008-05-19 08:47:09 
Re: Draw OpenGLScene without WM_PAINT
Jonno <jonno@[EMAIL PR  2008-05-19 17:00:35 
Re: Draw OpenGLScene without WM_PAINT
aku ankka <jukka@[EMAI  2008-05-19 23:29:33 
Re: Draw OpenGLScene without WM_PAINT
Albe <alberto_ressia@[  2008-05-20 00:25:21 
Re: Draw OpenGLScene without WM_PAINT
Diego <jose.diego@[EMA  2008-05-21 09:33:15 
Re: Draw OpenGLScene without WM_PAINT
Albe <alberto_ressia@[  2008-05-22 02:33:00 
Re: Draw OpenGLScene without WM_PAINT
Jonno <jonno@[EMAIL PR  2008-05-22 11:24:50 
Re: Draw OpenGLScene without WM_PAINT
"Clemens" <y  2008-05-24 09:56:44 
Re: Draw OpenGLScene without WM_PAINT
Albe <alberto_ressia@[  2008-05-26 02:43:17 
Re: Draw OpenGLScene without WM_PAINT
Jonno <jonno@[EMAIL PR  2008-05-27 09:09:26 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Wed Jan 7 15:04:54 PST 2009.