Issues with packages

Hey,

Maybe this should go in the clueless newbie subforum, I’m not sure. If this is the case, could a mod please be so kind as to move it there? :slight_smile:

A friend and I are experimenting with JOGL in hopes of learning some stuff and making a simple 2D graphics engine for a project in school over the coming months. So far, all the guides I’ve read that are supposed to get me started tell me to put the dlls in the bin folder of the JRE and the jar files in the lib folder of the JRE (when this didn’t work I put both the jar file and the files it contained in the lib folder. No change). I did this, and then tried to compile some sample code from the tutorials, and they all complain about packages not existing:

package net.java.games.jogl does not exist

I read on a sun-forum that I should use javax.media.opengl instead, but I get the same thing:

package javax.media.opengl does not exist

I’m trying to compile it in JCreator and I’m running windows vista. It seems to work fine for my friend who’s running debian, but I don’t know what he uses to compile stuff… (I am not willing to switch to linux at this time, so please don’t suggest that)

Any and all help is appreciated.

edit: I noticed that all the guides I find seem to be 5 years old or more. Are there any tutorials that are more up to date?

First: DON’T put jogl into some kind of system or jre folder. Please remove any occurence of jogl* and gluegen* jars/dlls from your computer before proceed. Just download and unpack a distribution for your platform into a dedicated folder (e.g. C:\dev\jogl or something).

You can use the info in this post to compile and run an jogl based application. Alternatively you can add the locations of the jars to your CLASSPATH environment variable and the folder containing the right dlls for your platform to the PATH environment variable like described in the JOGL - User’s Guide, section “Local installation for development”. Read it! :slight_smile:

You can then use this example code to get started.

Have fun!

Use say you want to make a “2D Graphics Engine”…JOGL is meant for 3D, if you simply want 2D then stick with basic Java and override the paintComponent() methods,etc and that should be about it.

@ cylab: I changed to netbeans and had the same problems, but your post solved them all. I can now compile and run stuff :slight_smile: Thanks a lot man

@ Z-Knight: Will using jogl be a lot harder? It can do 2d as well right? Cuz I would like to have some experience with it for whatever purpose it can fill in the future…

Thanks

JOGL for 2D? Well, it really depends on what you want to do in 2D. I just think that Java has a lot offer in the 2D world…JOGL is meant for 3D but you can obviously do 2D work…I’ve used it (actually OpenGL) to create a 2D finite element mesh viewer, but had I known Java at the time I would have likely went with it.

I think if you want to create a 2D viewer but would like to have the option to extend it to 3D then JOGL would be ok…that’s in fact what I did with my 2D mesh viewer - I gave the mesh depth and then I added mouse capability to rotate the mesh and view it from all sides…especially when I had a 2D crack propagating.

Anyway, I would at least investigate Java to see if that is sufficient.

OpenGL for 2D is like parking a Helicopter in a garage.

(But I bet you are in the newspaper as soon you made it ;D)

LMAO!!

But… I do keep my helicopter in my garage^^

Will java give access to surfaces, blend modes etc?

If your application is only going to be using 2D you are much better off using Java 2D. You can find more information about it here:

http://java.sun.com/docs/books/tutorial/2d/index.html

Almost everything you do in 2D will be much easier in Java2D. For instance if you want to create a rounded rectangle in Java2D you simply call “drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)”.

To do the same in JOGL you would need to either use some creative texturing with alpha set to 0 in the rounded corners, or create a highly tessellated rounded rectangle. To do this, you would need to specify the vertex arrays for every point in the rounded corners.

Basically, it is a lot harder to do 2D in a 3D world.

Don’t get me wrong though. JOGL (and OpenGL in general) are great libraries for doing anything in 3D. They are not hard to learn. They just don’t have all the functionality that the Java 2D library has for 2D. You are better off using the right library for the right task.

I often use Java 2D to create textures etc. on-the-fly and then map them to 3D objects using JOGL. You can see a great example of this on Chris Campbell’s blog:

http://weblogs.java.net/blog/campbell/archive/2007/01/java_2d_and_jog.html

This is a great example of using the best library for the task.

Good luck.