Ogre iphone shaders
-
- Halfling
- Posts: 92
- Joined: Wed Jun 01, 2005 10:33 am
Ogre iphone shaders
hi all,
i am wondering if this is possible to use ogre shaders to deport to gpu some image processing algorithms on an iphone
looks like it is possible : http://www.ogre3d.org/tikiwiki/Orange+S ... e=Cookbook
but i am looking for portable shaders, and it seems that we can use CG and HLSL shaders with ogre
i would like to know if i can then use GLSL shaders since HLSL should be compatible with on a iphone by using ogre 3D
i am wondering if this is possible to use ogre shaders to deport to gpu some image processing algorithms on an iphone
looks like it is possible : http://www.ogre3d.org/tikiwiki/Orange+S ... e=Cookbook
but i am looking for portable shaders, and it seems that we can use CG and HLSL shaders with ogre
i would like to know if i can then use GLSL shaders since HLSL should be compatible with on a iphone by using ogre 3D
-
- OGRE Retired Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: Ogre iphone shaders
Absolutely, but the GLES 2 rendersystem is only in the 1.8 branch.
-
- Halfling
- Posts: 92
- Joined: Wed Jun 01, 2005 10:33 am
Re: Ogre iphone shaders
shaders are only available with GLES 2 or i can use SDK1.7.2 to program shaders ? or is this rather a question of shaders language version ?
-
- OGRE Retired Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: Ogre iphone shaders
Ogre 1.7 does not include the GL ES 2 rendersystem. GL ES 1 doesn't support shaders.
-
- Halfling
- Posts: 92
- Joined: Wed Jun 01, 2005 10:33 am
Re: Ogre iphone shaders
switching to 1.8 then 
ty

