Tag Archives: OpenGL

Appendix B: OpenGL Online Resources – Learning Java Bindings for OpenGL (JOGL)

This book and the excerpts on this blog are from 2004. Obviously, the API has changed a bit since then. I provide the older information and book in the hope that it will be useful to some hobbyists.

Purchase Printed Book Learning Java Bindings for OpenGL (JOGL)

 

Table of Contents: Learning Java Bindings for OpenGL (JOGL)

This book describes JOGL which was approved as JSR 231 and will become the javax.media.opengl package.

-T. Gene Davis

 

 

copyright 2004 by Gene Davis of genedavissoftware.com

This list of links is no longer maintained, but may give a starting point for searching for JOGL resources. 

Appendix B: OpenGL Online Resources

Various Web Resources

These links are all to C or C++ tutorials on OpenGL, but if you squint really hard it will look just like Java. So don’t let any C like gibberish put you out.

OpenGL Home Page: The Industry’s Foundation for High Performance Graphics

http://www.opengl.org/

 

OpenGL Survival Kit Tutorial by Nicole Deflaux Terry

http://www.cs.tulane.edu/www/Terry/OpenGL/Introduction.html

 

“Game Tutorials: Game Programming with Personality, From Start to Finish”

http://www.gametutorials.com/Tutorials/OpenGL/OpenGL_Pg1.htm

Continue reading Appendix B: OpenGL Online Resources – Learning Java Bindings for OpenGL (JOGL)

Appendix A: JOGL Online Resources – Learning Java Bindings for OpenGL (JOGL)

This book and the excerpts on this blog are from 2004. Obviously, the API has changed a bit since then. I provide the older information and book in the hope that it will be useful to some hobbyists.

Purchase Printed Book Learning Java Bindings for OpenGL (JOGL)

 

Table of Contents: Learning Java Bindings for OpenGL (JOGL)

This book describes JOGL which was approved as JSR 231 and will become the javax.media.opengl package.

-T. Gene Davis

 

 

copyright 2004 by Gene Davis of genedavissoftware.com

This list of links is no longer maintained, but may give a starting point for searching for JOGL resources. 

Appendix A: JOGL Online Resources

Various Web Resources

The JOGL Project

https://jogl.dev.java.net/

 

JSR 231: Java™ Bindings for OpenGL®

http://jcp.org/en/jsr/detail?id=231

 

The JOGL Project Forum

http://192.18.37.44/forums/index.php?board=25.0

 

“Jogl – User’s Guide”

https://jogl.dev.java.net/nonav/source/browse/*checkout*/jogl/doc/userguide/index.html?rev=HEAD&content-type=text/html

Continue reading Appendix A: JOGL Online Resources – Learning Java Bindings for OpenGL (JOGL)

Chapter 3: Animations – Learning Java Bindings for OpenGL (JOGL)

This book and the excerpts on this blog are from 2004. Obviously, the API has changed a bit since then. I provide the older information and book in the hope that it will be useful to some hobbyists.

Purchase Printed Book Learning Java Bindings for OpenGL (JOGL)

 

Table of Contents: Learning Java Bindings for OpenGL (JOGL)

This book describes JOGL which was approved as JSR 231 and will become the javax.media.opengl package.

-T. Gene Davis

 

 

copyright 2004 by Gene Davis of genedavissoftware.com

Chapter 3: Animations

Java Thread Review

Hopefully you’ve used threads before, but I’m going to give you a brief refresher course just in case it is dim in your memory. Threading in pretty much every language comes in two varieties.

One type of threading is to have a timer that acts like an alarm clock. You set it up to go off at some regular interval. In Java, this type of threading can be accomplished with the java.util.Timer class.

Here is a brief example of Timer’s use.

import java.util.*;

/**
 * This sample shows the creation of a Java
 * Timer object. Timers need a task and a
 * set time to wake up and do that task.
 */
public class TimerExample {

