- Timestamp:
- Aug 20, 2013 5:52:39 PM (11 years ago)
- Location:
- trunk/packages/vizservers/nanovis
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/Shader.cpp
r3630 r3875 12 12 #include <util/FilePath.h> 13 13 14 #include "config.h" 14 15 #include "Shader.h" 15 16 #include "Trace.h" … … 18 19 using namespace nv::util; 19 20 21 /** 22 * These correspond to NV_vertex_program3 and NV_fragment_program2: 23 * CG_PROFILE_VP40 24 * CG_PROFILE_FP40 25 * 26 * These correspond to ARB_vertex_program and ARB_fragment_program: 27 * CG_PROFILE_ARBVP1 28 * CG_PROFILE_ARBFP1 29 * 30 * Generic GLSL targets: 31 * CG_PROFILE_GLSLV 32 * CG_PROFILE_GLSLF 33 */ 34 #ifdef USE_ARB_PROGRAMS 35 CGprofile Shader::_defaultVertexProfile = CG_PROFILE_ARBVP1; 36 CGprofile Shader::_defaultFragmentProfile = CG_PROFILE_ARBFP1; 37 #else 20 38 CGprofile Shader::_defaultVertexProfile = CG_PROFILE_VP40; 21 39 CGprofile Shader::_defaultFragmentProfile = CG_PROFILE_FP40; 40 #endif 22 41 CGcontext Shader::_cgContext = NULL; 23 42 -
trunk/packages/vizservers/nanovis/Shader.h
r3630 r3875 49 49 void loadFragmentProgram(const char *fileName); 50 50 51 bool isVertexProgramLoaded() 52 { 53 return (getVP() == NULL); 54 } 55 56 bool isFragmentProgramLoaded() 57 { 58 return (getFP() == NULL); 59 } 60 51 61 void setVPParameter1f(const char *name, float val) 52 62 { … … 284 294 void resetPrograms(); 285 295 286 287 296 CGprogram getVP() 288 297 { -
trunk/packages/vizservers/nanovis/VelocityArrowsSlice.cpp
r3630 r3875 65 65 _queryVelocityFP.loadFragmentProgram("queryvelocity.cg"); 66 66 67 _particleShader.loadVertexProgram("velocityslicevp.cg"); 68 _particleShader.loadFragmentProgram("velocityslicefp.cg"); 67 // Delay loading of shaders only required for glyph style rendering 68 if (_renderMode == GLYPHS) { 69 _particleShader.loadVertexProgram("velocityslicevp.cg"); 70 _particleShader.loadFragmentProgram("velocityslicefp.cg"); 71 } 69 72 70 73 createRenderTarget(); … … 362 365 continue; 363 366 } 364 if (length > 1.0e-6) {367 if (length > 0.0) { 365 368 Vector3f vnorm = vel.normalize(); 366 369 Vector3f rotationAxis = refVec.cross(vnorm); … … 414 417 glTexEnvf(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE); 415 418 419 // FIXME: This vertex shader won't compile with ARB_vertex_program, 420 // so it should use GLSL 421 if (!_particleShader.isVertexProgramLoaded()) { 422 _particleShader.loadVertexProgram("velocityslicevp.cg"); 423 } 424 if (!_particleShader.isFragmentProgramLoaded()) { 425 _particleShader.loadFragmentProgram("velocityslicefp.cg"); 426 } 427 416 428 _particleShader.bind(); 417 429 _particleShader.setVPTextureParameter("vfield", _vectorFieldGraphicsID); … … 458 470 Vector3f bmin, bmax; 459 471 volume->getBounds(bmin, bmax); 460 _origin = bmin;472 _origin.set(bmin.x, bmin.y, bmin.z); 461 473 _scale.set(bmax.x-bmin.x, bmax.y-bmin.y, bmax.z-bmin.z); 462 474 -
trunk/packages/vizservers/nanovis/config.h
r3599 r3875 38 38 39 39 /* 40 * If defined, use ARB_vertex_program and ARB_fragment_program as Cg 41 * profile target, otherwise NV_vertex_program3 and NV_fragment_program2 42 * are required 43 */ 44 //#define USE_ARB_PROGRAMS 45 46 /* 40 47 * Keep statistics 41 48 */ -
trunk/packages/vizservers/nanovis/nanovis.cpp
r3630 r3875 504 504 } 505 505 #endif 506 // FIXME: should use ARB programs or (preferably) a GLSL profile for portability 506 // FIXME: should use GLSL for portability 507 #ifdef USE_ARB_PROGRAMS 508 if (!GLEW_ARB_vertex_program || 509 !GLEW_ARB_fragment_program) { 510 ERROR("ARB_vertex_program and ARB_fragment_program extensions are required"); 511 return false; 512 } 513 #else 507 514 if (!GLEW_NV_vertex_program3 || 508 515 !GLEW_NV_fragment_program2) { … … 510 517 return false; 511 518 } 519 #endif 512 520 513 521 if (!FilePath::getInstance()->setPath(path)) {
Note: See TracChangeset
for help on using the changeset viewer.