Javatpoint Logo
Javatpoint Logo

JOGL 2D Objects

In the previous section, we have already learn how to draw a basic line in JOGL. Using the same methods we can also draw various type of shapes such as square, rectangle, triangle etc.

JOGL Square Example

In this example, we will draw four different edges in such a way that they all connect at a point in a shape of square.

Output:

JOGL 2D Objects Output

JOGL Triangle Example

In this example, we will draw three different edges in such a way that they all connect at a point in a shape of triangle.

Triangle.java

Output:

JOGL 2D Objects Triangle Output

Hence, any type of figure can be designed by just connecting the lines in the particular shape.






Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA