Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Mesa OpenGL使用模具缓冲区获取像素格式/上下文_Opengl_Mesa - Fatal编程技术网

使用Mesa OpenGL使用模具缓冲区获取像素格式/上下文

使用Mesa OpenGL使用模具缓冲区获取像素格式/上下文,opengl,mesa,Opengl,Mesa,我需要更改一个非常旧的应用程序,以便能够通过远程桌面连接(它只支持opengl 1.1的一个子集)工作。它只需要各种opengl 1.x函数,所以我尝试使用将mesa opengl32.dll文件放入应用程序文件夹的技巧。该应用程序仅稀疏地使用opengl,因此可以使用低性能的软件渲染器 无论如何,我从中获得了一个预编译的mesa opengl32.dll文件,但无法获得启用模具缓冲区的像素格式/上下文。如果我禁用了“模具缓冲区使用”,那么其他一切都可以正常工作,但实际上,如果我能够找到如何在启

我需要更改一个非常旧的应用程序,以便能够通过远程桌面连接(它只支持opengl 1.1的一个子集)工作。它只需要各种opengl 1.x函数,所以我尝试使用将mesa opengl32.dll文件放入应用程序文件夹的技巧。该应用程序仅稀疏地使用opengl,因此可以使用低性能的软件渲染器

无论如何,我从中获得了一个预编译的mesa opengl32.dll文件,但无法获得启用模具缓冲区的像素格式/上下文。如果我禁用了“模具缓冲区使用”,那么其他一切都可以正常工作,但实际上,如果我能够找到如何在启用模具缓冲区的情况下获得像素格式/上下文,那将是最好的

以下是上下文创建代码的像素格式部分:

function gl_context_create_init(adevice_context:hdc):int;
var
 pfd,pfd2:tpixelformatdescriptor;
begin
 mem_zero(pfd,sizeof(pfd));
 pfd.nSize:=sizeof(pfd);
 pfd.nVersion:=1;
 pfd.dwFlags:=PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL or PFD_DOUBLEBUFFER;
 pfd.iPixelType:=PFD_TYPE_RGBA;
 pfd.cColorBits:=32;
 pfd.iLayerType:=PFD_MAIN_PLANE;
 pfd.cStencilBits:=4;

 gl_pixel_format:=choosepixelformat(adevice_context,@pfd);
 if gl_pixel_format=0 then
  gl_error('choosepixelformat');
 if not setpixelformat(adevice_context,gl_pixel_format,@pfd) then
  gl_error('setpixelformat');
 describepixelformat(adevice_context,gl_pixel_format,sizeof(pfd2),pfd2);
 if ((pfd.dwFlags and pfd2.dwFlags)<>pfd.dwFlags) or
     (pfd.iPixelType<>pfd2.iPixelType) or
     (pfd.cColorBits<>pfd2.cColorBits) or
     (pfd.iLayerType<>pfd2.iLayerType) or
     (pfd.cStencilBits>pfd2.cStencilBits) then
  gl_error('describepixelformat');

 ...
end;
函数gl\u context\u create\u init(设备上下文:hdc):int;
变量
pfd,pfd2:tpixelformatdescriptor;
开始
mem_zero(pfd,sizeof(pfd));
pfd.nSize:=sizeof(pfd);
pfd转换:=1;
dwFlags:=pfd_DRAW_TO_WINDOW或pfd_SUPPORT_OPENGL或pfd_DOUBLEBUFFER;
pfd.iPixelType:=pfd_TYPE_RGBA;
pfd.C颜色位:=32;
pfd.iLayerType:=pfd_主平面;
pfd.cStencilBits:=4;
gl_像素_格式:=选择像素格式(设备上下文,@pfd);
如果gl_像素_格式=0,则
总账错误('choosepixelformat');
如果未设置PixelFormat(设备上下文,gl像素格式,@pfd),则
gl_错误('setpixelformat');
描述像素格式(设备上下文、gl像素格式、sizeof(pfd2)、pfd2);
如果((pfd.dwFlags和pfd2.dwFlags)pfd.dwFlags)或
(pfd.ipixeltypefd2.iPixelType)或
(pfd.cColorBitspfd2.cColorBits)或
(pfd.iLayerType PFD2.iLayerType)或
(pfd.cStencilBits>pfd2.cStencilBits)然后
gl_错误(“描述像素格式”);
...
结束;

错误发生在行(pfd.cStencilBits>pfd2.cStencilBits)上,我似乎无法通过mesa找到cStencilBits不是0的像素格式,因此我无法获得支持模具的上下文。

事实证明choosepixelformat无法选择仅通过mesa opengl32.dll可用的像素格式,wglchoosepixelformat可以选择仅通过mesa可用的像素格式,因此我的问题得到了解决,因为我现在能够在使用此旧程序的远程桌面连接时使模具缓冲区工作

我不明白,但没有时间去研究(如果你知道答案,请在这个答案的评论中发布),那就是setpixelformat和describepixelformat都可以很好地使用像素格式,只有通过mesa才能使用。我希望选择PixelFormat/setpixelformat/describepixelformat中的所有3个都可以全部工作或全部不工作,但事实就是这样