Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (529)
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  
  best way to do shaders  (Read 1456 times)
0 Members and 1 Guest are viewing this topic.
Offline deepthought
« Posted 2010-12-09 14:25:52 »

if i use shaders in one of my programs, should i use the shaders built into opengl 2.0 or the ARB shaders?

jocks rule the highschools. GEEKS RULE THE WORLD MWAHAHAHA!!
captain failure test game
Offline lhkbob

JGO Knight


Medals: 32



« Reply #1 - Posted 2010-12-09 15:44:27 »

Use the 2.0 shaders since the ARB shaders are getting quite old.  So long as your hardware supports it, I think the 2.0 shaders are worth learning more than some desperate attempt to support old/legacy hardware with people who might play the game.  Additionally, there are newer shader versions than the one for OpenGL 2.0 but they only differ in the syntax of the GLSL code, all of the OpenGL glue is the same for 2.0 and up.  The ARB shaders have very different glue, and I believe the language is closer to assembly, which just isn't fun to work with.

Offline gouessej
« Reply #2 - Posted 2010-12-09 21:55:14 »

I agree with lhkbob, ARB shaders are very difficult to use, very low-level and that is not worth the effort except if lots of people using your game own such an hardware. Personally I prefer not using shaders on graphics cards that supports only ARB shaders.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline deepthought
« Reply #3 - Posted 2010-12-09 23:05:43 »

only problem is that both the lwjgl demo shaders and the one at  http://lwjgl.org/wiki/index.php?title=GLSL_Shaders_with_LWJGL  both use ARB shaders. also, the lwjgl demo works both on my home computer and school computer, while a program i made with the 2.0 shaders only works on my machine.

jocks rule the highschools. GEEKS RULE THE WORLD MWAHAHAHA!!
captain failure test game
Offline bobjob

JGO Knight


Medals: 10
Projects: 4


David Aaron Muhar


« Reply #4 - Posted 2010-12-10 00:08:59 »

I was under the impression all shaders were built on top of low level shaders, so low level shaders will be supported for a long time to come.

My Projects
Games, Webcam chat, Video screencast, PDF tools.

Javagaming.org with chat room
Offline cylab

JGO Ninja


Medals: 38



« Reply #5 - Posted 2010-12-10 10:35:40 »

I think here is a small misunderstanding. There are legacy ARB shaders with low level (assembly) code, but in this thread it's only about if one should use GLSL shaders via the ARB or the 2.0 functions. Since both are more or less the same with the only difference being a ARB prefix or suffix, it only is a matter of which OpenGL-Version you want to support.

I would go with the 2.0 stuff (drivers should be there by now). Simple leave out ARB suffixes and prefixes in the examples you find and you should be fine...

Mathias - I Know What [you] Did Last Summer!
Offline Spasi
« Reply #6 - Posted 2010-12-10 12:18:58 »

You can write 2 wrappers around both ARB and core functions, then choose the appropriate implementation at runtime.
Offline deepthought
« Reply #7 - Posted 2010-12-10 17:36:42 »

OK that makes sense.

can anybody help me convert this to return the modelviewprojection matrix?

package com.google.sites.lvgeeks.deepthought.utils.opengl.lwjgl;
import org.lwjgl.opengl.*;
import org.lwjgl.util.glu.*;
public class AnotherBloodyCamera {

   
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  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
public static void look(int FOV,float aspectratio, float atx, float aty, float atz,float yaw, float pitch,float roll)
   {
      yaw+=180;
      while(pitch>360||pitch<0)
      {
      if(pitch>360)
      {
         pitch-=360;
      }
      if(pitch<0)
      {
         pitch+=360;
         
      }
      }
     
      while(yaw>360||yaw<0)
      {
      if(yaw>360)
      {
         yaw-=360;
      }
      if(yaw<0)
      {
         yaw+=360;
      }
      }
     
     
      while(roll>360||roll<0)
      {
      if(roll>360)
      {
         roll-=360;
      }
      if(roll<0)
      {
         roll+=360;
      }
      }
     
     
     
      double yawrad = (Math.PI*yaw)/180;
      double pitchrad = (Math.PI*pitch)/180;
     
      float lookz=(float) (atz+(30*Math.cos(yawrad)));
      float lookx=(float) (atx+(30*Math.sin(yawrad)));
      float looky=(float) (aty+(30*Math.tan(pitchrad)));
     
       
      GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glLoadIdentity();
     
      GLU.gluPerspective(FOV, aspectratio, 1f, 9000f);
     
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glLoadIdentity();
       
        GL11.glRotatef(-roll, 0, 0, 1);
       
       
        GLU.gluLookAt(atx, aty, atz, lookx, looky, lookz, 0, 1, 0);
     
     
        //System.out.println(lookx+" "+ looky+" "+ lookz);
     
   }
   
}


thanks! Smiley

jocks rule the highschools. GEEKS RULE THE WORLD MWAHAHAHA!!
captain failure test game
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.

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

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

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

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

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

Riven (41 views)
2014-07-14 18:02:53

OpenGLShaders (28 views)
2014-07-14 16:23:47

Riven (28 views)
2014-07-14 11:51:35

quew8 (25 views)
2014-07-13 13:57:52

SHC (61 views)
2014-07-12 17:50:04
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!