Point and line sizes for meshes


I’m actually developing an application that has to deal with points clouds and line sets. In order to render the two components, i’m using underlying meshes as follows:

Points cloud:

	      Material mat = new Material(application.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
      mat.setBoolean("VertexColor", true);
      Mesh m = new Mesh();
      m.setBuffer(VertexBuffer.Type.Position, 3, coords);
      m.setBuffer(VertexBuffer.Type.Color, 4, colors);
      m.setBuffer(VertexBuffer.Type.Size, 1, sizes);
      geometry = new Geometry("Point Cloud", m);

Line set:

Mesh line = new Mesh();

	      // Line from 0,0,0 to 0,1,0
	      line.setBuffer(Type.Position, 3, new float[]{ (float)pos.getX(), (float)pos.getY(), (float)pos.getZ(), (float)orus3dTrajectoryPreviousPos.getX(), (float)orus3dTrajectoryPreviousPos.getY(), (float)orus3dTrajectoryPreviousPos.getZ()});
	      line.setBuffer(Type.Index, 2, new short[]{ 0, 1 });

Material trajectoryMat = new Material(viewer.getJMEApplication().getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");


      com.jme3.scene.Geometry lineGeom = new com.jme3.scene.Geometry();


My two concerns are about the size on points an lines. I would like to dynamically set the point size and the line width oh the displayed meshes. However, the methods related to points size and line width are deprecated within the JMonkey documentation.

For the point size, it is recommended to use shaders properties to deal with the point size I also tried another solution that was to set GL11 values as follows:

      if (GL11.glIsEnabled(GL32.GL_PROGRAM_POINT_SIZE)) {

This method work for the first call to GL11 bu throws an access violation exception if i try to run it another time.
According to the mesh line width, the previous code (related to mesh line) does just do nothing (the mesh lines are always 1 pixel width.)

Can someone tell me how to handle dynamic points size and line width for meshes ?

Thanks a lot,


1 Like

That should work. Not sure why it isn’t working for you.


I dynamically set point size and line width in the Material, like so:

pointMaterial.setFloat("PointSize", size);

I always use my own material (not Unshaded.j3md) but I’ve forgotten why.

Also, be aware that there’s an open issue regarding point sizes: issue 878

1 Like

Did you solve the issue you were having?

I also need to set line width on a Line mesh but it does not work for me too.

my code:

private Geometry createLine(Vector3f start, Vector3f end) {
        Material mat = GuiGlobals.getInstance().createMaterial(ColorRGBA.Red, false).getMaterial();
        Geometry line = new Geometry("line", new Line(start, end));
        return line;

tried with both Unshaded and Lighting material.

1 Like

Hmm, to get sure if it is not a problem with Line mesh I also tried it with a Box mesh and yet not working. Previously this was working for me.

What version do you use? 3.3 right?

Line width work fine for me. I already use it for editor terrain paint circle (made from lines with some bigger width and i seen difference) and for sphere wireframe it work for me too.

maybe because i use LWJGL3 and you might use 2?

however i did not try change it dynamically…

Ah… just remembered why it does not work :man_facepalming:

it’s because of


OpenGL 3 core profile only supports line widths of 1 (do not know why), I am sure I had read it somewhere before.


OK, works fine !! with



I’ve tried this code:

Material mat = new Material(viewer.getJMEApplication().getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
Geometry lineGeom = new Geometry("line", new Line(start, end));

With various LWJGL renderer and here are the results:

LWJGL_OPENGL2: Line width can be modified
LWJGL_OPENGL3: Line width cannot be modified
LWJGL_OPENGL33: Line width cannot be modified
LWJGL_OPENGL4: Line width cannot be modified
LWJGL_OPENGL44: Line width cannot be modified
LWJGL_OPENGL45: Line width cannot be modified

I’m using jme3-lwjgl3 for the LWJGL rendering (the jme3-lwjgl jar is not in my classpath)

played a little arround this.

im using jme3-lwjgl3 jar, and


then Line width cant be modified.
and log line is:

  • OpenGL Version: 4.5.13476 Core Profile Forward-Compatible Context


then Line width can be modified.

in log line there is:

  • OpenGL Version: 4.5.13476 Compatibility Profile Context

the only difference in log line i see is:

Compatibility Profile Context


Core Profile Forward-Compatible Context

im not sure about difference and if this is the reason, but if openGL version is the same, then why in first it dont work and in second it work?

can someone explain difference here.

btw. @seinturier you said before AppSettings.LWJGL_OPENGL45 works for you, what did you changed? just PointSize vs LineWidth right?

can you try like me then just remove settings.setRenderer() line and look.

See here:

apparently, Line width has been @deprecated for some time. “forward-compatibility” basically means “only stuff that is guaranteed to still work next version,” whereas “compatibility” means “Stuff that worked as of 3.0, but was removed from 3.1”