我知道即使在 stackoverflow 上也有很多关于这个主题/问题的东西,但我真的不明白。我在这个问题上已经有几个小时了。
public Vector select(float x, float y)
{
int viewport[] = { 0, 0, width , height};
float realY = ((float) ( height) - y);
float near[] = { 0.0f, 0.0f, 0.0f, 0.0f };
float far[] = { 0.0f, 0.0f, 0.0f, 0.0f };
GLU.gluUnProject(x, realY, 0, mg.mModelView, 0, mg.mProjection , 0, viewport, 0, near, 0);
GLU.gluUnProject(x, realY, 1, mg.mModelView, 0, mg.mProjection, 0, viewport, 0, far, 0);
float xr = near[0] / near[3];
float yr = near[1] / near[3];
float zr = near[2] / near[3];
return new Vector(xr,yr,zr);
}
/**
GLU.gluLookAt( gl, me.position.x, me.position.y, me.position.z, me.position.x, 0, me.position.z+1, 0, 1, 0 );
**/
1)是否有可能读取 z 缓冲区
glReadPixels(winX, winY, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, winZ);
GL11Extension 类实现了 glReadPixels 的 GL_DEPTH_COMPONENT 常量还是什么? http://developer.android.com/reference/javax/microedition/khronos/opengles/GL11ExtensionPack.html#GL_DEPTH_COMPONENT
2)或者是否可以用我的 glulookat 位置计算 z-Buffer 手动?
3)或者如何计算近远位置的碰撞。
感谢您阅读:)