我有一个有趣的问题,同时显示两个或四边形,而显示一个工作正常。 我能够实现这个流行的教程,用于显示带纹理的简单四边形: http://www.jayway.com/2010/02/15/opengl-es-tutorial-for-android-part-v/
所以基本上我有一个名为SimplePlane的类,它完全像在教程中那样扩展了Mesh类。 我创建了一个SimplePlane实例:
public void onSurfaceCreated(...){
plane1 = new SimplePane(1,1);
plane2 = new SimplePane(1,1);
plane1.z = 2.0f
plane2.z = 3.0f
}
然后我绘制网格:
public void draw(GL10 gl) {
//set all gl variables as usual for opengl
plane1.draw(gl); // is displayed properly
plane2.draw(gl); //for some reason is not visible even that its behind plane1 and bigger to make sure plane1 is not covering plane2
}
问题是只显示第一个plane1。 如果在我的代码中我首先放置了plane2,那么平面2是diplayed而plane1不是。 请注意,它不是z位置问题,因为我通过创建一个更大和半透明来排除它。如果我评论一个,那么另一个是可见的。 我添加了日志记录,并且正在调用两个平面的绘制方法,但只有一个是可见的。
我是否可以接受这种方法,一个接一个地调用一个draw(gl),或者我必须像在教程中那样创建一个组对象?