Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

12046 Posts in 1593 Topics- by 597 Members - Latest Member: Cydfewoot

22. May 2013, 12:30:30 am
Xith3D CommunityXith3D InternalsDeveloper discussion (Moderators: Marvin Fröhlich, 'n ddrylliog)GLSL shaders - name search
Pages: [1]
Print
Author Topic: GLSL shaders - name search  (Read 2609 times)
Mathias 'cylab' Henze
Fierce Warrior
****
Offline Offline

Posts: 540

1064620
View Profile WWW
« on: 01. July 2008, 05:10:02 pm »

I have refactored the GLSLShaderProgram code to GLSL ShaderProgram, GLSLShaderProgramProgram and GLSLShaderProgramParameters. This makes it possible to reuse the same GLSLShaderProgram with different parameters for different shapes.

If anyone has a better idea for the naming scheme, please tell me Smiley.

Maybe one of the two should be named GLSLShaderProfile or GLSLShaderConfiguration etc.
« Last Edit: 01. July 2008, 06:42:53 pm by Marvin Fröhlich » Logged

Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4403


May the 4th, be with you...


View Profile
« Reply #1 on: 01. July 2008, 06:50:23 pm »

Sound like a good idea to me.

GLSLShaderProgramConfiguration
  -> GLSLShaderProgram
       -> GLSLVertexShader[]
       -> GLSLFragmentShader[]
  -> GLSLShaderParameters (or maybe GLSLUniformParameters?)

What do you think?

Marvin
« Last Edit: 01. July 2008, 06:52:09 pm by Marvin Fröhlich » Logged
Mancer
Enjoying the stay
*
Offline Offline

Posts: 68


View Profile
« Reply #2 on: 01. July 2008, 08:50:05 pm »

I think the double "GLSLShaderProgram" label could be confusing for new users.

First, what is the interest of the abstract class GLSLShader ?
Why the "GLSLShaderProgramConfiguration" is not simply this GLSLShader?
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4403


May the 4th, be with you...


View Profile
« Reply #3 on: 01. July 2008, 09:10:26 pm »

A shader is simply one "component" of a Shader Program. The Shader Program is composed of different shaders (some vertex-shaders and some fragment-shaders). The Shader Program is attributed by uniform variables. therefore we need a container class, that holds the collection of shaders and the assotiated parameters.

The reason for the need for the container class, instead of the way it was before (GLSLShaderProgram, contains shaders and parameters) is, that switching a ShaderProgram in the GL is the most expensive operation possible. Therefore we need a way to use the same (not an equal one, but the same) ShaderProgram for multiple Shape3Ds at a time, but with different uniform variables (i.e. their values).

As you may see, using GLSLShaderProgramConfiguration for a GLSLShader doesn't make much sense.

The abstract GLSLShader is needed to handle GLSLVertex- and GLSLFragmentShaders uniformly.

Marvin
Logged
Mathias 'cylab' Henze
Fierce Warrior
****
Offline Offline

Posts: 540

1064620
View Profile WWW
« Reply #4 on: 02. July 2008, 09:55:53 am »

I would like to keep the class names short. What about

GLSLContext
  -> GLSLProgram
       -> GLSLVertexShader[]
       -> GLSLFragmentShader[]
  -> GLSLParameters

I think we can omit the word Shader in most of the classes, because of GLSL being an abbreviation of GL Shading Language...
Logged

Mancer
Enjoying the stay
*
Offline Offline

Posts: 68


View Profile
« Reply #5 on: 02. July 2008, 10:16:07 am »

I would like to keep the class names short. What about

GLSLContext
  -> GLSLProgram
       -> GLSLVertexShader[]
       -> GLSLFragmentShader[]
  -> GLSLParameters

I think we can omit the word Shader in most of the classes, because of GLSL being an abbreviation of GL Shading Language...

Sounds good to me.
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4403


May the 4th, be with you...


View Profile
« Reply #6 on: 02. July 2008, 11:37:07 am »

I would like to keep the class names short. What about

GLSLContext
  -> GLSLProgram
       -> GLSLVertexShader[]
       -> GLSLFragmentShader[]
  -> GLSLParameters

I think we can omit the word Shader in most of the classes, because of GLSL being an abbreviation of GL Shading Language...

I agree almost totally. Since GLSLShaderProgram is an implementation/extension of the abstract class ShaderProgram it is not only common use, but also nice to use a prefix plus the name of the abstract class. And the "S" from GLSL doesn't obsolete the Shader term, since it means "Shading-Language". So we have a ShaderProgram in the GL-shading-language.

I really like GLSLContext Smiley.

So:
GLSLContext
  -> GLSLShaderProgram
       -> GLSLVertexShader[]
       -> GLSLFragmentShader[]
  -> GLSLParameters

ok?

Marvin
Logged
Mathias 'cylab' Henze
Fierce Warrior
****
Offline Offline

Posts: 540

1064620
View Profile WWW
« Reply #7 on: 02. July 2008, 12:21:55 pm »

yep Smiley
Logged

Mancer
Enjoying the stay
*
Offline Offline

Posts: 68


View Profile
« Reply #8 on: 02. July 2008, 12:34:22 pm »

/signed

 Grin
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4403


May the 4th, be with you...


View Profile
« Reply #9 on: 02. July 2008, 08:35:29 pm »

I have renamed the classes as above.

Marvin
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic