Skip to content
Snippets Groups Projects
Commit 0d2f16c0 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

fix bg color

parent a6a935f1
No related branches found
No related tags found
No related merge requests found
...@@ -34,8 +34,7 @@ static void lassoZoom(drawContext *ctx, mousePosition &click1, mousePosition &cl ...@@ -34,8 +34,7 @@ static void lassoZoom(drawContext *ctx, mousePosition &click1, mousePosition &cl
ctx->initPosition(); ctx->initPosition();
drawContext::global()->draw(); drawContext::global()->draw();
FlGui::instance()->manip->update(); FlGui::instance()->manip->update();
} }
openglWindow::openglWindow(int x, int y, int w, int h, const char *l) openglWindow::openglWindow(int x, int y, int w, int h, const char *l)
...@@ -175,7 +174,7 @@ void openglWindow::draw() ...@@ -175,7 +174,7 @@ void openglWindow::draw()
0.0F); 0.0F);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
_ctx->draw3d(); _ctx->draw3d();
glColor4ubv((GLubyte *) & CTX::instance()->color.fg); glColor4ubv((GLubyte *) & CTX::instance()->color.fg);
glPointSize((float)CTX::instance()->geom.pointSize); glPointSize((float)CTX::instance()->geom.pointSize);
...@@ -190,17 +189,15 @@ void openglWindow::draw() ...@@ -190,17 +189,15 @@ void openglWindow::draw()
} }
else{ else{
// draw the whole scene // draw the whole scene
/*
glClearColor glClearColor
((GLclampf)(CTX::instance()->unpackRed(CTX::instance()->color.bg) / 255.), ((GLclampf)(CTX::instance()->unpackRed(CTX::instance()->color.bg) / 255.),
(GLclampf)(CTX::instance()->unpackGreen(CTX::instance()->color.bg) / 255.), (GLclampf)(CTX::instance()->unpackGreen(CTX::instance()->color.bg) / 255.),
(GLclampf)(CTX::instance()->unpackBlue(CTX::instance()->color.bg) / 255.), (GLclampf)(CTX::instance()->unpackBlue(CTX::instance()->color.bg) / 255.),
0.0F); 0.0F);
*/
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
Camera * cam= &(_ctx->camera);
if(CTX::instance()->camera && !CTX::instance()->stereo ){ if(CTX::instance()->camera && !CTX::instance()->stereo){
Camera *cam = &(_ctx->camera);
if (!cam->on) cam->init(); if (!cam->on) cam->init();
cam->giveViewportDimension(_ctx->viewport[2],_ctx->viewport[3]); cam->giveViewportDimension(_ctx->viewport[2],_ctx->viewport[3]);
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
...@@ -220,11 +217,8 @@ void openglWindow::draw() ...@@ -220,11 +217,8 @@ void openglWindow::draw()
_drawBorder(); _drawBorder();
// glPushMatrix(); // glPushMatrix();
} }
else if(CTX::instance()->stereo){
Camera *cam = &(_ctx->camera);
else if(CTX::instance()->stereo ){
if (!cam->on) cam->init(); if (!cam->on) cam->init();
cam->giveViewportDimension(_ctx->viewport[2],_ctx->viewport[3]); cam->giveViewportDimension(_ctx->viewport[2],_ctx->viewport[3]);
...@@ -270,56 +264,54 @@ void openglWindow::draw() ...@@ -270,56 +264,54 @@ void openglWindow::draw()
glAccum(GL_ACCUM,1.0); glAccum(GL_ACCUM,1.0);
glAccum(GL_RETURN,1.0); glAccum(GL_RETURN,1.0);
*/ */
//right eye //right eye
XYZ eye =cam->eyesep / 2.0* cam->right; XYZ eye = cam->eyesep / 2.0* cam->right;
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();
double left = - cam->screenratio * cam->wd2 - 0.5 * cam->eyesep * cam->ndfl; double left = - cam->screenratio * cam->wd2 - 0.5 * cam->eyesep * cam->ndfl;
double right = cam->screenratio * cam->wd2 - 0.5 * cam->eyesep * cam->ndfl; double right = cam->screenratio * cam->wd2 - 0.5 * cam->eyesep * cam->ndfl;
double top = cam->wd2; double top = cam->wd2;
double bottom = - cam->wd2; double bottom = - cam->wd2;
glFrustum(left,right,bottom,top,cam->glFnear,cam->glFfar); glFrustum(left,right,bottom,top,cam->glFnear,cam->glFfar);
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glDrawBuffer(GL_BACK_RIGHT); glDrawBuffer(GL_BACK_RIGHT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity(); glLoadIdentity();
gluLookAt(cam->position.x+eye.x, cam->position.y+eye.y, cam->position.z+eye.z, gluLookAt(cam->position.x+eye.x, cam->position.y+eye.y, cam->position.z+eye.z,
cam->target.x+eye.x, cam->target.y+eye.y, cam->target.z+eye.z, cam->target.x+eye.x, cam->target.y+eye.y, cam->target.z+eye.z,
cam->up.x, cam->up.y, cam->up.z); cam->up.x, cam->up.y, cam->up.z);
_ctx->draw3d(); _ctx->draw3d();
_ctx->draw2d(); _ctx->draw2d();
_drawScreenMessage(); _drawScreenMessage();
_drawBorder(); _drawBorder();
//left eye //left eye
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();
left = - cam->screenratio * cam->wd2 + 0.5 * cam->eyesep * cam->ndfl; left = - cam->screenratio * cam->wd2 + 0.5 * cam->eyesep * cam->ndfl;
right = cam->screenratio * cam->wd2 + 0.5 * cam->eyesep * cam->ndfl; right = cam->screenratio * cam->wd2 + 0.5 * cam->eyesep * cam->ndfl;
top = cam->wd2; top = cam->wd2;
bottom = - cam->wd2; bottom = - cam->wd2;
glFrustum(left,right,bottom,top,cam->glFnear,cam->glFfar); glFrustum(left,right,bottom,top,cam->glFnear,cam->glFfar);
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glDrawBuffer(GL_BACK_LEFT); glDrawBuffer(GL_BACK_LEFT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity(); glLoadIdentity();
gluLookAt(cam->position.x-eye.x, cam->position.y-eye.y, cam->position.z-eye.z, gluLookAt(cam->position.x-eye.x, cam->position.y-eye.y, cam->position.z-eye.z,
cam->target.x-eye.x, cam->target.y-eye.y, cam->target.z-eye.z, cam->target.x-eye.x, cam->target.y-eye.y, cam->target.z-eye.z,
cam->up.x, cam->up.y, cam->up.z); cam->up.x, cam->up.y, cam->up.z);
_ctx->draw3d(); _ctx->draw3d();
_ctx->draw2d(); _ctx->draw2d();
_drawScreenMessage(); _drawScreenMessage();
_drawBorder(); _drawBorder();
} }
else{ else{
_ctx->draw3d(); _ctx->draw3d();
_ctx->draw2d(); _ctx->draw2d();
_drawScreenMessage(); _drawScreenMessage();
_drawBorder(); _drawBorder();
} }
} }
_lock = false; _lock = false;
...@@ -372,12 +364,12 @@ int openglWindow::handle(int event) ...@@ -372,12 +364,12 @@ int openglWindow::handle(int event)
else{ else{
if (CTX::instance()->camera){ if (CTX::instance()->camera){
Camera * cam= &(_ctx->camera); Camera * cam = &(_ctx->camera);
double dy=fabs( -_click.win[1] + _curr.win[1] ); double dy=fabs( -_click.win[1] + _curr.win[1] );
double dx=fabs( -_click.win[0] + _curr.win[0] ) ; double dx=fabs( -_click.win[0] + _curr.win[0] ) ;
double factx = w()/ fabs(dx); double factx = w()/ fabs(dx);
double facty = h()/ fabs(dy); double facty = h()/ fabs(dy);
double fact=.8* std::min(factx, facty); double fact = .8* std::min(factx, facty);
double x_med=( _click.win[0] + _curr.win[0])/2.; double x_med=( _click.win[0] + _curr.win[0])/2.;
double y_med=( _click.win[1] + _curr.win[1])/2.; double y_med=( _click.win[1] + _curr.win[1])/2.;
double theta_x =.96* cam->radians*( w()/2 - x_med )*2. /h() ; double theta_x =.96* cam->radians*( w()/2 - x_med )*2. /h() ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment