Java3D Tutorials

StdDraw3D: Importing StdDraw3D

Introduction

In this tutorial we will be importing the StdDraw3D class into a new project and making a sphere appear on the screen.

What You Will Need to Start

For this tutorial you will need to have completed the basic setup for a Java3D application, you will need to import all of the libraries that Java3D applications require. If you haven’t done that and don’t know how to do that, click here to find out how.

Implementation

Now, you’re going to need the source code for the StdDraw class. Click here to get the StdDraw.java code. In your IDE create a new class and call it “StdDraw3D”. Delete all of the code in that class and copy the code from the StdDraw.java from the link above.

Now create a new class, call this class “Main”. Create a main method within this class and write these three lines of code within the main method.

Now run the application and you should see a sphere being outputted to the screen.

That is it, as you can see this is a much simpler way of creating quick Java3D applications. I advise you to read through the methods within the StdDraw3D class and maybe render some different shapes to the screen.

In the next tutorial we will look into animation and positioning objects within 3D space.