我不明白编译器试图强制执行什么。我有一个设置 OpenGL 上下文的函数,并HGLRC
通过指针返回:
BOOL SetupWin32Context(HDC hDC, HGLRC *phRC) {
/* do bunch of work*/
HGLRC hRC = wglCreateContext(hDC);
*phRC = hRC;
return TRUE;}
我*phRC = hRC;
得到:
error C2297: '*' : illegal, right operand has type 'HGLRC *'
这对我来说没有任何意义。
从 pastebin 复制的完整代码
#include "Bindings.h"
#include <Windows.h>
#include <gl\GL.h>
BOOL SetupWin32Context(HDC hDC, HGLRC *phRC)
{
HGLRC hRC = NULL;
PIXELFORMATDESCRIPTOR pfd =
{
sizeof(PIXELFORMATDESCRIPTOR),
1,
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER,
PFD_TYPE_RGBA,
32, /* Colordepth of the framebuffer. */
0, 0, 0, 0, 0, 0,
0,
0,
0,
0, 0, 0, 0,
0, /* Bits of the depthbuffer. */
0, /* Bits of the stencilbuffer. */
0, /* Number of Aux buffers. */
PFD_MAIN_PLANE,
0,
0, 0, 0
};
int format = ChoosePixelFormat(hDC, &pfd);
if(format == 0) return FALSE;
if(!SetPixelFormat(hDC,format, &pfd)) return FALSE;
hRC = wglCreateContext(hDC);
if(hRC == 0)
hRC = wglCreateContext(hDC);
if(hRC == 0)
return FALSE;
wglMakeCurrent(hDC, hRC)
*phRC = hRC;
return TRUE;
}