python - GLSL code not rendering on NVIDIA via Cg compiler -
i building vision research experiment in python , opengl. performing displacement mapping of texture. glsl code version 330 compatible, , renders on machine. when run code on experiment desktop, not anything, there no logged messages or errors, renders blank screen.
i ran following on both machines:
print "opengl version:\t\t%s" % glgetstring(gl_version) print "glsl version:\t\t%s" % glgetstring(gl_shading_language_version) print "vendor:\t\t\t%s" % glgetstring(gl_vendor) print "renderer:\t\t%s" % glgetstring(gl_renderer)
from machine, following output:
opengl version: 4.0.0 - build 9.17.10.2867 glsl version: 4.00 - build 9.17.10.2867 vendor: intel renderer: intel(r) hd graphics 4000
from experiment desktop, following:
opengl version: 3.3.0 glsl version: 3.30 nvidia via cg compiler vendor: nvidia corporation renderer: quadro fx 3700/pcie/sse2
here excerpt vertex , fragment shaders, there overlooking?
vertex.shd:
#version 330 compatibility layout (location = 0) in vec2 vertvertex; layout (location = 1) in vec2 verttexcoord; layout (location = 2) in vec3 vertnormal; uniform mat4 modelviewmatrix; uniform mat4 projectionmatrix; uniform sampler2d heightmap; out vec4 fragvertex; out vec2 fragtexcoord; float convert_luminance(vec4 pixel) { return (0.2126 * pixel.r) + (0.7152 + pixel.g) + (0.0722 * pixel.b); } vec4 displacement_mapping(void) { // pixel values texcoord vec4 pixel = texture2d(heightmap, verttexcoord.st); float grey_value = convert_luminance(pixel); // return displaced position coordinates return vec4(vertnormal * grey_value, 0.0) + vec4(vertvertex, 0.0, 0.0); } void main(void) { fragtexcoord = verttexcoord.st; fragvertex = displacement_mapping(); gl_position = projectionmatrix * (modelviewmatrix * fragvertex); }
fragment.shd:
#version 330 compatibility in vec2 fragtexcoord; in vec4 fragvertex; uniform sampler2d colormap; void main(void) { gl_fragcolor = texture2d(colormap, fragtexcoord.st); }
Comments
Post a Comment