Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Java3D graphics: solid line looks dashed

  1. Aug 19, 2012 #1
    Dear all,

    In Java and using Java3D library, I have created a GUI for viewing finite element quad element meshes. I am facing two problems with the graphics:

    1. In order to draw the meshes, I draw the quads and the edges separately so that I am able to remove one and leave the other on the screen view. The edges have different color than the quads. The problem is that when I choose line width 1.0f for the edges, they look like they are dashed. In fact they somehow overlap with the quads. If I choose wider lines, then it's fine but the appearance wont be good with thicker lines. How can I solve this problem?

    2. The second problem is that even without the quads, the lines have poor quality , that means then they are not parallel with the screen sides, they have teeth ( they are not drawn finely). How can I draw them finer?

    Your help would be appreciated.

    Thanks

    Hassan
     
  2. jcsd
  3. Aug 21, 2012 #2

    chiro

    User Avatar
    Science Advisor

    Hey Hassan2.

    For the second problem you should try to see if you can turn on what is known as Anti-Aliasing (AA). You can do this software side and hardware (driver side) and if you disable it driver side you disable it for all software applications. It should be in your graphics driver options.

    The other thing is to check whether the Java3D has a line style parameter. OpenGL has a line style parameter that allows you to set how you want to render lines and you should check if Java3D does as well.

    One suggestion for the quads is to choose an offset that is slightly out of place where you don't get overlap.

    Also you might want to check the texture options and make sure you have high quality textures and to use mip-mapping if you aren't using it.

    Another suggestion is to do one of the following: create a border in your initial texture so that the border is the same color of the line. If you are using a solid fill color as opposed to a texture, then have slightly different vertices for the line and for the actual quads themselves.

    The other suggestion is to use double precision for all your co-ordinate data instead of normal floating point numbers: this will make a big difference.
     
  4. Aug 22, 2012 #3
    Thanks chiro,

    I didn't find the AA option on my driver side. Enabling it on the software side makes the lines smoother but they are still broken ( due to overlapping).

    I think the problem with the brokenness is that I have defined a LineArray as the borders of the quads. I just figured out that there is no need for the LineArray and we can use PloygonAttributes to render the polygons ( here quads) as points, lines or fill. I have not been able to draw both the lines and the fill yet, but I believe we can render both and I expect the lines would have no problem.


    Thanks
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Java3D graphics: solid line looks dashed
  1. JAVA3D Loader Help (Replies: 2)

  2. JAVA3d help (Replies: 0)

  3. Java3D graphics (Replies: 0)

Loading...