jeske / SimpleScene

Simple 3D scene manager in C# and OpenTK / OpenGL
https://github.com/jeske/SimpleScene/wiki
Other
173 stars 69 forks source link

Compile fine but Not able to run demos #15

Open JimSEOW opened 8 years ago

JimSEOW commented 8 years ago
        SSAssetManager.AddAssetArchive(new SSAssetArchiveHandler_FileSystem("./Assets"));
            SSAssetManager.AddAssetArchive(new SSAssetArchiveHandler_FileSystem("../../Assets"));
            SSAssetManager.AddAssetArchive(new SSAssetArchiveHandler_FileSystem("../../../Assets"));
            SSAssetManager.AddAssetArchive(new SSAssetArchiveHandler_FileSystem("../../../../Assets"));
            SSAssetManager.AddAssetArchive(new SSAssetArchiveHandler_FileSystem("../../../DemosCommon/Assets"));

            mainShader = new SSMainShaderProgram(); // before mscene
            if (!mainShader.IsValid) {
                throw new Exception ("Failed to build the main shader");
            }

open in visual studio. Compile all. Fine. GDiviaAGGTest works fine But all TestBench fails at this stage => throw new Exception

JimSEOW commented 8 years ago

'System.BadImageFormatException' occurred in mscorlib.dll

Additional information: Could not load file or assembly 'TestBenchCommon, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.

JimSEOW commented 8 years ago

GL Version = 4.2.0 - Build 10.18.10.3383 GL Shader Version = 4.20 - Build 10.18.10.3383 -- ss4_vertex.glsl --

-- ss4_fragment.glsl --

-- ss4_geometry.glsl -- ERROR: 0:14: 'dist' : geometry shader input varying variable must be declared as an array

noperspective varying vec3 dist; ERROR: 0:22: '' : inconsistent qualifiers: storage varying in vec3 VV[3]; ERROR: 0:23: '' : inconsistent qualifiers: storage varying in vec3 vertexNormal[3]; ERROR: 0:24: '' : inconsistent qualifiers: storage varying in vec3 lightPosition[3]; ERROR: 0:25: '' : inconsistent qualifiers: storage varying in vec3 eyeVec[3]; ERROR: 0:26: '' : inconsistent qualifiers: storage varying in vec3 vertexPosition_objectspace[3]; ERROR: 0:27: '' : inconsistent qualifiers: storage varying in vec4 shadowMapCoords[3][MAX_NUM_SMAP_SPLITS]; ERROR: 0:33: 'varying out' : supported in fragment shaders only varying out vec3 f_VV; ERROR: 0:34: 'varying out' : supported in fragment shaders only varying out vec3 f_vertexNormal; ERROR: 0:35: 'varying out' : supported in fragment shaders only varying out vec3 f_lightPosition; ERROR: 0:36: 'varying out' : supported in fragment shaders only varying out vec3 f_eyeVec; ERROR: 0:37: 'varying out' : supported in fragment shaders only varying out vec3 f_vertexPosition_objectspace; ERROR: 0:38: 'varying out' : supported in fragment shaders only varying out vec4 f_shadowMapCoords[MAX_NUM_SMAP_SPLITS]; ERROR: 0:43: 'varying out' : supported in fragment shaders only varying out vec3 surfaceLightVector; ERROR: 0:44: 'varying out' : supported in fragment shaders only varying out vec3 surfaceViewVector; ERROR: 0:45: 'varying out' : supported in fragment shaders only varying out vec3 surfaceNormalVector; ERROR: 0:47: 'varying out' : supported in fragment shaders only noperspective varying out vec3 f_dist; ERROR: 0:94: 'surfaceLightVector' : undeclared identifier surfaceLightVector = normalize(tangentSpaceMatrix * lightPosition[i]); ERROR: 0:94: 'assign' : cannot convert from '3-component vector of float' to 'float' surfaceLightVector = normalize(tangentSpaceMatrix * lightPosition[i]); ERROR: 0:95: 'surfaceViewVector' : undeclared identifier surfaceViewVector = normalize(tangentSpaceMatrix * eyeVec[i]); ERROR: 0:95: 'assign' : cannot convert from '3-component vector of float' to 'float' surfaceViewVector = normalize(tangentSpaceMatrix * eyeVec[i]); ERROR: 0:96: 'surfaceNormalVector' : undeclared identifier surfaceNormalVector = normalize(tangentSpaceMatrix * vertexNormal[i]); ERROR: 0:96: 'assign' : cannot convert from '3-component vector of float' to 'float' surfaceNormalVector = normalize(tangentSpaceMatrix * vertexNormal[i]); ERROR: 0:99: 'f_dist' : undeclared identifier f_dist = vertexEdgeDistance[i]; ERROR: 0:99: 'assign' : cannot convert from '3-component vector of float' to 'float' f_dist = vertexEdgeDistance[i]; ERROR: 0:102: 'f_VV' : undeclared identifier f_VV = VV[i]; ERROR: 0:102: 'assign' : cannot convert from '3-component vector of float' to 'float' f_VV = VV[i]; ERROR: 0:103: 'f_vertexNormal' : undeclared identifier f_vertexNormal = vertexNormal[i]; ERROR: 0:103: 'assign' : cannot convert from '3-component vector of float' to 'float' f_vertexNormal = vertexNormal[i]; ERROR: 0:104: 'f_lightPosition' : undeclared identifier f_lightPosition = lightPosition[i]; ERROR: 0:104: 'assign' : cannot convert from '3-component vector of float' to 'float' f_lightPosition = lightPosition[i]; ERROR: 0:105: 'f_eyeVec' : undeclared identifier f_eyeVec = eyeVec[i]; ERROR: 0:105: 'assign' : cannot convert from '3-component vector of float' to 'float' f_eyeVec = eyeVec[i]; ERROR: 0:106: 'f_vertexPosition_objectspace' : undeclared identifier f_vertexPosition_objectspace = vertexPosition_objectspace[i]; ERROR: 0:106: 'assign' : cannot convert from '3-component vector of float' to 'float' f_vertexPosition_objectspace = vertexPosition_objectspace[i]; ERROR: 0:112: '[' : built-in array must be redeclared with a size before being indexed with a variable gl_TexCoord[0] = gl_TexCoordIn[i][0];

