Why this GLSL code don't work on old Intel card (openGL 2.1)? -
as know, 3d software has xyz-axis in view section. suppose draw coordinate axis that. here method.
firstly, there function named drawoneaxis() used draw 1 axis. invoke 3 times. however, everytime before draw axis, change model matrix can 3 axes perpendicular each other. function changeuniform_mvp() do.
void draw() { (int = 0; < 3; i++) // 0 - x axis, 1 - y axis, 2 - z axis { changeuniform_mvp(i); drawoneaxis(); } }
vertex shader:
#version 110 uniform mat4 mvp; void main() { gl_position = mvp * gl_vertex; }
in function init(), shader compiled , linked , program id named programid. @ end of init(), use shader invoke gluseprogram(programid).
the result on 2 computers:
pc 1: intel card, opengl 3.1, pc 2: intel card, opengl 2.1, 1 axis drew (z axis)
why 2 different results here?
1 magic thing!!! result correct on pc2 after add 2 lines of code function draw().
void draw() { (int = 0; < 3; i++) { gluseprogram(programid); // 1 changeuniform_mvp(i); drawoneaxis(); gluseprogram(0); // 2 } }
it seems must reset program every time draw something. think unnecessary because use same shader draw things. i'm confused this.
is bug of old intel card's driver? why ok after add 2 lines of code?
hard answer. older intel opengl drivers have issues.
drawthreeaxes() perhaps?
Comments
Post a Comment