Как же это будет работать, если Вы все запретили, OpenGL c ума сойдет. См. хелп по параметру cRedBits и за ним следующими.
Вот так отлично работает:
X++:
HWND mainWindow;
int dc;
HWND hrc;
int nPixelFormat;
// Загрузка библиотек
DLL opengl32 = new DLL("opengl32.dll");
DLL glu32 = new DLL("glu32.dll");
DLL gdi32 = new DLL("gdi32.dll");
DLL user32 = new DLL("user32");
//
COMVariant parm5 = new COMVariant();
// Получение точек входа функций
DLLFunction wglCreateContext = new DLLFunction(opengl32, "wglCreateContext");
DLLFunction wglMakeCurrent = new DLLFunction(opengl32, "wglMakeCurrent");
DLLFunction glEnable = new DLLFunction(opengl32, "glEnable");
DLLFunction ChoosePixelFormat = new DLLFunction(gdi32, "ChoosePixelFormat");
DLLFunction SetPixelFormat = new DLLFunction(gdi32, "SetPixelFormat");
DLLFunction glMatrixMode = new DLLFunction(opengl32, "glMatrixMode");
DLLFunction glLoadIdentity = new DLLFunction(opengl32, "glLoadIdentity");
DLLFunction gluPerspective = new DLLFunction(glu32, "gluPerspective");
DLLFunction glClearColor = new DLLFunction(opengl32, "glClearColor");
COMVariant parm1 = new COMVariant();
COMVariant parm2 = new COMVariant();
COMVariant parm3 = new COMVariant();
COMVariant parm4 = new COMVariant();
DLLFunction getWindowDC = new DLLFunction(user32, "GetWindowDC");
DLLFunction glClear = new DLLFunction(opengl32, "glClear");
//
Binary pixelFormatDescriptor;
//
boolean fInfo = false;
void initializeRC()
{
glEnable.call(2929);
glEnable.call(2896);
glEnable.call(16384);
}
;
// Установка функций
wglCreateContext.returns(ExtTypes::DWord);
wglCreateContext.arg(ExtTypes::DWord);
wglMakeCurrent.returns(ExtTypes::DWord);
wglMakeCurrent.arg(ExtTypes::DWord, ExtTypes::DWord);
glEnable.returns(ExtTypes::void);
glEnable.arg(ExtTypes::DWord);
ChoosePixelFormat.returns(ExtTypes::DWord);
ChoosePixelFormat.arg(ExtTypes::DWord, ExtTypes::Pointer);
SetPixelFormat.returns(ExtTypes::DWord);
SetPixelFormat.arg(ExtTypes::DWord, ExtTypes::DWord, ExtTypes::Pointer);
glMatrixMode.returns(ExtTypes::void);
glMatrixMode.arg(ExtTypes::DWord);
glLoadIdentity.returns(ExtTypes::void);
glLoadIdentity.arg(); // возможно нужно добавить
gluPerspective.returns(ExtTypes::void);
gluPerspective.arg(ExtTypes::Double, ExtTypes::Double, ExtTypes::Double, ExtTypes::Double);
glClearColor.returns(ExtTypes::void);
glClearColor.arg(ExtTypes::DWord, ExtTypes::DWord, ExtTypes::DWord, ExtTypes::DWord);
parm1.float(1.0);
parm2.float(0.0);
parm3.float(0.0);
parm4.float(1.0);
getWindowDC.returns(ExtTypes::DWORD);
getWindowDC.arg(ExtTypes::DWORD);
glClear.returns(ExtTypes::void);
glClear.arg(ExtTypes::DWord);
//
mainWindow = infolog.hWnd();
//parm5.int(mainWindow);
dc = getWindowDC.call(mainWindow);
// dc = WinApi::createDC();
// Формат пиксела
pixelFormatDescriptor = new Binary(40);
pixelFormatDescriptor.Word(0, 40); // nSize
pixelFormatDescriptor.Word(2, 64); // nVersion
pixelFormatDescriptor.dWord(4, 8191); // dwFlags
pixelFormatDescriptor.byte(8, 0); // iPixelType
pixelFormatDescriptor.byte(9, 64); // cColorBits
pixelFormatDescriptor.byte(10, 64); // cRedBits;
pixelFormatDescriptor.byte(11, 64); // cRedShift;
pixelFormatDescriptor.byte(12, 64); // cGreenBits;
pixelFormatDescriptor.byte(13, 64); // cGreenShift;
pixelFormatDescriptor.byte(14, 64); // cBlueBits;
pixelFormatDescriptor.byte(15, 64); // cBlueShift;
pixelFormatDescriptor.byte(16, 64); // cAlphaBits;
pixelFormatDescriptor.byte(17, 64); // cAlphaShift;
pixelFormatDescriptor.byte(18, 64); // cAccumBits;
pixelFormatDescriptor.byte(19, 64); // cAccumRedBits;
pixelFormatDescriptor.byte(20, 64); // cAccumGreenBits;
pixelFormatDescriptor.byte(21, 64); // cAccumBlueBits;
pixelFormatDescriptor.byte(22, 64); // cAccumAlphaBits;
pixelFormatDescriptor.byte(23, 64); // cDepthBits;
pixelFormatDescriptor.byte(24, 64); // cStencilBits;
pixelFormatDescriptor.byte(25, 64); // cAuxBuffers;
pixelFormatDescriptor.byte(26, 0); // iLayerType;
pixelFormatDescriptor.byte(27, 64); // bReserved;
pixelFormatDescriptor.dWord(28, 64); // dwLayerMask;
pixelFormatDescriptor.dWord(32, 64); // dwVisibleMask;
pixelFormatDescriptor.dWord(36, 64); // dwDamageMask
nPixelFormat = ChoosePixelFormat.call(dc, pixelFormatDescriptor);
if (SetPixelFormat.call(dc, nPixelFormat, pixelFormatDescriptor)==0) info( "SetPixelFormat function failed.");
hrc = wglCreateContext.call(dc); if (!hrc) info( "wglCreateContext function failed.");
if(!wglMakeCurrent.call(dc, hrc)) info( "wglMakeCurrent function failed.");
//initializeRC();
glClearColor.call(parm1.int(), parm2.int(), parm3.int(), parm4.int());
glClear.call(16384);
// opengl32_glMatrixMode.call(5889);
//opengl32_glLoadIdentity.call();
// glu32_gluPerspective.call(10.0, 1.0, 1.0, 10.0);
if (fInfo)
{
info(mainWindow?"mainWindow = OK":"mainWindow = Error");
info(dc?"dc = OK":"dc = Error");
info(opengl32?"openGL = OK": "opengL = Error");
info(glu32?"glu32 = OK": "glu32 = Error");
info(gdi32?"gdi32 = OK": "gdi32 = Error");
info(wglCreateContext?"wglCreateContext = OK":"wglCreateContext = ERROR");
info(wglMakeCurrent?"wglMakeCurrent = OK": "wglMakeCurrent = ERROR");
info(glEnable?"glEnable = OK": "glEnable = ERROR");
info(ChoosePixelFormat?"ChoosePixelFormat = OK":"ChoosePixelFormat = OK");
info(SetPixelFormat?"SetPixelFormat = OK":"SetPixelFormat = ERROR");
info(glMatrixMode?"glMatrixMode = OK":"glMatrixMode = ERROR");
info(gluPerspective?"gluPerspective = OK":"gluPerspective = ERROR");
info(glClearColor?"glClearColor = OK":"glClearColor = ERROR");
}
// устанавливаем формат пиксела
wglMakeCurrent.call(0, 0);
WinAPI::releaseDC(mainWindow, dc);