Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (482)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (550)
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 states at start  (Read 745 times)
0 Members and 1 Guest are viewing this topic.
Offline Tyecon

Senior Newbie





« Posted 2013-04-01 20:31:31 »

What should I set the OpenGL states too when I start the program?

My current code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
//Initialize OpenGL
       System.out.println("OpenGL version: "+glGetString(GL_VERSION));
        GLVersion=Float.valueOf(glGetString(GL_VERSION).split(" ")[0]);
        glClearColor(0.1f, 0.1f, 0.2f, 0f);
        glEnable(GL_DEPTH_TEST);
        if (GLVersion>=3.2) {glEnable(GL32.GL_DEPTH_CLAMP); ModernGL=true;}
        glDepthMask(true);
        glDepthFunc(GL_LEQUAL);
        glDepthRange(0, 1);
        glClearDepth(1);
        glEnable(GL_CULL_FACE);
        glCullFace(GL_BACK);
        glFrontFace(GL_CCW);

Please have a baggy ready before looking at my code.
Offline davedes
« Reply #1 - Posted 2013-04-01 22:31:19 »

For a 2D game in the programmable pipeline, here is all the states you need:
https://github.com/mattdesl/lwjgl-basics/wiki/Display

You probably shouldn't tackle a 3D game unless you are already comfortable with the OpenGL pipeline.

Offline theagentd
« Reply #2 - Posted 2013-04-02 13:05:59 »

Tip:
1  
2  
3  
if(GLContext.getCapabilities().GL_ARB_depth_clamp){
   glEnable(ARBDepthClamp.GL_DEPTH_CLAMP);
}

No need to query the OpenGL version string. You can also check for OpenGL versions directly:
1  
2  
if(GLContext.getCapabilities().OpenGL32){
    ...

Myomyomyo.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Tyecon

Senior Newbie





« Reply #3 - Posted 2013-04-02 13:45:48 »

What is ARB? I see it everywhere all the time. Some kind of compatibility layer?

Please have a baggy ready before looking at my code.
Offline Danny02
« Reply #4 - Posted 2013-04-02 14:46:04 »

ARB means that is not a core feature.

every party which provides an OpenGL implementation(graphic card driver) can extend OpenGL with own extensions. You have probalby already seen some, they start with something like GL_[ATI/NV/APPLE...]_XXX or GL_EXT_XX

when other vendors decide that a extension is quite useful they make an official OpenGL extension out of it. ARB means Architecture Review Board and is a board out of a number of companies which decide how OpenGL should evolve.

After a while a ARB extension sometimes evolve into a new core feature of OpenGL.

Between these stages the API and usage of a extension can change a bit, so the first iteration of a Extension might only be usable on a Nvidia card but after the promotion to an offical extension it can be used on a lot of other graphic cards.

In your case GL_ARB_depth_clamp was based on NV_depth_clamp(written against OpenGL 1.2) and is written against OpenGL 3.1, but was included as a core feature in OpenGL 3.2.

So it might be possible that this extension is available to very old Nvidia cards with newer graphic drivers.


btw you can get all the info from the opengl registry which has an entry for every opengl extension: your example depth_clamp

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.

CopyableCougar4 (14 views)
2014-08-22 19:31:30

atombrot (28 views)
2014-08-19 09:29:53

Tekkerue (25 views)
2014-08-16 06:45:27

Tekkerue (23 views)
2014-08-16 06:22:17

Tekkerue (15 views)
2014-08-16 06:20:21

Tekkerue (22 views)
2014-08-16 06:12:11

Rayexar (61 views)
2014-08-11 02:49:23

BurntPizza (39 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (37 views)
2014-08-06 19:49:38
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!