GLSL shader


Topic related to current development efforts on the core engine and demos

User avatar

Veteran

Posts: 134

Joined: Fri Apr 17, 2009 7:38 am

Location: Finland

Post Tue Mar 09, 2010 1:30 pm

GLSL shader

Now trying add GLSL shaders to my scene but one little thing ;)
not all my objects need shader, but it seems that when some object uses shader, it is used other objects too (if object does not have shader). My objects shader is then used skybox also, that is not what I want. "Empty"/"fixed pipeline" shaders needed?

Second thing when using opengl, log file grows fast with (annoying) "Vertex Texture not implemented using fallback method." -line.


And tried compile xna-project (I installed today xna gs 3.1), but probs at "using Axiom.RenderSystems.Xna.Content;"-lines (Content is missing). This might be WIP and changing a lot (?), and not so important to me.

(axiom from trunk, tested with xp, ati4870)
User avatar

Veteran

Posts: 134

Joined: Fri Apr 17, 2009 7:38 am

Location: Finland

Post Thu Mar 11, 2010 7:38 am

Re: GLSL shader

More glsl:

I made simplest texture glsl -shader so I can see at least something on the screen
  Code:
-vertex shader-
void main()
{
   gl_TexCoord[0] = gl_MultiTexCoord0;
   gl_Position = ftransform();
}
-pixel shader-
uniform sampler2D tex;
void main()
{
   vec4 color = texture2D(tex, gl_TexCoord[0].st);
   gl_FragColor = color;
}


and problems are, that objects that does not have shader, renders fine (using this but they shouldnt use any shader) but that one object that uses shader, it uses wrong texture.
User avatar

Site Admin

Posts: 1272

Joined: Thu Mar 02, 2006 11:29 pm

Location: Boston, MA, USA

Post Thu Mar 11, 2010 9:36 am

Re: GLSL shader

migel wrote:More glsl:

I made simplest texture glsl -shader so I can see at least something on the screen
  Code:
-vertex shader-
void main()
{
   gl_TexCoord[0] = gl_MultiTexCoord0;
   gl_Position = ftransform();
}
-pixel shader-
uniform sampler2D tex;
void main()
{
   vec4 color = texture2D(tex, gl_TexCoord[0].st);
   gl_FragColor = color;
}


and problems are, that objects that does not have shader, renders fine (using this but they shouldnt use any shader) but that one object that uses shader, it uses wrong texture.

Can you put together the sample project so I can test it out? Thanks.
Borrillis
The Steward of Axiom
User avatar

Veteran

Posts: 134

Joined: Fri Apr 17, 2009 7:38 am

Location: Finland

Post Thu Mar 11, 2010 11:27 am

Re: GLSL shader

Ok, here little test: dhost.info/haima/ax/cs/Test_proj.rar (this does not exist anymore).

Includes projectfile, sources and .exe.

When running the exe, it uses glsl shaders, and earth goes wrong (and when you turn camera, it changes texture when ogrehead left the screen).

When you remove vertex_program_ref Phong_vs and fragment_program_ref Phong_ps blocks in test.material, it works right (earth with eartmap).
Last edited by migel on Mon Jul 05, 2010 2:01 pm, edited 1 time in total.
User avatar

Site Admin

Posts: 1272

Joined: Thu Mar 02, 2006 11:29 pm

Location: Boston, MA, USA

Post Thu Mar 11, 2010 12:02 pm

Re: GLSL shader

migel wrote:Ok, here little test: dhost.info/haima/ax/cs/Test_proj.rar (copy to your address bar, dhost disabled hotlinking)

Includes projectfile, sources and .exe.

When running the exe, it uses glsl shaders, and earth goes wrong (and when you turn camera, it changes texture when ogrehead left the screen).

When you remove vertex_program_ref Phong_vs and fragment_program_ref Phong_ps blocks in test.material, it works right (earth with eartmap).

Awesome, I'll take a look at it shortly. And file a ticket for this as well if you wouldn't mind.
Borrillis
The Steward of Axiom
User avatar

Veteran

Posts: 134

Joined: Fri Apr 17, 2009 7:38 am

Location: Finland

Post Thu Mar 11, 2010 2:44 pm

Re: GLSL shader

And tested Cg too, with dx it works, but with opengl, problems:
Its first frame is ok, but then it goes wrong. You can see it ie Fresnel demo, add flag that it stops after first frame, and it looks right.

But ok, I write ticket(s).


[EDIT]:
Oops, fIrst frame isnt ok (i think that it came from memory because i tested dx version too).
But cg problem is just the same as glsl, wrong textures and shaders on objects that does not have shader.
Maybe bind/unbind problem?

Return to Engine Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.