AimplainLeo / osgocean

Automatically exported from code.google.com/p/osgocean
GNU Lesser General Public License v3.0
0 stars 0 forks source link

black ocean? #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
i get a black ocean?
 I checkout the new tunk code,but it is not good,the sky is nice but the ocean is black,the log imformation is:

VERTEX glCompileShader "ocean_surface_vertex_shader" FAILED
VERTEX Shader "ocean_surface_vertex_shader" infolog:
Vertex shader failed to compile with the following errors:
ERROR: 0:50: error(#168) Reserved built-in name gl_ModelViewProjectionMatrix
ERROR: error(#273) 1 compilation errors.  No code generated

FRAGMENT glCompileShader "ocean_surface_fragment_shader" FAILED
FRAGMENT Shader "ocean_surface_fragment_shader" infolog:
Fragment shader failed to compile with the following errors:
WARNING: 0:60: warning(#283) Implicit cast from int to float
ERROR: 0:214: error(#202) No matching overloaded function found pow
ERROR: 0:214: error(#160) Cannot convert from 'const float' to '2-component vect
or of float'
ERROR: error(#273) 2 compilation errors.  No code generated

glLinkProgram "ocean_surface" FAILED
Program "ocean_surface" infolog:
Vertex and Fragment shader(s) were not successfully compiled before glLinkProgra
m() was called.  Link failed.

Warning: detected OpenGL error '无效操作' after RenderBin::draw(,)
RenderStage::drawInner(,) FBO status= 0x8cd5

is  the "ocean_surface_fragment_shader"  bug?

Original issue reported on code.google.com by fl...@yahoo.cn on 16 Nov 2010 at 8:36

GoogleCodeExporter commented 9 years ago
i find is the graphics card problem!
at first ,i test on ati card ,it is bad,
i test on NVDIA ,NOW IS OK!

Original comment by fl...@yahoo.cn on 16 Nov 2010 at 9:16

GoogleCodeExporter commented 9 years ago
Thanks for flagging the issue. 

I will have a look at the issues this afternoon. It might be possible to ease 
circumvent some of these problems with ATI cards.

The declaration of gl_ModelViewProjectionMatrix as a uniform in the vertex 
shader certainly does seem like it shouldn't be there.

Regards,

Kim.

Original comment by kcb...@googlemail.com on 16 Nov 2010 at 10:32

GoogleCodeExporter commented 9 years ago
I have the same issues on MacOSX on both ATI and NVIDIA cards. It would be 
great if those issues could be fixed.
Going through the list of issues we have:

In "osgOcean_ocean_surface.vert"
- It looks like the line "uniform mat4 gl_ModelViewProjectionMatrix;" should be 
removed

In "osgOcean_ocean_surface.frag"
- The implicit cast error can easily be fixed by replacing line (in :
         const vec4 oneOverColorExtinction = vec4(1.0/22.5, 1.0/375.0, 1.0/1500, 1.0/5.0);
    with
         const vec4 oneOverColorExtinction = vec4(1.0/22.5, 1.0/375.0, 1.0/1500.0, 1.0/5.0);

- In the following line, it complains about the dimension (float to vec 
conversion).
         vec2 fade_xy = pow(abs(gl_FragCoord.xy / (osgOcean_ViewportDimensions.xy * 0.5) - 1.0), 10.0);
   I'm not sure if this is a bug in the shader or OpenGL implementation. 

Below are the exact error messages on MacOSX (same messages on both Nvidia and 
ATI cards):

VERTEX glCompileShader "ocean_surface_vertex_shader" FAILED
VERTEX Shader "ocean_surface_vertex_shader" infolog:
ERROR: 0:50: 'gl_' : reserved built-in name 

FRAGMENT glCompileShader "ocean_surface_fragment_shader" FAILED
FRAGMENT Shader "ocean_surface_fragment_shader" infolog:
ERROR: 0:60: '/' :  wrong operand types no operation '/' exists that takes a 
left-hand operand of type 'const float' and a right operand of type 'const int' 
(or there is no acceptable conversion)
ERROR: 0:214: 'pow' : no matching overloaded function found 
ERROR: 0:214: '=' :  cannot convert from 'const float' to '2-component vector 
of float'

glLinkProgram "ocean_surface" FAILED
Program "ocean_surface" infolog:
ERROR: One or more attached shaders not successfully compiled

Original comment by jcmon...@gmail.com on 25 Dec 2010 at 10:40

GoogleCodeExporter commented 9 years ago
Hi,

I've made the changes you've suggested here. Thanks for pointing them out.

I've split the fade_xy calculation into two variables fadeX,fadeY so it 
shouldn't cause any more errors. None the less I think that's a OGL 
implementation issue with your card and not a bug in the shader as it doesn't 
cause issues at my end.

If you could test the fade_xy issue on your card and report back I would be 
grateful.

Cheers.

Kim.

Original comment by kcb...@googlemail.com on 2 Jan 2011 at 8:06

GoogleCodeExporter commented 9 years ago
Hi Kim,

Thanks for applying the changes. I did a fresh checkout to test.
Ocean surface fragment shader compiles fine on my machine now (cast and fade 
issue fixed).
I haven't seen any changes on the vertex shader for the 
"gl_ModelViewProjectionMatrix" issue. Did you forget to commit the files?

Cheers,
Jean-Claude

Original comment by jcmon...@gmail.com on 3 Jan 2011 at 2:50

GoogleCodeExporter commented 9 years ago
Hi Jean-Claude,

Well spotted. Have committed that now.

Thanks.

Kim.

Original comment by kcb...@googlemail.com on 3 Jan 2011 at 4:29