Commit 97f1e67e authored by Luis Penaranda's avatar Luis Penaranda

now the controls for the ZB transformation work

parent a8d3155a
This diff is collapsed.
...@@ -28,6 +28,15 @@ ...@@ -28,6 +28,15 @@
//#define CONST_PI_F (0x1.921fb6p+1f) //#define CONST_PI_F (0x1.921fb6p+1f)
//#define CONST_PI_2_F (0x1.921fb6p+0f) //#define CONST_PI_2_F (0x1.921fb6p+0f)
// These definitions specify which attributes should be used to store some
// parameters passed to the vertex shader. Nvidia hardware
// only leaves attributes 1 and 7 unreserved; attributes 8 to 15 are
// reserved for textures.
// TODO: we use attributes 14 and 15, which work for Nvidia; we need to
// test with other hardware.
#define ZBL_ATTR 14
#define ZBR_ATTR 15
OpenGLCanvas::OpenGLCanvas(QWidget *parent) : OpenGLCanvas::OpenGLCanvas(QWidget *parent) :
QGLWidget(parent) QGLWidget(parent)
{ {
...@@ -99,12 +108,14 @@ void OpenGLCanvas::change_fov_max(int new_fov_max){ ...@@ -99,12 +108,14 @@ void OpenGLCanvas::change_fov_max(int new_fov_max){
void OpenGLCanvas::change_zb_lambda(int new_zb_lambda){ void OpenGLCanvas::change_zb_lambda(int new_zb_lambda){
zblambda=(float)new_zb_lambda/1000; zblambda=(float)new_zb_lambda/1000;
fprintf(stderr,"zb_lambda=%f\n",zblambda); fprintf(stderr,"zb_lambda=%f\n",zblambda);
glVertexAttrib1f(ZBL_ATTR,zblambda);
updateGL(); updateGL();
} }
void OpenGLCanvas::change_zb_R(int new_zb_R){ void OpenGLCanvas::change_zb_R(int new_zb_R){
zbR=(float)new_zb_R/1000; zbR=(float)new_zb_R/100;
fprintf(stderr,"zb_R=%f\n",zbR); fprintf(stderr,"zb_R=%f\n",zbR);
glVertexAttrib1f(ZBR_ATTR,zbR);
updateGL(); updateGL();
} }
...@@ -728,13 +739,7 @@ void OpenGLCanvas::setShaders() { ...@@ -728,13 +739,7 @@ void OpenGLCanvas::setShaders() {
GLuint p = glCreateProgram(); GLuint p = glCreateProgram();
// Bind attributes zblambda and zbR to the vertex shader. Nvidia hardware // Bind attributes zblambda and zbR to the vertex shader.
// only leaves attributes 1 and 7 unreserved; attributes 8 to 15 are
// reserved for textures.
// TODO: we use attributes 14 and 15, which work for Nvidia; we need to
// test with other hardware.
#define ZBL_ATTR 14
#define ZBR_ATTR 15
glVertexAttrib1f(ZBL_ATTR,zblambda); glVertexAttrib1f(ZBL_ATTR,zblambda);
glBindAttribLocation(p,ZBL_ATTR,"zblambda"); glBindAttribLocation(p,ZBL_ATTR,"zblambda");
glVertexAttrib1f(ZBR_ATTR,zbR); glVertexAttrib1f(ZBR_ATTR,zbR);
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment