Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Changing from GL11 to OGL 3  (Read 626 times)
0 Members and 1 Guest are viewing this topic.
Offline HeroesGraveDev

JGO Wizard


Medals: 64
Projects: 8


Muahahahahahaha...


« Posted 2012-12-12 22:16:17 »

I have been using Vertex Arrays and Interleaved VBOs as described here

I thought that this was the way to go until someone said that GL11 is deprecated and we should be using OpenGL 3 with Vertex Arrays and VBOs.

I am confused as I am using Vertex Arrays and VBOs, but I am still only using GL11 and GL15, not GL30.  Huh

Can someone please clarify what I should be using, and point me to a tutorial if my current usage is inefficient.

Thanks!  Smiley

Offline theagentd
« Reply #1 - Posted 2012-12-12 22:36:31 »

The newer OpenGL classes (GL30, GL31, etc) still rely on functions and enums from the older ones. The screen is still cleared with GL11.glClear(), VBOs are still created with GL15.glGenBuffers() and shaders programs are still created with GL20.glCreateProgram(). The difference is that a number of functions in those classes have been deprecated and can no longer be used (unless you're using the compatibility mode, which kind of defeats the purpose of it). For example, here's a line from when using sampler objects which store how a texture is sampled (filtering, wrap modes, etc) separately instead of inside the texture:

1  
GL33.glSamplerParameteri(id, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);


As you can see, the old GL11 enums are still used although the function glSamplerParameteri() is in GL33.

I'd like to point out that switching to OGL3 does not only mean that you'll have to use VBOs; the whole fixed functionality pipeline has been removed. For starters, it's impossible to draw anything at all without a shader.

Myomyomyo.
Offline HeroesGraveDev

JGO Wizard


Medals: 64
Projects: 8


Muahahahahahaha...


« Reply #2 - Posted 2012-12-12 22:40:09 »

Okay, I'll finish my current project, then think about switching afterwards

I did know that some methods were not deprecated in the older classes, but I didn't know which ones, so I wanted to make sure.

Can you confirm whether the VAO method in the article mentioned in my first post is good to use or not?

Thanks

Games published by our own members! Check 'em out!
Try the Free Demo of Titan Attacks
Offline theagentd
« Reply #3 - Posted 2012-12-12 23:15:17 »

From that article, any of those techniques that use VBOs are all okay (indexed, interleaved, etc). Vertex arrays are deprecated though (simply sending in a FloatBuffer to gl*****Pointer()). To convert them to OGL3 you'll also need to use shaders with custom shader attributes instead of the built-in shader attributes. glVertexPointer(), glColorPointer(), glTexCoordPointer(), etc are all replaced by a generic function called glVertexAttribPointer() and glEnableClientState() is replaced by glEnableVertexAttrib(). But for now, stick to using VBOs the way you currently do and worry about shaders in your next project! Wink

Myomyomyo.
Offline gouessej

JGO Ninja


Medals: 33
Projects: 1


TUER


« Reply #4 - Posted 2012-12-13 09:10:38 »

I'd like to point out that switching to OGL3 does not only mean that you'll have to use VBOs; the whole fixed functionality pipeline has been removed. For starters, it's impossible to draw anything at all without a shader.
It would be more explicit if there were separate interfaces for OpenGL 3.1 backward compatible profile and OpenGL 3.1 forward compatible profile. The fixed functionality pipeline has been removed from the core but it is still available in the optional extension ARB_compatibility.

Offline theagentd
« Reply #5 - Posted 2012-12-13 11:03:54 »

I'd like to point out that switching to OGL3 does not only mean that you'll have to use VBOs; the whole fixed functionality pipeline has been removed. For starters, it's impossible to draw anything at all without a shader.
It would be more explicit if there were separate interfaces for OpenGL 3.1 backward compatible profile and OpenGL 3.1 forward compatible profile. The fixed functionality pipeline has been removed from the core but it is still available in the optional extension ARB_compatibility.

http://lwjgl.org/javadoc/org/lwjgl/opengl/ContextAttribs.html

Set it up and feed it into Display.create().

Myomyomyo.
Pages: [1]
  ignore  |  Print  
 
 

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (67 views)
2013-05-17 21:29:12

alaslipknot (76 views)
2013-05-16 21:24:48

gouessej (109 views)
2013-05-16 00:53:38

gouessej (104 views)
2013-05-16 00:17:58

theagentd (115 views)
2013-05-15 15:01:13

theagentd (104 views)
2013-05-15 15:00:54

StreetDoggy (149 views)
2013-05-14 15:56:26

kutucuk (172 views)
2013-05-12 17:10:36

kutucuk (170 views)
2013-05-12 15:36:09

UnluckyDevil (179 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.296 seconds with 20 queries.