rendering - Apply color using VAO in jogl -


i trying color polygons in jogl. have stored vertices in array, index array triangle order , color array. code follows, problem facing triangle white, , not color color buffer.

    float f[] = {1000,2000,-4000,-2000,-2000,-4000,2000,-2000,-4000,1000,-4000,-4000};     floatbuffer buffer = glbuffers.newdirectfloatbuffer(12);     this.coordcount = 12;     buffer.put(f);     buffer.rewind();      int indx[] = {0,1,2,1,3,2};     intbuffer indxbuffer = glbuffers.newdirectintbuffer(6); //total number of vertices     this.indexcount = 6;     indxbuffer.put(indx);     indxbuffer.rewind();      float color[] = {1,0,1,0,0,0,0,0,0,1,0,0};     floatbuffer colorbuffer = glbuffers.newdirectfloatbuffer(12);     colorbuffer.put(color);     colorbuffer.rewind();      gl.gldisable(gl.gl_texture_2d);     gl.glenableclientstate(glpointerfunc.gl_color_array);     gl.glenableclientstate(glpointerfunc.gl_vertex_array);     gl.glfrontface(gl.gl_ccw);      gl.glvertexpointer(3, gl.gl_float, 0, buffer);     gl.glcolorpointer(3, gl.gl_float, 0, colorbuffer);      gl.gldrawelements(gl.gl_triangles, this.indexcount, gl.gl_unsigned_int, indxbuffer);      gl.gldisableclientstate(glpointerfunc.gl_color_array);     gl.gldisableclientstate(glpointerfunc.gl_vertex_array);     gl.glenable(gl.gl_texture_2d); 

i doing rendering on nasa world wind globe. don't think should cause problems. can me figure out problem? stuck on while.

thanks,

got solution, had enable color , material.

   gl.glenable(gl2.gl_color_material);    gl.glcolormaterial(gl2.gl_front_and_back, gl2.gl_diffuse); 

Comments