Changeset 2927 for trunk/packages/vizservers
- Timestamp:
- Apr 1, 2012 11:16:54 PM (12 years ago)
- Location:
- trunk/packages/vizservers/nanovis
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/HeightMap.cpp
r2882 r2927 62 62 63 63 void 64 HeightMap::render(graphics::RenderContext* renderContext) 65 { 64 HeightMap::render(graphics::RenderContext *renderContext) 65 { 66 glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT | GL_LIGHTING_BIT); 67 66 68 if (renderContext->getCullMode() == graphics::RenderContext::NO_CULL) { 67 69 glDisable(GL_CULL_FACE); 68 70 } else { 69 71 glEnable(GL_CULL_FACE); 70 glCullFace((GLuint) renderContext->getCullMode()); 71 } 72 glPolygonMode(GL_FRONT_AND_BACK, (GLuint) renderContext->getPolygonMode()); 73 glShadeModel((GLuint) renderContext->getShadingModel()); 74 72 glCullFace((GLuint)renderContext->getCullMode()); 73 } 74 glPolygonMode(GL_FRONT_AND_BACK, (GLuint)renderContext->getPolygonMode()); 75 glShadeModel((GLuint)renderContext->getShadingModel()); 76 77 glMatrixMode(GL_MODELVIEW); 75 78 glPushMatrix(); 76 79 … … 83 86 84 87 if (_contour != NULL) { 85 glDepthRange 88 glDepthRange(0.001, 1.0); 86 89 } 87 90 … … 96 99 glDisableClientState(GL_INDEX_ARRAY); 97 100 glDisableClientState(GL_NORMAL_ARRAY); 98 101 99 102 if (_tfPtr) { 100 103 // PUT vertex program here 101 104 // 102 105 // 103 104 cgGLBindProgram(_shader->getFP()); 105 cgGLEnableProfile(CG_PROFILE_FP40); 106 106 _shader->bind(); 107 107 108 cgGLSetTextureParameter(_tfParam, _tfPtr->id()); 108 109 cgGLEnableTextureParameter(_tfParam); 109 110 cgGLSetParameter1f(_opacityParam, _opacity); 110 111 111 112 glEnable(GL_TEXTURE_1D); 112 113 _tfPtr->getTexture()->activate(); 113 114 114 115 glEnableClientState(GL_TEXTURE_COORD_ARRAY); 115 116 } 116 117 117 118 glBindBuffer(GL_ARRAY_BUFFER, _vertexBufferObjectID); 118 119 glVertexPointer(3, GL_FLOAT, 12, 0); 119 120 120 121 glBindBuffer(GL_ARRAY_BUFFER, _textureBufferObjectID); 121 ::glTexCoordPointer(3, GL_FLOAT, 12, 0);122 122 glTexCoordPointer(3, GL_FLOAT, 12, 0); 123 123 124 #define _TRIANGLES_ 124 125 #ifdef _TRIANGLES_ 125 126 glDrawElements(GL_TRIANGLES, _indexCount, GL_UNSIGNED_INT, 126 127 _indexBuffer); 127 #else 128 #else 128 129 glDrawElements(GL_QUADS, _indexCount, GL_UNSIGNED_INT, 129 130 _indexBuffer); … … 131 132 132 133 glBindBuffer(GL_ARRAY_BUFFER, 0); 133 134 134 135 glDisableClientState(GL_VERTEX_ARRAY); 135 136 if (_tfPtr != NULL) { 136 137 _tfPtr->getTexture()->deactivate(); 137 138 glDisableClientState(GL_TEXTURE_COORD_ARRAY); 138 139 cgGLDisableProfile(CG_PROFILE_FP40);139 140 _shader->unbind(); 140 141 } 141 142 } 142 143 glShadeModel(GL_FLAT); 143 144 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 144 145 145 146 if (_contour != NULL) { 146 147 if (_contourVisible) { … … 148 149 glDisable(GL_TEXTURE_2D); 149 150 glColor4f(_contourColor.x, _contourColor.y, _contourColor.z, 150 151 _opacity /*1.0f*/); 151 152 glDepthRange (0.0, 0.999); 152 153 _contour->render(); 153 glDepthRange (0.0, 1.0);154 154 } 155 155 … … 159 159 glDisable(GL_TEXTURE_2D); 160 160 glColor4f(_contourColor.x, _contourColor.y, _contourColor.z, 161 161 _opacity /*1.0f*/); 162 162 //glDepthRange (0.0, 0.999); 163 163 _topContour->render(); 164 //glDepthRange (0.0, 1.0); 165 } 166 #endif 167 } 164 } 165 #endif 166 glDepthRange (0.0, 1.0); 167 } 168 168 169 glPopMatrix(); 170 glPopAttrib(); 169 171 } 170 172 … … 446 448 } 447 449 448 // Maps the data coordinates of the surface into the grid's axes. 450 /** 451 * \brief Maps the data coordinates of the surface into the grid's axes. 452 */ 449 453 void 450 HeightMap:: MapToGrid(Grid *gridPtr)454 HeightMap::mapToGrid(Grid *gridPtr) 451 455 { 452 456 int count = _xNum * _yNum; … … 517 521 518 522 void 519 HeightMap::render _topview(graphics::RenderContext* renderContext,520 521 { 522 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);523 HeightMap::renderTopview(graphics::RenderContext* renderContext, 524 int render_width, int render_height) 525 { 526 glClear(GL_COLOR_BUFFER_BIT); 523 527 glPushAttrib(GL_VIEWPORT_BIT); 524 528 glViewport(0, 0, render_width, render_height); … … 574 578 575 579 if (_tfPtr != NULL) { 576 cgGLBindProgram(_shader->getFP()); 577 cgGLEnableProfile(CG_PROFILE_FP40); 580 _shader->bind(); 578 581 579 582 cgGLSetTextureParameter(_tfParam, _tfPtr->id()); 580 583 cgGLEnableTextureParameter(_tfParam); 581 584 582 585 glEnable(GL_TEXTURE_1D); 583 586 _tfPtr->getTexture()->activate(); 584 587 585 588 glEnableClientState(GL_TEXTURE_COORD_ARRAY); 586 } 587 else { 589 } else { 588 590 glDisableClientState(GL_TEXTURE_COORD_ARRAY); 589 591 } 590 592 591 593 glBindBuffer(GL_ARRAY_BUFFER, _vertexBufferObjectID); 592 594 glVertexPointer(3, GL_FLOAT, 12, 0); 593 595 594 596 glBindBuffer(GL_ARRAY_BUFFER, _textureBufferObjectID); 595 ::glTexCoordPointer(3, GL_FLOAT, 12, 0);596 597 glTexCoordPointer(3, GL_FLOAT, 12, 0); 598 597 599 #define _TRIANGLES_ 598 600 #ifdef _TRIANGLES_ 599 601 glDrawElements(GL_TRIANGLES, _indexCount, GL_UNSIGNED_INT, 600 602 _indexBuffer); 601 #else 603 #else 602 604 glDrawElements(GL_QUADS, _indexCount, GL_UNSIGNED_INT, 603 605 _indexBuffer); … … 605 607 606 608 glBindBuffer(GL_ARRAY_BUFFER, 0); 607 609 608 610 glDisableClientState(GL_VERTEX_ARRAY); 609 611 if (_tfPtr != NULL) { 610 612 _tfPtr->getTexture()->deactivate(); 611 613 glDisableClientState(GL_TEXTURE_COORD_ARRAY); 612 613 cgGLDisableProfile(CG_PROFILE_FP40);614 } 615 } 616 614 615 _shader->unbind(); 616 } 617 } 618 617 619 glShadeModel(GL_FLAT); 618 620 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 619 621 620 622 if (_contour != NULL) { 621 623 if (_contourVisible) { -
trunk/packages/vizservers/nanovis/HeightMap.h
r2877 r2927 31 31 void render(graphics::RenderContext *renderContext); 32 32 33 void render _topview(graphics::RenderContext *renderContext,34 33 void renderTopview(graphics::RenderContext *renderContext, 34 int render_width, int render_height); 35 35 36 36 /** … … 54 54 void setHeight(int xCount, int yCount, Vector3 *heights); 55 55 56 void MapToGrid(Grid *gridPtr);56 void mapToGrid(Grid *gridPtr); 57 57 58 58 /** -
trunk/packages/vizservers/nanovis/nanovis.cpp
r2923 r2927 1560 1560 HeightMap *hmPtr; 1561 1561 hmPtr = (HeightMap *)Tcl_GetHashValue(hPtr); 1562 hmPtr-> MapToGrid(grid);1562 hmPtr->mapToGrid(grid); 1563 1563 } 1564 1564 HeightMap::updatePending = false; … … 2434 2434 //cam->initialize(); 2435 2435 2436 heightmap->render _topview(renderContext, width, height);2436 heightmap->renderTopview(renderContext, width, height); 2437 2437 2438 2438 NanoVis::readScreen();
Note: See TracChangeset
for help on using the changeset viewer.