[SOLVED] fenggui viewport trouble with cel shading

i have a problem with the outline of cell shading

i use the exemple code

TestVertexProgramState of jme

But using the model in a viewport fenggui

I miss you he does not value that will show my outline corectly

my paint method :

public void paint(Graphics g, int viewPortWidth, int viewPortHeight)

      GL11.glClear( GL11.GL_DEPTH_BUFFER_BIT);
      GL11.glEnable (GL11.GL_DEPTH_TEST);
      GLU.gluPerspective(45, (float)viewPortWidth/(float)viewPortHeight, 1, 100);
      GL11.glHint (GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);   // Use The Good Calculations
      GL11.glEnable (GL11.GL_LINE_SMOOTH);         
      GLU.gluLookAt(10, 6, 8, 0, 0, 0, 0, 1, 0);
                GL11.glShadeModel(GL11.GL_SMOOTH);// Enables Smooth Color Shading
                GL11.glPolygonMode (GL11.GL_BACK, GL11.GL_LINE);      // Draw Backfacing Polygons As Wireframes
      GL11.glLineWidth (2);         // Set The Line Width
      GL11.glCullFace (GL11.GL_FRONT);            // Don't Draw Any Front-Facing Polygons




and  the cel shading function  it's a jme function

  private Torus createShadedTorus() {
           //Load the vertex program from a file and bind it to a render state
           VertexProgramState vp = renderer.createVertexProgramState();
           vp.setParameter(lightPosition, 8);

           //Bind a 1-dimensional luminance texture for use by the vertex program
           TextureState ts = renderer.createTextureState();
                           "shading/shader.png"), Texture.MM_NEAREST,

           //Generate the torus
           Torus torus = new Torus("shadedTorus", 20, 8, 1.0f, 2.0f);
           return torus;

       private Torus createOutlineTorus() {
           CullState cs = renderer.createCullState();

          WireframeState ws = renderer.createWireframeState();

           Torus torus = new Torus("outlineTorus", 20, 8, 1.0f, 2.0f);


         //  .updateGeometricState(0.0f, true);
           return torus;

Your problem could be due to the following:

jME keeps track of any modifications done to the OpenGL state. If you modify the OpenGL state outside jME (via direct calls to OpenGL, for example) then you should tell jME that the OpenGL state it has is no longer valid.


It is likely but I did not understand, but two are already calculated torus. I simply let the command necessary for display in the viewport fenggui

   GL11.glClear( GL11.GL_DEPTH_BUFFER_BIT);
      GL11.glEnable (GL11.GL_DEPTH_TEST);
      GLU.gluPerspective(45, (float)viewPortWidth/(float)viewPortHeight, 1, 100);
      GLU.gluLookAt(10, 6, 8, 0, 0, 0, 0, 1, 0);


I also add the command it shows the outline or shade
Following if I put invalidateStates before or after my display
But the outline is full, and the thickness of his its lines  that I outline changes in the torus is not counted

It's funny because it is good shader but not the outline...

By increasing the value of my outline torus I get the cel shading
But why the Line Width unchanged?
shade torus:

Torus("shadeTorus", 30, 18, 1.0f, 2.0f);


Torus("outlineTorus", 30, 18, 1.1f, 2.0f);

i modify the OpenGL state outside jME
but not a Line Width

Modifying the GL state outside of jME could lead to many problems. If you're going to modify the state at least update it in the state records.

and how update the state ?

In your case, you don't need to update the state. What you're trying to do in your OpenGL calls is already possible to do in jME using the camera and renderer classes. It is counterintuitive to mix OpenGL and graphics engine code the way you do it…

Via fenggui I try to display in a view port

Models 3d loaded with jme

For a model 3d in a window

Yes it is true the rendering engine makes the cell shading just

This same model in cel shading imported into the viewport

Not showing corectly when he displayed corectly outside the viewport