Start with 3D

I would like to start with 3D in java, but I’m not sure what i should use. So far I have only tested lwjgl which I didn’t like. Mostly because I was forced to used the global variable “Display” to set options for the window. I prefer to have my windows in a variable, like how I have had it so far with JFrame. Also my friend (who is my graphic designer) uses blender, so it would be great if he could just export the files, and run them in the game without having some obscure file format to convert them to.

Um, sorry but you’ll have to deal with the Window being static. It’s a fact of life, and discounting an entire API for such a small feature is really kind of naive. OpenGL runs a ton of apps, and really is (as far as I know) one of your only options for 3D work in Java. So I would recommend getting used to it. LWJGL won’t auto import OBJ files though, maybe you need to take a look at JME.

OBJ isn’t exactly obscure.

I’m not disregarding it. But if it’s another API that suits me better, then I will take it. For it’s not only LWJGL that can run openGL, right? The main reason why I don’t want a static Display is because I’m use to have an List with my screen objects, so I can have multi monitor support.

No no no. That’s not how multi-monitor support works. LWJGL is just a binding for OpenGL, it doesn’t “run” anything. I would suggest taking another look at LWJGL and giving it a fair try because it really is a good API. Your only other choice (unless you get into game libraries) is using JOGL.

Actually, LWJGL also wraps windowing libraries for the different platforms, which is the cause of the issue. It has nothing to do with OpenGL.

With LWJGL 3.0 these problems should be solved.

Edit: If you don’t like some design, then use something like JGLFW which gives you access to GLFW windowing.

LWJGL 3.0 introduces non-static Displays correct?

I believe that’s the main feature behind 3.0.

It have worked good so far for me, and i still don’t like the static variables/methods, and when you said that it loads all the models for me, then that sets off even more warning signs for me. If i would want things to do that I would have stuck with making games with game maker. I like to feel like I have control over the code, like I’m doing the work, sure if I want that then I could try to code a whole engine myself. But I’m not at that level yet, I just want to be able to use 3D models, set up “cameras”, and then have some easier method for hit detection with the 3D models. I don’t want a API that takes control away from me, that forces me to abandon working with listeners, objects, and such.

So stop trying to convince me to try out LWJGL, I don’t like it, just accept it and move on. If you don’t have anything else to suggest, then just leave this thread.

I already suggested you try JME. I don’t know where this hostility is coming from, I’m simply stating a fact. LWJGL is a graphics API, it won’t do a bunch of stuff like load models for you. I’m sorry, but what you’re asking for doesn’t exist. There is no way to write a game engine yourself, but have OpenGL do stuff like collision detection. You either write it yourself, or use a game engine/library. This isn’t Java2D, its an advanced library.

Edit:
You misread my post. LWJGL does not handle model loading.

If you’re looking for something to do all the loading for you as well as have all the math functions already laid out, check out jME. I’m using it to develop my current game (which should have a preview out within a couple months ;)) and it is a great thing to use. Sure, you have to do lots of reseach, I’ve spent more time reading than coding but that’s expected of any high level engine. They also have a really great community forum.

On the other hand, if you want to get down and dirty, which I’ve seen that you don’t, use JOGL or LWJGL or some other binding/library. Now you have stated that you do not want to learn this as it may be over your head right now and that is completely understandable, but I do suggest that you maybe take some time with a something higher level like jME and then try out LWJGL/JOGL/other again. This will help you know exactly what is going on under the hood, and will teach you a great deal more about the graphics pipeline than a high level engine.

I made a topic about jME a little bit back and it contains some great points, good and bad, about the engine. Check it out: http://www.java-gaming.org/topics/jme-what-s-the-catch/30551/msg/282213/view.html

You’re the first person I’ve seen that’s ever had a real problem with LWJGL’s static API.

What is it really worth to you? You could use viewport changing to cover many use cases, and when that doesn’t work, just make a new thread and go from there.

If you’re complaining about model-loading, then LWJGL probably isn’t for you. If OpenGL doesn’t have it, LWJGL most likely doesn’t either (there are very few exceptions, nearly all of those are to make OpenGL calls more accessible from Java).

After getting some hours of sleep, and reading this thread again, I think I’ll wait until LWJGL 3.0 comes out, and test it, I might not like it. But JME sounds worse.

The biggest issue I have is the static Display method, I prefer to have them as objects, it make much more sense to me. I have only programmed in java2D so far, with no other library’s attached (a side from those I made myself.), and if I want two windows I just run new Frame() twice, I don’t think that’s possible in LWJGL.

Also when I try LWJGL, what do I exactly have to give up? Can I just use LWJGL to do the rendering, and keep using java’s own listeners, and my own game loops?

Please explain why you need two windows at the same time? It does not make sense to me in a game.

You can hook up Display to canvas2d from java. Its pretty easy. Display.setParent(Canvas canvas) and your display become canvas 2d, meaning, you can create lwjgl application in JFrame.

Display is static, because it makes things lot easier. It being static removes the need for you to handle stuff like OpenGL context, since when you call .create method, it creates context for current thread for you.

Since every window should have it’s own thread, you can create as many windows with opengl as you want… I don’t see the problem. Why would you want multiple windows for A GAME anyway?

Whats so weird about using multiple windows for a game? I mean its not done that often, but I can imagine some cool things to do with it (i.e. forward / rear view, a controls views & a world view, etc). You guys sound really conservative ;D

So I tested LWJGL, and remember exactly why I hated it. I won’t go into detail, for it will just turn into a rant. But if I made a screen object, and write all GL functions in there, they wouldn’t mess with each other, right?

I didn’t really get your thought…
Just wanted to mention something. You talk as if Display is a bad class. In CPP you need to make the window yourself, which is a lot of tedious work. You should be happy that someone else made it so easy to make a window and start rendering right away. It literally takes few lines of code to get something onto the screen…

One of the main reasons I learned Java instead of C++. I guess I’m going to like it once I understand it. For right now it doesn’t make much sense to me.

I mean like this, If I make a class called screen, and write all the GL code there, like the rendering, and display stuff. Will it work, or will it be issues when two of the screen objects tries to render at the same time?

Are you thinking of PC’s having two or more monitors installed or what? Games usually won’t have more than one window. That only window is used to render the game on. In games, some tutorials mention “Screen” as a different term. There, a “Screen” is a stage, or level, or the state of the game. There will be Menu screen, Intro screen, Game screen, Titles screen and more screens, but there will be only one window all the time. There are also a single screen at a time, which is called the “Active Screen”. That active screen is displayed on the only window of the game.

I think you’re really stuck on this multi-monitor thing, and you really need to not get hung up on it. There’s probably a way to do it, so as the saying goes, don’t judge a book by its cover. OpenGL is very powerful, the window is such a small part of it. But like I said earlier, it isn’t Java2D, so don’t expect it to be easy and have stuff already written for you. LWJGL is really nice because it handles the window and keyboard+mouse for you, something other bindings don’t do. If you really do want model loaders and the such, check out a game engine or library. It won’t take away functionality from you, it will just be more convenient.