instantreality forum
news: Welcome to the instantreality forums!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 25, 2018, 07:19:24 am


Login with username, password and session length


Pages: [1]
  Print  
Author Topic: [SOLVED] GLSL version compatibiltiy in X3D / InstantRealtity  (Read 4741 times)
marsuek
Newbie
*
Posts: 10


View Profile
« on: May 19, 2011, 12:21:58 pm »

Hi there,

I'm interested in general information about the use of GLSL-shaders in InstantReality. I have several questions:

On the website they say, that OpenGL 2.0 is supported, so that includes support for GLSL 1.1 as far as I know. InstantReality 2.0 introduced the geometry shader extension. Would that mean that just the extension or the whole update to GLSL 1.50 is supported from then?

As I read in the X3D specifications bibliography they refer to GLSL 1.1 (http://web3d.org/x3d/specifications/ISO-IEC-19775-1.2-X3D-AbstractSpecification/Part01/bibliography.html#[GLSL]) In how far is the x3d specification limitation compatible to the InstantReality specification? In other words: Is InstantReality an extension to X3D or even an update on X3D?

As far as I know from now I am just able to implement GLSL 120 shaders with InstantReality, that would include vertex, fragment and geometry shaders. I have tried the "pass-through" shaders from wikipedia in version 1.50 to try something more recent, but instant throws weird errors that look like it does not support version after 1.20.

I am working on a project with shaders. I am quite new to shader programming so I would prefer learning the most recent GLSL version. In addition to that I have heard that the newly introduced tessalation shaders would be quite better for my project, faster than geometry shaders and also they would include nearly the same features of creating or banning geometry.

I have also read some introducing words on Cg shaders. I'm not shure if I got it right, but I think it is possible to use the latest GLSL functions (version 4.1) in Cg. So would it be possible to use Cg as an interface to recent GLSL 4.1 in the "old fashioned" InstantReality interface?


I would prefer a quick feedback cause work is going on. Thank you.
« Last Edit: May 23, 2011, 05:32:49 pm by marsuek » Logged
yjung
Administrator
Sr. Member
*****
Posts: 260


View Profile
« Reply #1 on: May 20, 2011, 10:08:38 am »

Hi, please have a look at the corresponding tutorials:
http://doc.instantreality.org/tutorial/shader-programs/
http://doc.instantreality.org/tutorial/using-packagedshader-with-cgfx-support/
Logged
marsuek
Newbie
*
Posts: 10


View Profile
« Reply #2 on: May 23, 2011, 02:29:27 pm »

Okay thank you. So if I got it right I can sum up the following: Dependend to your graphic hardware it is possible to program your GLSL shaders up to version 3.3 in compatibility profile. The use of the core profile is limited in so far, that you may not be able to set all the uniforms via the InstantReality interface that are known as given variables in compatibility profile, in other words you are not able do define uniform buffers for your shaders with the same functionality and comfort known from OpenGL.
Further only the InstantReality interface forbids the use of GLSL 4.x features like tesselation shaders, because there is no possibility to create a <ShaderPart> of type "tesselationControl" or "tesselationEvaluation".
Is there a plan to update the interface?
Logged
yjung
Administrator
Sr. Member
*****
Posts: 260


View Profile
« Reply #3 on: May 23, 2011, 02:37:16 pm »

Quote
[...] in other words you are not able do define uniform buffers for your shaders with the same functionality and comfort known from OpenGL.

I'm not quite sure what you mean. You can make use of all GL state uniforms that are internally set during rendering. In addition, you can also define uniforms yourself.


Quote
Further only the InstantReality interface forbids the use of GLSL 4.x features like tesselation shaders, because there is no possibility to create a <ShaderPart> of type "tesselationControl" or "tesselationEvaluation".
Is there a plan to update the interface?

You're right, this is not yet possible, since the underlying renderer does not yet provide that functionality. But it's absolutely on our TODO list for the next release.
Logged
marsuek
Newbie
*
Posts: 10


View Profile
« Reply #4 on: May 23, 2011, 04:08:26 pm »

Quote
I'm not quite sure what you mean. You can make use of all GL state uniforms that are internally set during rendering.

Perhaps I misunderstood that term, I'm very unexperienced in shaderprogramming and new to GLSL, but what I meant where variables like: gl_ModelViewProjectionMatrix, gl_FrontColor, gl_Vertex, gl_Color, etc. - all the variables that became deprecated in newer versions.
I have to admit, that I didn't understand yet where all these variables have gone and how to access them now. I understood it as in the following: Variabels like "gl_ModelViewProjectionMatrix" have to be set as uniforms by hand, but I don't know how this should work for per-vertex variables like gl_Color etc. My problem is that recent tutorials tell you to access these "varying" variables by abitrary names and OpenGL just maps them by their "index" to a variable in the uniform-buffer you have setup in OpenGL. So my lack of comprehension is located in the difference between core and compatibility profile, I think.

Quote
In addition, you can also define uniforms yourself.
I can see that I can define uniforms for access to the modelview or the projection matrix for example, but referred to my last problem with the per-vertex variables I see no solution.

It is hard for me to explain this precisely in english, I hope you'll get it anyway.
Logged
yjung
Administrator
Sr. Member
*****
Posts: 260


View Profile
« Reply #5 on: May 23, 2011, 04:25:51 pm »

You can still use gl_ModelViewProjectionMatrix etc., they are all fully functional. And please note that varyings are variables between shader stages, while attributes are probably what you mean (for positions etc.). The latter are also set automatically, why gl_vertex etc. are available.
Logged
marsuek
Newbie
*
Posts: 10


View Profile
« Reply #6 on: May 23, 2011, 05:32:35 pm »

Okay, thank you. Now I see things a bit clearer...

I think my initial question about version support has now been answered. So I will mark this topic as solved.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.15 | SMF © 2011, Simple Machines