glGenLists error

Hello,
as a clomplete newbie in jogl I write this code but genlist always return a 0


Triangle t = null;      
              float c1 =1f;
              float c2 =0f;
              float c3 =0f;
              float a =(float)width/2;
              float b =(float)height/2;
              float c =(float)depth/2;
            mcList = gl.glGenLists(1); 
            System.out.println("numero de liste : "+ mcList);          
                gl.glNewList(mcList,gl.GL_COMPILE);  
            
            gl.glBegin(GL.GL_TRIANGLES);    // display all triangle of the mesh
            for(Enumeration e =myTriangleMesh.elements(); e.hasMoreElements(); )
            {
                  t=(Triangle)e.nextElement();
                  
                  float [][] coordsTmp= t.getCoords();
                  float [][] normsTmp= t.getNorms();
                  gl.glColor4f(c2,c3,c1,0.25f);
                  //sommet 1
                  gl.glNormal3f(normsTmp[0][0],normsTmp[0][1],normsTmp[0][2]);
                  gl.glVertex3f(coordsTmp[0][0]-a,coordsTmp[0][1]-b,coordsTmp[0][2]-c);
                  //sommet 2            
                  gl.glNormal3f(normsTmp[1][0],normsTmp[1][1],normsTmp[1][2]);
                  gl.glVertex3f(coordsTmp[1][0]-a,coordsTmp[1][1]-b,coordsTmp[1][2]-c);
                  // sommet 3            
                  gl.glNormal3f(normsTmp[2][0],normsTmp[2][1],normsTmp[2][2]);
                  gl.glVertex3f(coordsTmp[2][0]-a,coordsTmp[2][1]-b,coordsTmp[2][2]-c);
            
            }            
            gl.glEnd();
            
            gl.glEndList();
            System.out.println("liste d'affichage OK");

I don’t understand why ?
\thx for help
Cook
ps : scuse my poor english

Code all looks ok, so back to the usual guesses: make sure you’re doing this in the right thread, and make sure the GL canvas has actually been initialised.

About the only other thing that can go wrong is that you’re trying this inbetween a glBegin/End pair (missing glEnd perhaps?). glGetError will tell you if you’re doing that. (And failing that, perhaps try using DebugGL).

in fact The code runs normally if I don’t use list, I have just put that :


mcList = gl.glGenLists(1); 
gl.glNewList(mcList,gl.GL_COMPILE);
...
gl.glEndList();

and place it in a function but nothing else change

I’ll look the glGetError so
Thx

glGetError return 0 ??? is it normal ??? :’(

This is where I want to call the list if it’s can help


/**
       * display the object on the screen
       */
      public void display() 
      { 
              if(transparency)
              {
                    gl.glEnable(gl.GL_BLEND);                              // Enable blnding for transparency
                    gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE) ; 
                    //gl.glBlendFunc(gl.GL_ONE, gl.GL_ONE_MINUS_SRC_ALPHA) ; 
                  gl.glDepthMask(false);
            
            }
            gl.glCallList(mcList);// appele de la liste d4affichage contenant le marching cube
            System.out.println("appel liste");
            if(transparency)
              {
                  gl.glDepthMask(true);
                  gl.glDisable(gl.GL_BLEND);
                  
            } // fin de la transparence
      }

Another stangre thing : if I call genList in the display function (totaly dummy) it works !!!

[quote]… and place it in a function but nothing else change
[/quote]
Yes, but where do you call it from? If you call it from another thread than the drawing one (probably powered by an Animator calling your .display() ) then it will just return 0. You probably want to put your call to this in the .init() method of your GLEventListener so it gets created once before you start your actual drawing.