Hello à tous,
voilà j'essaie de refaire de les tutoriels concernant de Néhé en java (sur JOGL)
http://nehe.gamedev.net
je me heurte au premier tuto ()
je n'arrive pas à avoir la couleur blanche pour le triangle et le quad.
De plus il a l'air d'avoir oublier quelques appels à glColor dans son code.
sinon lorsque je lance mon programme, je ne vois pas mon triangle?
voici mon code
pour la fonction init
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 public void init(GLAutoDrawable arg0) { GL gl = arg0.getGL(); gl.glShadeModel(GL.GL_SMOOTH); gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background gl.glClearDepth(1.0f); // Depth Buffer Setup gl.glEnable(GL.GL_DEPTH_TEST); // Enables Depth Testing gl.glDepthFunc(GL.GL_LEQUAL); gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); // Really // Nice // Perspective // Calculations }
pour la fonction d'affichage
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 public void display(GLAutoDrawable arg0) { GL gl = arg0.getGL(); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl.glLoadIdentity(); gl.glTranslatef(-1.5f, 0.0f, -6.0f); // Move Left 1.5 Units And Into // The // Screen 6.0 gl.glBegin(GL.GL_TRIANGLES); // Drawing Using Triangles gl.glVertex3f(0.0f, 1.0f, 0.0f); // Top gl.glVertex3f(-1.0f, -1.0f, 0.0f); // Bottom Left gl.glVertex3f(1.0f, -1.0f, 0.0f); // Bottom Right gl.glEnd(); // Finished Drawing The Triangle gl.glTranslatef(3.0f, 0.0f, 0.0f); // Move Right 3 Units gl.glBegin(GL.GL_QUADS); // Draw A Quad gl.glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left gl.glVertex3f(1.0f, 1.0f, 0.0f); // Top Right gl.glVertex3f(1.0f, -1.0f, 0.0f); // Bottom Right gl.glVertex3f(-1.0f, -1.0f, 0.0f); // Bottom Left gl.glEnd(); }
Voilà je ne comprend pas pourquoi j'ai ces deux problemes là
a+
omlip
Partager