\ Shader Compile Failed ** The fragment shader uses varying f_vertexNormal, but previous shader does not write to it. The fragment shader uses varying f_VV, but previous shader does not write to it. The fragment shader uses varying f_shadowMapCoords, but previous shader does not write to it. The fragment shader uses varying f_vertexPosition_objectspace, but previous shader does not write to it. The fragment shader uses varying f_eyeVec, but previous shader does not write to it. The fragment shader uses varying surfaceLightVector, but previous shader does not write to it. The fragment shader uses varying surfaceViewVector, but previous shader does not write to it. The fragment shader uses varying f_dist, but previous shader does not write to it.

GL Error: InvalidValue

jeske commented 8 years ago

What OS/hardware is this on?

JimSEOW commented 8 years ago

windows 8.1 on laptop which is less than 1 year old. I doubt hardware issues as I regularly compile and run many different OpenTK or SharpGL projects

It would be great to be able to just download and unzip the file, compile and run to see how the demo look without further debugging.

jeske commented 8 years ago

It's not hardware issues..it is hardware compatibility issues with our shaders.

GLSL compilers are drastically different in different drivers. We develop on nvidia, which is very "forgiving" of mistakes. Intel and AMD are less forgiving.

Bottom line.. We need to know what hardware you are running to debug our shaders.

JimSEOW commented 8 years ago

Nvidia GeForce GTX 780M I was looking for ideas on how to implement scence graph. This project is suitable for this purpose. Good JOb

I tested https://github.com/Namone/SimpleScene

I removed this line

        //checkErrors();

in SSMainShaderProgram.cs

The WavefrontOBJViewer program works!!!

SSShaderProgram.cs protected void checkErrors() { ErrorCode glerr; if ((glerr = GL.GetError ()) != ErrorCode.NoError) { throw new Exception (String.Format ("GL Error: {0}", glerr)); } }

jeske commented 8 years ago

My NVidia drivers don't throw those shader errors. Does your laptop have dual-graphics? Those errors look more like the kind of things I see out of intel drivers (which are less forgiving)

Namone/SimpleScene is just an old version before we added lots of other features.

You can try to make our latest tree work by forcing the geometry shader off... In SSMainShaderProgram.cs, SSMainShaderProgram, change this line:

if (GL.GetString(StringName.Extensions).ToLower().Contains("gl_ext_gpu_shader4")) {

to this:

if (false && GL.GetString(StringName.Extensions).ToLower().Contains("gl_ext_gpu_shader4")) {

... We should change this code so if the SS4 shader compile fails it just falls back to the SS1 shader automatically.

jeske commented 8 years ago

Can you try the latest ( https://github.com/jeske/SimpleScene ) ?

I put some code into the shader load to automatically fall back to the simpler SS1 shader if the SS4 shader load fails. I'd like to know if this fixes your startup problem.

NOTE: this isn't really the best "fix" because we also want the SS4 shader to load on your hardware, but I need to get access to a setup that causes the problem to fix this.

JimSEOW commented 8 years ago

Does your laptop have dual-graphics? YES. it switches between intel ( Intel HD Graphics 4000 + ) and Nvidia.

Perhaps this could be the common issue. Perhaps you could notify new user to take this into consideration when running this stimulating project

jeske commented 8 years ago

Dave - can you try the latest version and let us know if it works?

JimSEOW commented 8 years ago

I still think it is important that people know https://github.com/Namone/SimpleScene (a version for beginner to immediately test OpenTK scene graph).