bonjour à tous,

j'ai un programme en opengl qui fonctionne bien pour l'affichage avec des arrays mais si j'essaie d'utiliser les vbo je prends une exception à la ligne 77 :
array vertex_buffer_object must be enabled to call this method

voici le code du gleventlistener :
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
 
 
        @Override
	public void init(GLAutoDrawable gLDrawable) {
		GL2 gl = gLDrawable.getGL().getGL2();
 
 
		// Check For VBO support
		vboEnabled = gl.isFunctionAvailable("glGenBuffersARB") &&
				gl.isFunctionAvailable("glBindBufferARB") &&
				gl.isFunctionAvailable("glBufferDataARB") &&
				gl.isFunctionAvailable("glDeleteBuffersARB");
 
		// Génération des buffers
		int[] gpuBuffers = new int[3];
 
		gl.glGenBuffers(3, Buffers.newDirectIntBuffer(gpuBuffers));
		gpuBufferVertices = gpuBuffers[0];
		gpuBufferColors = gpuBuffers[1];
		gpuBufferIndices = gpuBuffers[2];
 
		// Buffer d'informations de vertex
		gl.glBindBuffer(gl.GL_ARRAY_BUFFER, gpuBufferVertices);
		gl.glBufferData(gl.GL_ARRAY_BUFFER, vertices.capacity() * 4, vertices, gl.GL_STATIC_DRAW);
 
		// Buffer d'informations de couleurs
		gl.glBindBuffer(gl.GL_ARRAY_BUFFER, gpuBufferColors);
		gl.glBufferData(gl.GL_ARRAY_BUFFER, colors.capacity() * 4, colors, gl.GL_STATIC_DRAW);
 
		// Buffer d'indices
		gl.glBindBuffer(gl.GL_ELEMENT_ARRAY_BUFFER, gpuBufferIndices);
		gl.glBufferData(gl.GL_ELEMENT_ARRAY_BUFFER, indices.capacity() * 4, indices, gl.GL_STATIC_DRAW);
 
		gl.glEnableClientState(gl.GL_VERTEX_ARRAY);
		gl.glEnableClientState(gl.GL_COLOR_ARRAY);
	}
 
	@Override
	public void display(GLAutoDrawable gLDrawable) {
		long start = System.nanoTime();
 
		GL2 gl = gLDrawable.getGL().getGL2();
 
		int height = dimensionOf3dFrame.getHeight(), width = dimensionOf3dFrame.getWidth();
 
		if (height <= 0) {
			height = 1;
		}
 
		final float ratio = (float) width / (float) height;
 
		gl.glViewport(0, 0, width, height);
		gl.glMatrixMode(gl.GL_PROJECTION);
 
		gl.glLoadIdentity();
 
		glu.gluPerspective(camera.getFieldOfView(), ratio, 1.0, 500.0);
		gl.glMatrixMode(gl.GL_MODELVIEW);
 
		// Efface l'ecran, le tampon de couleur
		gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT| GL.GL_STENCIL_BUFFER_BIT);
 
		gl.glLoadIdentity();
 
		gl.glMultMatrixd(camera.getViewCopy(), 0);
 
		long time = System.nanoTime();
 
		// activate and specify pointer to vertex array
		gl.glEnableClientState(gl.GL_VERTEX_ARRAY);
		gl.glEnableClientState(gl.GL_COLOR_ARRAY);
 
		if(vboEnabled) {
			//VBO 
			// utilisation des données des buffers
			gl.glBindBuffer(GL.GL_ARRAY_BUFFER, gpuBufferVertices);
			gl.glVertexPointer(3, GL.GL_FLOAT, 3 * 4, 0);
 
			gl.glBindBuffer(GL.GL_ARRAY_BUFFER, gpuBufferColors);
			gl.glColorPointer(4, GL.GL_FLOAT, 4 * 4, 0);
 
			// liaison du buffer 
			gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, gpuBufferIndices);
 
			gl.glDrawElements(gl.GL_QUADS, indices.capacity(), gl.GL_UNSIGNED_INT, 0);// draw cube
		} else {
			// Vertex arrays
			gl.glVertexPointer(3, gl.GL_FLOAT, 0, vertices);
			gl.glColorPointer(4, gl.GL_FLOAT, 0, colors);
			gl.glDrawElements(gl.GL_QUADS, indices.capacity(), gl.GL_UNSIGNED_INT, indices);// draw cubes
		}
 
		// deactivate vertex arrays after drawing
		gl.glDisableClientState(gl.GL_VERTEX_ARRAY); // disable vertex arrays
		gl.glDisableClientState(gl.GL_COLOR_ARRAY);
 
		gl.glFlush();
 
		notifyDisplayUpdated();
 
		time = System.nanoTime();
		Logger.getGlobal().info("total time for display(): " + (time - start) / 1000 + "µs");
	}
je code ça sous eclipse avec le jdk 7.0 et jogl 2.0 rc5 (dernière version à jour) et je ne vois pas du tout d'où vient le probleme.

j'utilise un glcanvas inclus dans une jframe pour l'afficher.