Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
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  
  OpenGL: Can you use a mixture of old and new OpenGL functions?  (Read 407 times)
0 Members and 1 Guest are viewing this topic.
Offline tom_mai78101
« Posted 2013-12-26 05:05:44 »

Like this, for example:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
   public void initialize() {
      try {
         Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
         Display.setTitle("Test");
         Display.create();
      }
      catch (LWJGLException e) {
         e.printStackTrace();
      }
   }
   
   public void start() {
      Random random = new Random();
      while (!Display.isCloseRequested()) {
         GL11.glViewport(0, 0, WIDTH, HEIGHT);
         GL11.glClearColor(random.nextFloat(), random.nextFloat(), random.nextFloat(), 1.0f);
         GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
         
         //...
        //Some other codes irrelevant to this in-between these commented periods.
        //...
       
         int vertexShader = GL20.glCreateShader(GL20.GL_VERTEX_SHADER);
         GL20.glShaderSource(vertexShader, vertexShaderCode);
         GL20.glCompileShader(vertexShader);
         //...etc.
       
         
         //...
       
         Display.update();
         Display.sync(60);
      }
   }


And possible go from GL20 to GL30 and back to GL20, etc.? I know some functions were deprecated, but what if you can reuse old specifications and put them together in the new specifications of a program?
Offline opiop65

JGO Kernel


Medals: 153
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #1 - Posted 2013-12-26 05:17:54 »

You can use whatever functions you want as long as they work together. Nothing is going to stop you from using shaders with display lists, or buffer objects mixed with immediate mode etc... OpenGL is just a graphics library with a bunch of functions for the programmer to use. It's up to you to choose which ones will fit your needs, or the standards you employ.

I would like to note that some programmers do like to only use certain versions of OpenGL, for instance only using 4.x or above, which deprecates a lot of old code. Some people don't care what version number they use, and that's fine too.

Offline ra4king

JGO Kernel


Medals: 336
Projects: 2
Exp: 5 years


I'm the King!


« Reply #2 - Posted 2013-12-26 05:19:57 »

New versions build (or deprecate) on older versions. LWJGL simply has the functions and enums grouped into the version they were introduced in. You can use all that's appropriate and necessary.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline tom_mai78101
« Reply #3 - Posted 2013-12-26 05:22:37 »

For that case, I have come across an annoyance.

For deprecated OpenGL functions that were deprecated in the newer OpenGL specifications, but not in the older specifications, how do I disable the deprecated strikethrough and to limit the deprecation detection by specific classes only? As in, I'm only limiting myself to use OpenGL 2.0 and less, so please don't tell me that they are deprecated, as I know they are in the newer versions of OpenGL.
Offline opiop65

JGO Kernel


Medals: 153
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #4 - Posted 2013-12-26 05:25:02 »

No, they are not included in the new versions of OpenGL. Some functions are deprecated, some are outright removed, but when you use old deprecated functions, you are actually using the old OpenGL packages, not the new ones.

I do not know strikethroughs you're getting though, what IDE are you using?

Offline tom_mai78101
« Reply #5 - Posted 2013-12-26 09:17:22 »

Eclipse Java, Kelper.

Offline ra4king

JGO Kernel


Medals: 336
Projects: 2
Exp: 5 years


I'm the King!


« Reply #6 - Posted 2013-12-26 09:28:35 »

That OpenGL function is not deprecated. That LWJGL method is deprecated. It is now called glGetShaderi(int, int) Smiley

See here for more details about this change: http://lwjgl.org/forum/index.php?;topic=4721.0

Offline tom_mai78101
« Reply #7 - Posted 2013-12-26 10:27:58 »

Ah, thanks.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

pw (24 views)
2014-07-24 01:59:36

Riven (22 views)
2014-07-23 21:16:32

Riven (18 views)
2014-07-23 21:07:15

Riven (21 views)
2014-07-23 20:56:16

ctomni231 (50 views)
2014-07-18 06:55:21

Zero Volt (45 views)
2014-07-17 23:47:54

danieldean (36 views)
2014-07-17 23:41:23

MustardPeter (39 views)
2014-07-16 23:30:00

Cero (54 views)
2014-07-16 00:42:17

Riven (54 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
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!