渲染到纹理阵列与ATI硬件



我有一个OpenGL实现,据说应该可以渲染到纹理数组。这是通过在几何着色器中选择不同的图层来实现的。虽然,问题是,这并不工作,由于ATI驱动程序的错误。我真的很想让这个工作,我已经提出了几个替代方案,关于如何继续:

  1. 重制Direct3D的实现,ATI驱动在D3D更好吗?
  2. 想出一个变通办法(虽然想不出来)。
  3. 购买nVidia卡。

我该怎么办?还有其他选择吗?

这是一种过时的方法,但它应该在ATI卡上工作。这将渲染深度贴图到纹理,但你可以渲染几乎任何东西。

// generate texture (in init method)
init(){...
glGenTextures(1, &depthTexture);
glBindTexture(GL_TEXTURE_2D, depthTexture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 512,
512, 0, GL_DEPTH_COMPONENT,GL_FLOAT, 0);}
// draw the mesh to fill the depth buffer
glDisable(GL_LIGHTING);
draw_mesh();
// copy depth buffer to texture
glBindTexture(GL_TEXTURE_2D, depthTexture);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 512, 512);
// clear screen
cls();
// enable texturing and bind the depth texture
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, depthTexture);
// overlay texture to fullsizequad
drawFullsizeQuad();

考虑向ATI提交一个bug:您的测试用例(分层渲染)应该很小,并且可以100%重现。

最新更新