[sdljava-users] Incorrect behaviour of glTranslatef() on Linux?
Status: Beta
Brought to you by:
ivan_ganza
From: Raffael H. <her...@ra...> - 2005-12-20 18:08:09
|
Hi, I'm having a strange problem with sdljava on Ubuntu Linux (Breezy). I=20 was trying go through the NeHe tutorials, but I already failed in the=20 first lesson because glTranslatef() seems to behave very strangely=20 (maybe incorrectly?). =46irst the Code: gl.glLoadIdentity(); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl.glColor3f(1.0f, 1.0f, 1.0f); // added by me, to be sure gl.glTranslatef(-1.5f, 0f, -6f); gl.glBegin(GL.GL_POLYGON); gl.glVertex3f(0.0f, 1.0f, 0.0f); gl.glVertex3f(-1.0f, -1.0f, 0.0f); gl.glVertex3f(1.0f, -1.0f, 0.0f); gl.glEnd(); gl.glTranslatef(3.0f, 0.0f, 0.0f); gl.glBegin(GL.GL_QUADS); gl.glVertex3f(-1.0f, 1.0f, 0.0f); gl.glVertex3f(1.0f, 1.0f, 0.0f); gl.glVertex3f(1.0f, -1.0f, 0.0f); gl.glVertex3f(-1.0f, -1.0f, 0.0f); gl.glEnd(); gl.flush(); surface.glSwapBuffers(); The problematic line is the 4th one: "gl.glTranslatef(-1.5f, 0f, -6f);" Like this, all I get is a black window. If I change -6f to 0f, it works=20 correctly, but of course, it's too big, that's why we want to move back=20 first. ;) The strange thing now is: If I change it to 1f or -1f, I get exactly the=20 same picture as with 0f. If, however, I change it to 1.1f or -1.1f, I'm=20 back at the black window. The x and y axis seem to work correctly. Do I have to set some flag somewhere with sdljava or is this actually a=20 bug in sdljava (or maybe some sort of incompatibility with Breezy)? Both OpenGL tests shipped with sdljava work fine BTW, but they don't use=20 glTranslatef(). Oh, and another thing, I also tried replacing=20 glTranslatef() with glTranslated(), but that's just the same thing. TIA, Raffi =2D-=20 The difference between theory and practice is that in theory, there is no difference, but in practice, there is. he...@ra... =B7 ICQ#67961355 =B7 PGP Key 5D1FF5F4 =B7 www.raffael.ch |