- Timestamp:
- 08/29/08 00:00:59 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.cpp
r2879 r2881 94 94 magfilterParam = GL_LINEAR; break; 95 95 case FILTER_MIPMAP_LINEAR: 96 //minfilterParam = GL_LINEAR_MIPMAP_LINEAR; 97 minfilterParam = GL_NEAREST_MIPMAP_NEAREST; 98 //minfilterParam = GL_NEAREST_MIPMAP_LINEAR; 99 magfilterParam = GL_NEAREST; break; 96 //minfilterParam = GL_NEAREST_MIPMAP_NEAREST; 97 //magfilterParam = GL_NEAREST; 98 99 minfilterParam = GL_NEAREST_MIPMAP_LINEAR; 100 magfilterParam = GL_LINEAR; 101 break; 100 102 default: 101 103 minfilterParam = GL_NEAREST; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.cpp
r2880 r2881 112 112 static void CreateNoiseTex2D(int w, int h) 113 113 { 114 // hack: should be able to recalc noise texture115 //if (noiseTex > 0) return;116 117 114 //GLubyte *randomNormals = new GLubyte[mWidth * mHeight * 3]; 118 115 float *randomNormals = new float[w * h * 3]; … … 167 164 //-- the flip-flop fbos 168 165 169 w = 256; h = 256;166 //w = 512; h = 512; 170 167 mNewFbo = new FrameBufferObject(w, h, FrameBufferObject::DEPTH_NONE); 171 168 … … 173 170 mNewFbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, false); 174 171 172 173 /////////////////////// 174 175 175 mOldFbo = new FrameBufferObject(w, h, FrameBufferObject::DEPTH_NONE); 176 176 … … 457 457 glDrawBuffers(1, mymrt); 458 458 459 glPushAttrib(GL_VIEWPORT_BIT);460 glViewport(0, 0, 256, 256);461 462 glMatrixMode(GL_PROJECTION);463 glPushMatrix();464 glLoadIdentity();465 466 glMatrixMode(GL_MODELVIEW);467 glPushMatrix();468 glLoadIdentity();469 470 const float offs = 0.5f;471 glOrtho(-offs, offs, -offs, offs, 0, 1);472 473 459 474 460 GLuint oldTex = mOldFbo->GetColorBuffer(0)->GetTexture(); … … 537 523 cgGLDisableTextureParameter(sOldTexParam); 538 524 539 glMatrixMode(GL_PROJECTION);540 glPopMatrix();541 542 glMatrixMode(GL_MODELVIEW);543 glPopMatrix();544 545 glPopAttrib();546 525 547 526 FrameBufferObject::Release(); … … 805 784 glDrawBuffers(1, mymrt); 806 785 786 cgGLEnableProfile(RenderState::sCgFragmentProfile); 787 788 cgGLBindProgram(sCgCombinedIllumProgram); 789 807 790 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 808 791 809 cgGLEnableProfile(RenderState::sCgFragmentProfile);810 811 cgGLBindProgram(sCgCombinedIllumProgram);812 792 813 793 cgGLSetTextureParameter(sColorsTexCombinedIllumParam, colorsTex); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r2879 r2881 322 322 //cout << "model path: " << model_path << endl; 323 323 324 cout << "**** end parameters ****" << endl ;324 cout << "**** end parameters ****" << endl << endl; 325 325 } 326 326 … … 537 537 // this fbo basicly stores the scene information we get from standard rendering of a frame 538 538 // we store colors, normals, positions (for the ssao) 539 fbo = new FrameBufferObject(texWidth, texHeight, FrameBufferObject::DEPTH_ 32);539 fbo = new FrameBufferObject(texWidth, texHeight, FrameBufferObject::DEPTH_24); 540 540 541 541 // the diffuse color buffer … … 879 879 cgGLDisableProfile(RenderState::sCgVertexProfile); 880 880 881 glDrawBuffers(1, mrt);882 883 881 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 884 882 … … 901 899 glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); 902 900 903 glDrawBuffers(1, mrt);904 905 901 break; 906 902 … … 980 976 if (renderType == RenderState::DEFERRED) 981 977 { 982 fbo->Release();978 FrameBufferObject::Release(); 983 979 984 980 cgGLDisableProfile(RenderState::sCgVertexProfile); 985 981 cgGLDisableProfile(RenderState::sCgFragmentProfile); 986 987 glDrawBuffers(1, mrt);988 982 989 983 if (useSsao) … … 991 985 if (!ssaoShader) ssaoShader = new SsaoShader(texWidth, texHeight, camera, myfar / 10.0f); 992 986 //DEL_PTR(deferredShader); 993 994 987 ssaoShader->Render(fbo, oldViewProjMatrix, ssaoExpFactor); 995 988 … … 999 992 if (!deferredShader) deferredShader = new DeferredShader(texWidth, texHeight); 1000 993 //DEL_PTR(ssaoShader); 1001 1002 994 deferredShader->Render(fbo); 1003 995 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/globillum.cg
r2880 r2881 29 29 30 30 31 struct pixel 31 struct pixel2 32 32 { 33 33 float4 ssao_col: COLOR0; 34 34 float4 illum_col: COLOR1; 35 }; 36 37 38 struct pixel 39 { 40 float4 illum_col: COLOR0; 35 41 }; 36 42 … … 85 91 float2 texcoord = IN.texCoord.xy + offsetTransformed * AREA_SIZE * w; 86 92 93 // use lower lod level to improve cache coherence 87 94 float3 sample_position = tex2Dlod(positions, float4(texcoord, 0, 1)).xyz; 88 95 float3 sample_color = tex2Dlod(colors, float4(texcoord, 0, 2)).xyz; … … 114 121 /** The mrt shader for screen space ambient occlusion + indirect illumination 115 122 */ 116 pixel main(fragment IN,123 pixel2 main(fragment IN, 117 124 uniform sampler2D colors, 118 125 uniform sampler2D positions, … … 128 135 ) 129 136 { 130 pixel OUT;137 pixel2 OUT; 131 138 132 139 float4 norm = tex2D(normals, IN.texCoord.xy);
Note: See TracChangeset
for help on using the changeset viewer.