First let me say that I've been around the block once or twice with numerous game and rendering enignes and Irrlicht just plain knocks the socks off anything I've used to date! =)
On to the point:
I have a very simple shader, consisting of a vert and fragment shader generated in Rendermonkey.
The application I'm currently building is OpenGL 1.5, which, as some of you may know, doesn't support GLSL, which is what Rendermonkey puts out.
Does anyone know of a way to convert these...
Code: Select all
// Vertex Shader
// --------------------------------------------------------------
uniform vec3 fvLightPosition;
uniform vec3 fvEyePosition;
varying vec2 Texcoord;
varying vec3 ViewDirection;
varying vec3 LightDirection;
varying vec3 Normal;
void main( void )
{
gl_Position = ftransform();
Texcoord = gl_MultiTexCoord0.xy;
vec4 fvObjectPosition = gl_ModelViewMatrix * gl_Vertex;
ViewDirection = fvEyePosition - fvObjectPosition.xyz;
LightDirection = fvLightPosition - fvObjectPosition.xyz;
Normal = gl_NormalMatrix * gl_Normal;
}
// Fragment Shader
// --------------------------------------------------------------
uniform vec4 fvAmbient;
uniform vec4 fvSpecular;
uniform vec4 fvDiffuse;
uniform float fSpecularPower;
uniform sampler2D baseMap;
varying vec2 Texcoord;
varying vec3 ViewDirection;
varying vec3 LightDirection;
varying vec3 Normal;
void main( void )
{
vec3 fvLightDirection = normalize( LightDirection );
vec3 fvNormal = normalize( Normal );
float fNDotL = dot( fvNormal, fvLightDirection );
vec3 fvReflection = normalize( ( ( 2.0 * fvNormal ) * fNDotL ) - fvLightDirection );
vec3 fvViewDirection = normalize( ViewDirection );
float fRDotV = max( 0.0, dot( fvReflection, fvViewDirection ) );
vec4 fvBaseColor = texture2D( baseMap, Texcoord );
vec4 fvTotalAmbient = fvAmbient * fvBaseColor;
vec4 fvTotalDiffuse = fvDiffuse * fNDotL * fvBaseColor;
vec4 fvTotalSpecular = fvSpecular * ( pow( fRDotV, fSpecularPower ) );
gl_FragColor = ( fvTotalAmbient + fvTotalDiffuse + fvTotalSpecular );
}
Thanks in advance for any pointers. =)