General question regarding OpenGL vs DirectX in Ogre

ofcaveman

10-03-2012 15:23:09

Ok, I am new to Ogre, so please go easy on me. I have been using Hydrax for a week or so now in my spare time, but I think my questions are not Hydrax questions, but rather general Ogre questions. So, I downloaded Hydrax and Ogre source, got the demo to work, which only works in DirectX. I have an ATI graphics adapter, and after reading a few posts, and chatted with a few friends, so thought maybe the issue was because I didn't have an Nvidia card. The error I get was:
09:26:06: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at D:\Public\downloads\ogre_src_v1-7-4\OgreMain\src\OgreGpuProgramParams.cpp (line 1425)

So, some searching revealed it may have something to do with shaders. I am a little confused as to why it wouldn't print the name of the parameter which was missing, though. I spent some time trying to fix it based upon forum searches, but was unable to understand the cause. I haven't made my way through the tutorials yet, although I started, so I guess I will try to dig in a little deeper after I read through the documentation better.

Next, I thought, perhaps pulling the latest version of Hydrax would be a way to go. So I pulled the Linux version, which was slightly newer from another source, updated the visual studio projects and code merging, and viola - it works in OpenGL, but not DirectX. Oh, and the OpenGL version looks pretty bad.

So, I am guessing the new version fixed the OpenGL shader issue, but forgot to add something in the DirectX version, since I get this in my Ogre.log:
[Hydrax] Creating materials...
[Hydrax] Creating water material...0 (0 is the value of the parameter being passed)
OGRE EXCEPTION(2:InvalidParametersException): Parameter called uWaterColor does not exist. in GpuProgramParameters::_findNamedConstantDefinition at D:\Public\downloads\ogre_src_v1-7-4\OgreMain\src\OgreGpuProgramParams.cpp (line 1435)
Compared to this when I run in OpenGL:
[Hydrax] Creating materials...
[Hydrax] Creating water material...0 (0 is the value of the parameter being passed)
GLSL compiled : _Hydrax_Water_VPVertex shader was successfully compiled to run on hardware.

GLSL compiled : _Hydrax_Water_FPFragment shader was successfully compiled to run on hardware.

Texture: Fresnel.bmp: Loading 1 faces(PF_L8,256x1x1) with 5 hardware generated mipmaps from Image. Internal format is PF_L8,256x1x1.
[Hydrax] Water material created.

I also get:
Error linking GLSL Program Object : Vertex shader(s) failed to link, fragment shader(s) failed to link.
ERROR: error(#275) Symbol 'Distance_' is defined with 2 different types between two stages
ERROR: error(#275) Symbol 'Distance_' is defined with 2 different types between two stages
OGRE EXCEPTION(7:InternalErrorException): Error linking GLSL Program Object : Error linking GLSL Program Object : Vertex shader(s) failed to link, fragment shader(s) failed to link.
I googled this - these messages seem to be coming directly from OpenGL somehow, and I am guessing somewhere (MaterialManager?) the calls which are setting VP_xx and FP_xx might have some duplicate entries. I guess printing this stuff to the log would be very useful.

So, I am not sure what all of my issues might be. I figured I needed to somehow add "uWaterColor" to one of the SM_HLSL or SM_CG legs of MaterialManager.cpp, but I couldn't figure if it needed to be added to VertexProgramData, or FragmentProgramData or what.

So, I have since reverted to v0.5.1, and will tinker with that. Looking back at my post I am not sure what my exact question is, but any help or tips as to what is going on would be useful. I guess I am not really sure what the Vertex Program Data and Fragment Program Data are used for. I am guessing they are used to pass data into the graphics hardware, but where and how? How does the driver fit into all of this? If I don't have an Nvidia card, how is OpenGL working? I don't recall installing any OpenGL stuff, nor does my configuration point anything to opengl .dll files like my configuration does for DirectX 11 .dll.