    public static void main (String args[]) {

        //our timer
        Timer alarm = new Timer();

        //our task (really a TimerTask object)
        TaskExample te = new TaskExample();

        //we schedule the Timer to wake up
        //and do 'te' ever 2000 milliseconds
        //(every two seconds)
        alarm.scheduleAtFixedRate(te, 0, 2000);
    }
}

Next we have the actual task to perform.

import java.util.*;

/**
 * Timers need a task to perform. Like we need
 * to go to school or work when our alarm
 * clock goes off, the program needs a task
 * to do when it is woken up.
 */
public class TaskExample extends TimerTask {
    /**
     * The task is placed in the run method
     * and performed whenever it is scheduled
     * to do something.
     */
    public void run(){
        System.out.println("Wake up!!!");
    }
}

The other type of thread is used to do something right away. It is created in Java by using the java.lang.Thread class.

Continue reading Chapter 3: Animations – Learning Java Bindings for OpenGL (JOGL)

Chapter 1: Hello JOGL – Learning Java Bindings for OpenGL (JOGL)

This book and the excerpts on this blog are from 2004. Obviously, the API has changed a bit since then. I provide the older information and book in the hope that it will be useful to some hobbyists.

Purchase Printed Book Learning Java Bindings for OpenGL (JOGL)

 

Table of Contents: Learning Java Bindings for OpenGL (JOGL)

This book describes JOGL which was approved as JSR 231 and will become the javax.media.opengl package.

-T. Gene Davis

 

 

copyright 2004 by Gene Davis of genedavissoftware.com

Chapter 1: Hello JOGL

First There Was OpenGL

For some years now, a programmer that wanted to create a graphics intensive program that could be sold to users of different Operating Systems had one choice — OpenGL. The GL stands for Graphics Library. OpenGL is a registered trademark of SGI. OpenGL manifests itself as a cross platform C programming API. In reality though, it is a hardware-independent specification for a programming interface.

Most of the reasons that people have given me over the years for the lack of a future for Java especially in the gaming industry was that you can’t use OpenGL in Java. They rightly pointed out that the fastest 2D and 3D applications use OpenGL.

OpenGL is for making graphics. It is fast. Most of the time it is hardware accelerated. It seems that OpenGL can do anything visually that you would want to do.

Unfortunately OpenGL is written for C. Let’s face it, C is not the most popular language for programming complex applications. One of the biggest drawbacks to OpenGL is that you can’t make it do anything without a window to put your graphics in, but OpenGL doesn’t provide a means for you to create windows. This makes OpenGL hard to learn for beginners.

Luckily GLUT was introduced and made dealling with windows, buttons and events generated by users easier to add to OpenGL heavy applications. Still learning OpenGL in C or even C++ can be painful for new programmers or programmers that want to use true Object Oriented Programming.

Continue reading Chapter 1: Hello JOGL – Learning Java Bindings for OpenGL (JOGL)

OpenGL in Cocoa

copyright 2001 by T. Gene Davis

One of the exciting things about Mac OS X is its tight integration with popular cutting edge technologies. One of those technologies is OpenGL. OpenGL is a software interface that assists easy and quick development of 2D and 3D images and enviroments. It is used for modeling by engineers and some of the coolest 3D games. It can also be used for more mundane 2D endevours.

Much of a program written in c using the OpenGL interfaces can be ported as is to new platforms. Only the actual window construction and keyboard/mouse events need to be rewritten. This may be defined in a system dependent fashion. GLUT (OpenGL Utility Toolkit) fills in where OpenGL leaves off. GLUT simplifies common tasks like opening windows, listening to keyboard event, listening to mouse events and drawing useful 3D objects, and best yet, does it in a system independent manner. Mac OS X has a GLUT framework and an OpenGL framework. (Again–very cool.)

There are a few hoops to jump through to get OpenGL and GLUT working in a Cocoa application, but after those are learned it isn’t that difficult to use Cocoa for OpenGL work in general. You’ll find that any tutorial or book on OpenGL or Cocoa can take over the training from there. One restriction is that OpenGL is c not java, so if you wish to use OpenGL in a Cocoa-java app, expect to brush up on you JNI.

Continue reading OpenGL in Cocoa