From: Dave C. <dm...@ce...> - 2003-07-28 02:08:28
|
Hi Micha, Thanks for the reply. Got the latest version from CVS this morning but still had shading issues. I've now modified my source to address the issue, basically just forced a color lookup for each point of the vertex in the cell (previously only one color lookup per polygon). I've pasted the changed function for you, changes are marked with a "// CHANGED". I assume the non-grid dataview will also need to be changed... Thanks - and keep up the good work. My plots look fantastic! Cheers, Dave. void SurfacePlot::updateGridData() { int i, j; RGBA col1, col2, col3, col4; // CHANGED int cstep = resolution(); int rstep = resolution(); if (plotStyle() == FILLEDMESH || plotStyle() == WIREFRAME || plotStyle() == HIDDENLINE) { glColor4d(meshColor().r, meshColor().g, meshColor().b, meshColor().a); for (i = 0; i < actualGridData_->columns() - cstep; i += cstep) { for (j = 0; j < actualGridData_->rows() - rstep; j += rstep) { glBegin(GL_LINE_LOOP); glVertex3dv(actualGridData_->vertices[i][j]); glVertex3dv(actualGridData_->vertices[i+cstep][j]); glVertex3dv(actualGridData_->vertices[i+cstep][j+rstep]); glVertex3dv(actualGridData_->vertices[i][j+rstep]); glEnd(); } } } if (plotStyle() != WIREFRAME) { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glPolygonMode(GL_FRONT_AND_BACK, GL_QUADS); glEnable(GL_POLYGON_OFFSET_FILL); glPolygonOffset(polygonOffset(),1.0); bool hl = (plotStyle() == HIDDENLINE); col1 = col2 = col3 = col4 = backgroundRGBAColor(); // CHANGED glBegin(GL_QUADS); for (i = 0; i < actualGridData_->columns() - cstep; i += cstep) { for (j = 0; j < actualGridData_->rows() - rstep; j += rstep) { if(!hl) { // CHANGED (start) col1 = (*dataColor)( actualGridData_->vertices[i][j][0], actualGridData_->vertices[i][j][1], actualGridData_->vertices[i][j][2]); col2 = (*dataColor)( actualGridData_->vertices[i+cstep][j][0], actualGridData_->vertices[i+cstep][j][1], actualGridData_->vertices[i+cstep][j][2]); col3 = (*dataColor)( actualGridData_->vertices[i+cstep][j+rstep][0], actualGridData_->vertices[i+cstep][j+rstep][1], actualGridData_->vertices[i+cstep][j+rstep][2]); col4 = (*dataColor)( actualGridData_->vertices[i][j+rstep][0], actualGridData_->vertices[i][j+rstep][1], actualGridData_->vertices[i][j+rstep][2]); // CHANGED (stop) } glColor4d(col1.r, col1.g, col1.b, col1.a); // CHANGED glNormal3dv(actualGridData_->normals[i][j]); glVertex3dv(actualGridData_->vertices[i][j]); glColor4d(col2.r, col2.g, col2.b, col2.a); // CHANGED glNormal3dv(actualGridData_->normals[i+cstep][j]); glVertex3dv(actualGridData_->vertices[i+cstep][j]); glColor4d(col3.r, col3.g, col3.b, col3.a); // CHANGED glNormal3dv(actualGridData_->normals[i+cstep][j+rstep]); glVertex3dv(actualGridData_->vertices[i+cstep][j+rstep]); glColor4d(col4.r, col4.g, col4.b, col4.a); // CHANGED glNormal3dv(actualGridData_->normals[i][j+rstep]); glVertex3dv(actualGridData_->vertices[i][j+rstep]); } } glEnd(); glDisable(GL_POLYGON_OFFSET_FILL); } } -----Original Message----- From: Micha Bieber [mailto:kri...@us...] Sent: Monday, 28 July 2003 6:33 AM To: Dave Cooper Cc: qwt...@li... Subject: Re: [qwtplot3d-interest] setResolution and Colours Friday, July 25, 2003, 06:58:04, Dave Cooper wrote: DC> 1. setResolution is excellent for reducing the data. It would be nice if it DC> took a double and allowed for increasing the data set (ie. through spline DC> interpolation). Interpolation doesn't increase the dataset per se. It smoothes (mostly) but the user has to provide sampling points. But you are right - a conceivable extension to the status quo lies in using of splines on top of the existing datas. In fact, one reason for me in writing the library originates from the wish to learn more about OpenGL. The NURBS and evaluator implementation are still unknown subjects to me. So, I think to delve into the problem :-) DC> 2. Colour - I find that a polygon is always entirely filled with the data DC> colour of its lowest point. I'd really like to see the colour of the polygon DC> shaded over its surface. This is a real problem with small spikes in my DC> plots. Fixed (CVS). You should see real Gouraud shading now. Micha -- |