OpenGL独占模式全屏

OpenGL独占模式全屏,第1张

概述OpenGL独占模式全屏

DirectX允许应用程序独占GPU和发送内容的监视器。 这被称为全屏。 使用OpenGL时,使用ChangedisplaySettings(&dv,CDS_FulLSCREEN)激活全屏。 但是,这样做的结果是一个“假”全屏 – 全屏窗口。 这两者的performance有一些差异,特别是在焦点不清的情况下。

有没有办法以全屏方式创build一个窗口的方式,只使用Win32 API和OpenGL,或者这是DirectX独有的function?

添加到ImageList后,我需要摧毁图标吗?

当程序可见或最小化时,进程ID改变

c#:如何知道在windows中是否存在“用户帐户”?

通过.NET连接到Active Directory

获取应用程序目录中的文件列表

如果你愿意让gluT为你做窗口任务,你可以看看这里: 全屏在openGL中

如果你想自己进入WIN32细节,你可以这样做:

#include <windows.h> #include <stdlib.h> #include "glew.h" #include <gl/GL.h> #include <gl/glu.h> int main() { HWND hwnd; HDC hdc; int pixelFormat; PIXELFORMATDESCRIPTOR pfd; // First create the full screen window hwnd = CreateWindowEx(0,"STATIC","",WS_VISIBLE | WS_EX_topMOST,640,480,GetmoduleeHandle(NulL),0); WINDOWPLACEMENT g_wpPrev = { sizeof(g_wpPrev) }; DWORD DWStyle = getwindowlong(hwnd,GWL_STYLE); MONITORINFO mi = { sizeof(mi) }; if (GetwindowPlacement(hwnd,&g_wpPrev) && GetMonitorInfo(MonitorFromWindow(hwnd,MONITOR_DEFAulTtopRIMARY),&mi)) { SetwindowLong(hwnd,GWL_STYLE,DWStyle & ~WS_OVERLAPPEDWINDOW); SetwindowPos(hwnd,HWND_top,mi.rcMonitor.left,mi.rcMonitor.top,mi.rcMonitor.right - mi.rcMonitor.left,mi.rcMonitor.bottom - mi.rcMonitor.top,SWP_NOOWNERZORDER | SWP_FRAMECHANGED); } // Describe the pixel format memset(&pfd,sizeof(PIXELFORMATDESCRIPTOR)); pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); pfd.nVersion = 1; pfd.DWFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; pfd.iPixelType = PFD_TYPE_RGBA; pfd.ccolorBits = 32; pfd.cDepthBits = 16; pfd.iLayerType = PFD_MAIN_PLANE; // Create the device context and rendering context hdc = GetDC(hwnd); pixelFormat = ChoosePixelFormat(hdc,&pfd); SetPixelFormat(hdc,pixelFormat,&pfd); HglrC rendering_context = wglCreateContext(hdc);; BOol rc = wglMakeCurrent(hdc,rendering_context); GLenum err = glewInit(); if (GLEW_OK != err){ } //Paint the back buffer red glClearcolor(1,0); glClear(GL_color_BUFFER_BIT); glFlush(); //Show on screen rc = SwapBuffers(hdc); while(1){ // do something... }

}

希望这可以帮助..

总结

以上是内存溢出为你收集整理的OpenGL独占模式全屏全部内容,希望文章能够帮你解决OpenGL独占模式全屏所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1279433.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-09
下一篇 2022-06-09

发表评论

登录后才能评论

评论列表(0条)

保存