new to LWJGL

i am thinking of switching to LWJGL and have looked at some of the examples and i’m wondering, why does it use static methods? there’s nothing similiar to a glautodrawable there. what the heck?

a) It’s the natural way to do it. You can copy/paste existing C/C++ code and it will just work (with static imports). All 3 bindings in LWJGL work like this (AL/GL/CL).

b) Context management is explicit with OpenCL. With OpenGL, whenever you call a static LWJGL method it will run on the current context of the current thread. So, there’s never a need to pass instances around.

A lot of what JOGL added to it’s ‘OpenGL binding’ has nothing to do with OpenGL at all, and makes little sense in procedural programming (as opposed to object oriented programming). When you look at C code, there are no abstraction layers, interfaces, threads… everything happens in your main-loop.

With LWJGL you can do exactly the same thing in Java… the way it was meant to be.

I’ve always thought Jogl should have been implemented in two parts - the raw opengl access layer (which is basically what LWJGL does) with static functions and then the jogl-specific object layer (GLEventListener et al) layered on top of that. The fact that jogl always shoved this completely made up API down your throat has always been one of my major gripes.

Then you get newcomers who start with Jogl and think that’s the only way to do it and that they ‘know’ opengl, when really they don’t. It’s almost straight out of MS’s embrace-extend-extinguish tactics book. :-X

Yes, it was rather annoying wasn’t it. You can implement JOGL in terms of LWJGL… but not the other way around. Well, not easily.

Cas :slight_smile:

at least that’ll make porting easier. most examples are in C++ anyways.

2 questions

i’m on a school computer and when i try anything i get a pixel format not accelerated error and all i get is a white screen. why is this?

  1. how do i do vertex arrays? i’ve really gotta get away from fixed function

Thanks!

pixel format not accelerated just usually means that opengl driver is not available on the machine. So either the video card is too crap to run OpenGL or it needs new drivers.

As for vertex arrays, just search for a tutorial, theres plenty of tutorials out there that you can just adapt to LWJGL.

[quote]pixel format not accelerated just usually means that opengl driver is not available on the machine. So either the video card is too crap to run OpenGL or it needs new drivers.
[/quote]
JOGL worked. and how am i supposed to install drivers with a limited account?

would anyone know if JOGL bundles an Opengl dll with its resources?

for the moment:
Try just using the default Display.create() without setting a DisplayMode first, also dont call setFullscreen mode.

Could be the case that the software renderer is kicking in on JOGL.

try running with -Dorg.lwjgl.opengl.Display.allowSoftwareOpenGL=true

thanks! it even works on the 800 mhz dinosaur we’ve got

Matzon is it possible to set this property at runtime?

In the case of a pixel format not accelerated error being caught.

edit:
nvm, I assume it already works like this, didnt see the word “allow”

System.setProperty(“org.lwjgl.opengl.Display.allowSoftwareOpenGL”,“true”); pasted into the first line of your main method will set the prop. at runtime.

P.S. how would i load a texture from a java Graphics2D, image, or BufferedImage?
my programs will handle textures by combining them into one big giant megatexture in java2d and then loading it into opengl.

[quote]the recommended way to load various texture and sound formats in LWJGL is to use the Slick-Util library (note different from Slick2D).
You can get it from http://slick.cokeandcode.com/downloads/util/ and the javadoc is located at http://slick.cokeandcode.com/javadoc-util/
Its pretty easy to use, just download the package and have a look at the examples included in the source code on how to use it.
[/quote]
just curious. why are you loading your textures into one megatexture? is it for performance?

If you really want to do that sort of thing, maybe LWJGL isn’t for you, you could instead have a look at Slick2D, it basically has a very similar api to Java2D and has all the advatages of using LWJGL for 2d games.

  1. you said 2D games. i’m eventually gonna make a 3d fps
    1.my game’s just gonna put everything into one giant vertex array, or when i figure out how to do one, VBO. a megatexture is the best way of having all the textures available
  2. did you notice i started my points off with 0 instead of 1?

Slick-utils will work for texture loading for 2d or 3d, but you probably don’t want Slick2D - instead you might want to look at Ardor 3d ( http://ardor3d.com/ ) to stop you having to rewrite a whole 3d renderer yourself (unless that’s what you really want of course. :slight_smile: )

i actually want to write my own 3d renderer. i gotta have some challenge in computer science class after i’ve finished dome rediculously easy assignment