Java Java3D graphics: solid line looks dashed

AI Thread Summary
In a Java3D project for viewing finite element quad element meshes, two main graphics issues were identified. The first issue involves the appearance of edges drawn separately from the quads; when using a line width of 1.0f, the edges appear dashed and overlap with the quads. A suggested solution is to use an offset to prevent overlap and consider utilizing high-quality textures with mip-mapping. The second issue pertains to the poor quality of the lines, which appear jagged and not parallel to the screen edges. Enabling Anti-Aliasing (AA) can improve line smoothness, but the underlying problem may stem from the use of LineArray for the borders. It was noted that switching to PolygonAttributes could allow for better rendering of both lines and fills, potentially resolving the broken appearance of the edges.
Hassan2
Messages
422
Reaction score
5
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 won't 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
 
Technology news on Phys.org
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.
 
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
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...

Similar threads

Back
Top