ty
-
- Halfling
- Posts: 92
- Joined: Wed Jun 01, 2005 10:33 am
Re: Ogre iphone shaders
since am running ogre 1.8 on iphone now, i just tried to apply a basic shader i found there :
http://www.ogre3d.org/tikiwiki/Orange+S ... escription
to the demo robot i display
so i added orangeshader.cg & orangeshader.material to my resource path and tried to apply the shader with the following line :
but it generates a crash and log tells me that :
is it due to the shader format & i should try another shader language instead ?
http://www.ogre3d.org/tikiwiki/Orange+S ... escription
to the demo robot i display
so i added orangeshader.cg & orangeshader.material to my resource path and tried to apply the shader with the following line :
Code: Select all
m_poEntity = m_poSceneManager->createEntity( "Robot", "robot.mesh" );
m_poEntity->setMaterialName( "shader/orange" );
Code: Select all
WARNING: material shader/orange has no supportable Techniques and will be blank. Explanation:
Pass 0: Fragment program shader/orangeFP cannot be used - not supported.
-
- OGRE Retired Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: Ogre iphone shaders
Cg is not supported, yet. You'll have to go with GLSL ES for now.
-
- Ogre Magi
- Posts: 1235
- Joined: Fri Oct 26, 2007 12:36 am
- Location: Mountain View, CA
- x 10
Re: Ogre iphone shaders
I thought Assaf recently added support for it? Or is that not working on iPhone yet?masterfalcon wrote:Cg is not supported, yet. You'll have to go with GLSL ES for now.
-
- OGRE Retired Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: Ogre iphone shaders
It's not entirely working yet.
-
- Halfling
- Posts: 92
- Joined: Wed Jun 01, 2005 10:33 am
Re: Ogre iphone shaders
i am trying so to run the glsl version of that shader, sorry if this is very basic btu this is my first experience with shaders
so i still use :
with the 2 following files :
- orangeshader.material :
- orangeshader.glsles :
code crashes at launch
app seems to parse the shader from log :"Parsing script orangeshader.material"
but debugger tells me :
any idea why it is crashing ?
so i still use :
Code: Select all
m_poEntity = m_poSceneManager->createEntity( "Robot", "robot.mesh" );
m_poEntity->setMaterialName( "shader/orange" );
- orangeshader.material :
Code: Select all
fragment_program shader/orangeFP glsles
{
source orangeshader.glsles
}
material shader/orange
{
technique
{
pass
{
fragment_program_ref shader/orangeFP
{
}
texture_unit
{
}
}
}
}
Code: Select all
void main()
{
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}
app seems to parse the shader from log :"Parsing script orangeshader.material"
but debugger tells me :
Code: Select all
#0 0x00570f18 in Ogre::GLSLESLinkProgram::compileAndLink at iostream:77
-
- OGRE Retired Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: Ogre iphone shaders
Hmm. It definitely shouldn't crash, regardless of the compilation status. Try adding "profiles glsles" to your program definition. We'll see if that helps.
-
- Halfling
- Posts: 92
- Joined: Wed Jun 01, 2005 10:33 am
Re: Ogre iphone shaders
doesn't help to add "profiles glsles" :
Code: Select all
fragment_program shader/orangeFP glsles
{
source orangeshader.glsles
profiles glsles
}
material shader/orange
{
technique
{
pass
{
fragment_program_ref shader/orangeFP
{
}
texture_unit
{
}
}
}
}
-
- OGRE Retired Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: Ogre iphone shaders
I haven't had coffee yet, but there's also some stuff missing that GLSL ES is more picky about than it's desktop cousin. Namely, version and precision defaults.
Code: Select all
#version 100
precision mediump int;
precision mediump float;
-
- Halfling
- Posts: 92
- Joined: Wed Jun 01, 2005 10:33 am
Re: Ogre iphone shaders
i modified orangeshader.glsles that way :
but still crashes * scratching head *
Code: Select all
#version 100
precision mediump int;
precision mediump float;
void main()
{
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}
-
- OGRE Retired Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: Ogre iphone shaders
Oh, here we go. Another difference between desktop and mobile GLSL is that programs must have one vertex and one fragment shader attached, no more, no less. If you add a trivial vertex shader in there as well, that should(hopefully) take care of the crash.
-
- Halfling
- Posts: 92
- Joined: Wed Jun 01, 2005 10:33 am
Re: Ogre iphone shaders
great doesn't crash anymore, ty 
still my 3d "shadered" object doesn't appear anymore, and i don't see what the matter is, now this is mostly about shaders programming i guess
i got now 3 files :
- orangeshader.material
- orangeFragmentShader.glsles
- orangeVertexShader.glsles

still my 3d "shadered" object doesn't appear anymore, and i don't see what the matter is, now this is mostly about shaders programming i guess
i got now 3 files :
- orangeshader.material
Code: Select all
fragment_program shader/orangeFP glsles
{
source orangeFragmentShader.glsles
profiles glsles
}
vertex_program shader/orangeVP glsles
{
source orangeVertexShader.glsles
profiles glsles
}
material shader/orange
{
technique
{
pass
{
fragment_program_ref shader/orangeFP
{
}
vertex_program_ref shader/orangeVP
{
}
}
}
}
Code: Select all
#version 100
precision mediump int;
precision mediump float;
void main()
{
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}
Code: Select all
#version 100
precision mediump int;
precision mediump float;
void main()
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
-
- OGRE Retired Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: Ogre iphone shaders
Even more fun. Neither gl_ModelViewProjectionMatrix nor gl_Vertex are defined in GLSL ES. You will need to pass them in as uniforms. The sample browser media files should be a good resource for getting some shaders and materials up and running.
-
- Halfling
- Posts: 92
- Joined: Wed Jun 01, 2005 10:33 am
Re: Ogre iphone shaders
yay got a red robot now 
ty very much

ty very much
-
- Gnoblar
- Posts: 1
- Joined: Tue Aug 02, 2011 2:46 pm
Re: Ogre iphone shaders
Hi guys,
any updates on the shaders in iOS?
Is it possible now?
Do you have an idea when 1.8 will come?
any updates on the shaders in iOS?
Is it possible now?
Do you have an idea when 1.8 will come?
-
- OGRE Retired Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: Ogre iphone shaders
No idea on timeline for 1.8 but you can certainly use it. Shaders work great.