Hello Guest

LWJGL with OpenGL 3.x++

  • 9 Replies
LWJGL with OpenGL 3.x++
« on: May 22, 2011, 09:11:04 »
I recently started reading into OpenGL.
At first I started reading the RedBook, which is pretty interesting and I'm really making progress.
But after some additional reading I noticed that most of the stuff I was learning is now outdated due to the release of OpenGL 3.x etc.
I tried searching for some Material on 3.x and had a very hard time to find anything that helped me. In addition to that, there seems to be nothing on LWJGL with 3.x? As a beginner, I'm have big problems translating 3.x tutorials in C++ to Java and LWJGL.

Can anyone recommend some reading about this topic? Or would you think it's best to go in with the RedBook?
Thank you very much, any information is appreciated :)


Offline spasi

  • *****
  • 2229
    • WebHotelier
Re: LWJGL with OpenGL 3.x++
« Reply #1 on: May 22, 2011, 10:55:49 »
These days it would be best if you read a book on the theory of 3D graphics rendering instead of something specific to OpenGL, especially a book written pre-3.0. It's also best if you avoid anything marked as deprecated in the OpenGL spec, or simply use the core version of the spec. I can imagine that for someone new to OpenGL it can be frustrating and confusing to have to learn about VBOs, vertex shaders and fragment shaders before even drawing a single pixel to the screen, but with OpenGL ES 2.0 and WebGL (which don't have the deprecated functionality) being so popular these days, there are dozens of examples on the web to get you started.

About LWJGL, you should look for code samples (even pre-3.0 stuff) to get familiar with how NIO buffers are used in the API. That's the only real difference between C and Java code and it's very straightforward if you get used to it. Porting any C/C++ code will be easy then (even Direct3D samples when you get familiar with shading languages).

Finally, read this post on JGO, the OpenGL Samples Pack should be helpful.

Re: LWJGL with OpenGL 3.x++
« Reply #2 on: May 22, 2011, 12:43:45 »


Offline spasi

  • *****
  • 2229
    • WebHotelier
Re: LWJGL with OpenGL 3.x++
« Reply #3 on: May 22, 2011, 13:16:42 »
You could checkout the OpenGL ES branch and have a look at the test code. It's very simple to port those examples to desktop OpenGL (just change the imports at the top).

Re: LWJGL with OpenGL 3.x++
« Reply #4 on: May 23, 2011, 07:04:55 »
« Last Edit: May 23, 2011, 09:00:16 by Kuko »

Re: LWJGL with OpenGL 3.x++
« Reply #5 on: May 23, 2011, 15:25:10 »
Thank you both, I will look into your suggestions :)

Re: LWJGL with OpenGL 3.x++
« Reply #6 on: August 18, 2011, 04:02:52 »
FWIW, over the next week or so, I plan to put together a tutorial about just this, as I have also had to overcome the hurdle of getting things working with modern opengl. I have the advantage of having worked with older opengl and when I stopped I was essentially at the point where I started learning the things that are standard for modern opengl, though.

I'll post a link and try to upload a copy to the wiki when I get it working. But until then, I have had much success by appending the word "modern" to my google searches. (So, "modern opengl tutorial".)

Hopefully that will lead you to some good places. :)

Also, I totally forgot to check the date on these posts. And here I thought I was being all helpful. XP
« Last Edit: August 18, 2011, 04:04:56 by AberrantWolf »

Re: LWJGL with OpenGL 3.x++
« Reply #7 on: August 20, 2011, 17:01:25 »
I think a tutorial like that whould be extremely useful. There arn't many modern openGL books around. The one i have found (the openGL super bible), is good but the tutorials are in c++ using freeGLUT. and glut seems to use different commands to create the window.
after that it shouldnt be too difficult to use C examples, since the OpenGL commands are mostly the same in C and java.
I whould assume that the problem is just getting started, since the LWJGL wiki tutorials (and others) look like they use quite old versions of OpenGL.
« Last Edit: August 20, 2011, 21:00:30 by Stevie W »

Re: LWJGL with OpenGL 3.x++
« Reply #8 on: October 22, 2011, 09:32:01 »
I feel that I am on the same boat as Morious.

I am brand new to OpenGL with minimal DirectX9 experience, and I have absolutely no clue where I should be reading to get a better understanding of how OpenGL is structured.

I have found from another thread that GL11 = GL 1.1, GL21 = GL 2.1, etc, and, with that information, I see that LWJGL supports OpenGL from version 1.1 up to version 4.2. The very basic tutorials provided by the wiki are using GL11, which I assume (like I said, I have no understanding of OpenGL right now ???) is the most outdated OpenGL standard available. From the research I've done thus far, there are so many varying opinions on whether or not NeHe's tutorials are worth reading (I don't even know what version of OpenGL those utilize, but it seems similar enough to the basic LWJGL tutorials on the wiki for them to be a viable starting point in my scenario). Some say that a lot of the functionality (workflow, whatever you want to call it) is deprecated, and that learning OpenGL away from the latest standards is not optimal, but I have no idea if learning the latest OpenGL standards is what I'm aiming for. I also assume that the latest standards require more up-to-date graphics hardware, and I'm definitely not trying to target the latest hardware (unless you consider Android to be "latest hardware"). What confuses me further is that, as mentioned, the basic LWJGL tutorials provided in the wiki utilizes version 1.1 of OpenGL. So are those tutorials really that old, or is it simply OpenGL 1.1 being a viable solution for it's minimal functionality? Is learning OpenGL from the latest specification really that big of a deal?

I'm frustrated at this point that all of the information I find is so volatile and misleading. I'm having an extremely difficult time trying to find a good starting point for me to start writing. I guess my biggest frustration is understanding the relationship between all of the OpenGL specifications.

Don't know if this warrants another thread, but I feel that Morious's issue doesn't stray too far away from mine.



Straight from the Official 4.2 Specification
OpenGL version 3.0, released on August 11, 2008, is the eighth revision since
the original version 1.0. When using a full 3.0 context, OpenGL 3.0 is upward
compatible with earlier versions, meaning that any program that runs with a 2.1 or
earlier GL implementation will also run unchanged with a 3.0 GL implementation.
OpenGL 3.0 context creation is done using a window system binding API, and
on most platforms a new command, defined by extensions introduced along with
OpenGL 3.0, must be called to create a 3.0 context. Calling the older context
creation commands will return an OpenGL 2.1 context. When using a forward
compatible context, many OpenGL 2.1 features are not supported.

So now from my understanding, as long as I write my code using an OpenGL 3.0 context, my code is backwards (AND/OR?) forward compatible depending on seemingly various configurations during context setup. But I have also discovered that NeHe's tutorials are painfully old, and should only be used for the concepts presented, so I highly recommend avoiding them. Rendering through VBO's is not as difficult as I had previously anticipated, either.

Useful Resources:

Official 4.2 Specification -

Information on Context Creation -
« Last Edit: October 22, 2011, 11:25:44 by Twinfun »


Offline Kova

  • *
  • 12
Re: LWJGL with OpenGL 3.x++
« Reply #9 on: October 22, 2011, 12:52:25 »
I also had the same problem: finding tutorials on opengl core versions... finally I came across book "OpenGL Superbible 5th edition" which is 800 pages long and covers only core opengl. It has it's problems explaining with clarity, but it explains everything you need to get started.