OpenSubdiv icon indicating copy to clipboard operation
OpenSubdiv copied to clipboard

GLSL 330 shader not working too well

Open nyue opened this issue 9 years ago • 7 comments

I am building the glPtexViewer sample from the 3_0_4 tag, when running the example on a machine with OpenGL 3.3, I get the following errors

NVIDIA Corporation Quadro FX 3800/PCIe/SSE2 3.3.0 NVIDIA 331.38 Init OpenGL 3.3 GLERROR Loading ptex : /var/tmp/mudbox_nyue/data/monkey_diffuse.ptx PageSize = 588 x 520 x 17 Reading /var/tmp/mudbox_nyue/data/base_monkey_uv.obj Error: 4 Error compiling GLSL shader: 0(2410) : error C1008: undefined variable "vPatchCoord" 0(2411) : error C1008: undefined variable "vPatchCoord" 0(2412) : error C1008: undefined variable "vPatchCoord"

Error: 4 Error compiling GLSL shader: 0(918) : error C1101: ambiguous overloaded function reference "pow(int, int)" (0) : ps lowp float pow(lowp float, lowp float) (0) : ps mediump float pow(mediump float, mediump float) (0) : float pow(float, float)

Error: 4

Error linking GLSL program: Vertex info

0(2729) : error C3002: call to undefined function "mat4 OsdModelViewProjectionMatrix();"

nyue avatar Feb 22 '16 18:02 nyue

According to official specs, the FX 3800 only supports GL 3.1.

manuelk avatar Feb 22 '16 23:02 manuelk

Hi guys,

I recently built the last stable version (3.0.5) and I'm having lots of errors from the shaders with an OpenGl 3.3 Graphic card. I attach the image. The only working example seems to be the FarViewer.

error

mpcarlos87 avatar Apr 26 '16 20:04 mpcarlos87

Similar experience for me on CentOS and Windows with non 4.x OpenGL. Does anyone have the command line options for cmake to get OpenSubdiv to build with OpenGL 3.3 ? I get the feeling that most of the main developers of OpenSubdiv have machines with OpenGL 4.x

Cheers

nyue avatar Jul 18 '16 21:07 nyue

I don't think there is a CMake flag to force GL 3.3 support - I remember some logic both in the build and run-time to figure out what GL features were supported : is that logic failing or are you running into some out-dated driver issues ?

manuelk avatar Aug 10 '16 17:08 manuelk

I believe the problem may be the use of GL_VERSION_4_0 e.g. in ./glFVarViewer/glFVarViewer.cpp line 46, 196, 490 and 699. Since we are using GLEW, we should probably be using e.g.

if (GLEW_VERSION_3_3) { /* Yay! OpenGL 3.3 is supported! */ }

or

if (glewIsSupported("GL_VERSION_3_3")) { /* Great, we have OpenGL 3.3 */ }

see http://glew.sourceforge.net/basic.html

My guess is if you are already on OpenGL 4 hardware, many such problem will go unnoticed only to be discovered by those with lesser hardware.

Cheers

nyue avatar Aug 10 '16 17:08 nyue

Indeed - i tend to only notice these problems when switching to older laptops, so i this probably is not getting the attention that it should. Some of the examples may also need to be updated to match best GL practices : the glViewer tends to get the most attention as it is a debugging tool. The other examples are a little behind.

manuelk avatar Aug 18 '16 16:08 manuelk

Filed as internal issue #151670.

jtran56 avatar Sep 30 '17 01:09 jtran56