Commit 97f1e67e by Luis Penaranda

now the controls for the ZB transformation work

1 parent a8d3155a
......@@ -28,6 +28,15 @@
//#define CONST_PI_F (0x1.921fb6p+1f)
//#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) :
QGLWidget(parent)
{
......@@ -99,12 +108,14 @@ void OpenGLCanvas::change_fov_max(int new_fov_max){
void OpenGLCanvas::change_zb_lambda(int new_zb_lambda){
zblambda=(float)new_zb_lambda/1000;
fprintf(stderr,"zb_lambda=%f\n",zblambda);
glVertexAttrib1f(ZBL_ATTR,zblambda);
updateGL();
}
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);
glVertexAttrib1f(ZBR_ATTR,zbR);
updateGL();
}
......@@ -728,13 +739,7 @@ void OpenGLCanvas::setShaders() {
GLuint p = glCreateProgram();
// Bind attributes zblambda and zbR 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
// Bind attributes zblambda and zbR to the vertex shader.
glVertexAttrib1f(ZBL_ATTR,zblambda);
glBindAttribLocation(p,ZBL_ATTR,"zblambda");
glVertexAttrib1f(ZBR_ATTR,zbR);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!