在 JOGL 中调用 GLClear 时,过剩实体形状渲染为线
我正在尝试在 JOGL (和 Eclipse)中渲染一些简单的实体形状,然后逐个“层”地逐步浏览它们;但是当我添加 glClear 方法时,我得到的只是线框,而不是填充的形状!?如果我评论该线条(如下所示)显示实心形状,但“填充”到最大形状,然后不会再次缩小。例如,对于球体,前半部分很好,但如果有意义的话,后半部分会变成实心圆柱体。
public void render(GLAutoDrawable gLDrawable)
{
GL2 gl = gLDrawable.getGL().getGL2();
**//gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);**
gl.glColor3b((byte) 0, (byte) 127, (byte) 0);
gl.glLoadIdentity();
gl.glTranslatef(500, 350, -300);
glut.glutSolidSphere(300.0, 20, 16);
gl.glTranslatef(-500, -350, 300);
gl.glEnd();
gl.glFlush();
}
任何帮助将不胜感激,如果需要,我会发布更多代码。
谢谢 蒂姆
编辑为了更有意义
I am trying to render some simple solid shapes in JOGL (and Eclipse) and then step through them 'layer' by 'layer'; but when I add the glClear method all I get are wire frames, not the filled shape!? If I comment that line out (as below) displays the solid shape but 'fills' to the largest the shape will be and then does not shrink down again. e.g with a sphere the front half is fine but the back half comes out as a solid cylinder if that makes sense.
public void render(GLAutoDrawable gLDrawable)
{
GL2 gl = gLDrawable.getGL().getGL2();
**//gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);**
gl.glColor3b((byte) 0, (byte) 127, (byte) 0);
gl.glLoadIdentity();
gl.glTranslatef(500, 350, -300);
glut.glutSolidSphere(300.0, 20, 16);
gl.glTranslatef(-500, -350, 300);
gl.glEnd();
gl.glFlush();
}
Any help would be much appreciated, Ic an post more of the code if needed.
Thanks
Tim
EDITED To make more sense
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在创建球体之前插入它...它将告诉 Opengl 填充下一个绘制的多边形...
如果您再次想要线框,只需调用:
:)
insert this before you create your sphere... It will tell Opengl to fill the next polygons that are drawn...
if you want the wireframe again, just call:
:)