[英]Fake context creation creates a OpenGL with version 1.1
我正在尝试创建自己的上下文和窗口以从头开始渲染。 (我不想使用GLFW / SFML或其他任何库!)。
我目前遇到的问题是,我创建的用于加载初始化GLEW的Fake上下文仅为1.1版。 由于某种原因,它给了我通用的Microsoft渲染器。 我需要一个加速渲染器。
我的猜测是我创建pixelformatdescriptor时做错了。
这是我创建上下文的方式:
PIXELFORMATDESCRIPTOR pfd =
{
sizeof(PIXELFORMATDESCRIPTOR),
1,
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, //Flags
PFD_TYPE_RGBA, //The kind of framebuffer. RGBA or palette.
32, //Colordepth of the framebuffer.
0, 0, 0, 0, 0, 0,
0,
0,
0,
0, 0, 0, 0,
24, //Number of bits for the depthbuffer
8, //Number of bits for the stencilbuffer
0, //Number of Aux buffers in the framebuffer.
PFD_MAIN_PLANE,
0,
0, 0, 0
};
int iPixelFormat = ChoosePixelFormat(m_deviceContext, &pfd);
if(iPixelFormat == 0)
return false;
error = SetPixelFormat(m_deviceContext, iPixelFormat, &pfd);
if(error != 1)
return false;
m_context = wglCreateContext(m_deviceContext);
error = wglMakeCurrent(m_deviceContext, m_context);
glewExperimental = GL_TRUE;
if(glewInit() != GLEW_OK)
return false;
如果我打印供应商字符串和渲染器字符串,这就是我得到的:
Vendor: Microsoft CorporationGraphics
Renderer: GDI Generic
编辑:我尝试改为以发布模式进行编译(Visual Studio 2012),现在我得到了正确的供应商和渲染器。
如果硬件不支持您提供的颜色,深度,模板和标志的组合,则可能最终会出现软件渲染的窗口。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.