Harshit Gangal
Harshit Gangal

Reputation: 1

Java 3D Draw on models

How to draw on a 3D model in java 3D. Like draw Line or a point.

I have been able to import models. But stuck on how to draw on models.

Please Help

Thanks

Upvotes: 0

Views: 1137

Answers (2)

PraveenMax
PraveenMax

Reputation: 717

For simple primitive models like cube,follow this rule for static scenes

1)Decide the face on which you want to draw.

2)Note down the x,y,z co-ordinates .(if u are going to draw on the POLYGON,then you will get four points in space-coords each having x,y,z.)

3.)now use drawLine() of Graphics class. Something like this

   public void drawsomething(Graphics g)
   {
         g.drawLine(originz,originy,x,y)        
   }

4.) make sure that the points originx,originy,x,y are within the bounds of the co-ords mentioned in point "2".

For dynamic scenes, try different transformations, so they all move along.

Upvotes: 0

Scott
Scott

Reputation: 9

In java3d you don't really "draw" on a model. In java3d you create a scene graph with the model to be displayed. Then you compile the scene and display it in a view. If you want to draw something else in the display you have to create geometry that represents what you are drawing in the model. You can place text and words on the geometry using texture mapping. You can place words in the scene using Text3D. If you haven't done much 3D stuff before it takes a while to learn. There are a lot of good examples and tutorials on the java3d site https://java3d.dev.java.net/.

Upvotes: 1

Related Questions