开发者

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开发者_C百科


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/.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