在Win32api中嵌入glut应用程序 [英] embedding glut application in win32api
本文介绍了在Win32api中嵌入glut应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我仅使用平台库在win32中完成了opengl应用程序.
它执行得非常慢,所以我决定使用glut库来执行相同的opengl项目
opengl代码在glut情况下可以正常工作,但在win32中却不能.
我以为那是因为wm-paint,所以我用定时器做到了,但什至没有效果
使用像素结构播放.
因此,如何在win32中集成opengl代码而又不损失性能
i have done a opengl application in win32 only using platform library.
it was performing very slow so i decided to do the same opengl project using glut library
opengl code workes fine in glut but not in win32.
i thought it would be because of wm-paint so i did it with timer but no effect even
played with pixel struct.
so how can i integrate opengl code in win32 without loss in performance
推荐答案
绘制框架后,请调用:: ValidateRect(m_hRenderingWindow,0);相应窗口的. m_hRenderingWindow是绘制opengl场景的窗口.给出0以避免整个区域在下一次更新.
请尝试这样:
After drawing a frame, please call ::ValidateRect( m_hRenderingWindow, 0 ); of the corresponding Window. m_hRenderingWindow is the window where you drawing opengl scene. 0 is given to avoid the entire region from updating on next time.
Please try like this:
LRESULT CALLBACK WindowProc( HWND hWnd,
UINT msg,
WPARAM wParam,
LPARAM lParam )
switch( msg )
{
case WM_PAINT:
{
....
RenderScene(); // Prepares your sence.
ValidateRect( m_hRenderWindow, 0 ); // Specifies that entire region of window should be avoided from update region.
}
.....
}
这篇关于在Win32api中嵌入glut应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文