Changeset 2950
- Timestamp:
- 09/15/08 21:04:20 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderState.cpp
r2949 r2950 97 97 mAlphaTestEnabled = false; 98 98 99 //if (mUseAlphaToCoverage)99 if (mUseAlphaToCoverage) 100 100 glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE_ARB); 101 //else101 else 102 102 glDisable(GL_ALPHA_TEST); 103 103 } … … 106 106 mAlphaTestEnabled = true; 107 107 108 /*if (mUseAlphaToCoverage)108 if (mUseAlphaToCoverage) 109 109 glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE_ARB); 110 110 else 111 111 glEnable(GL_ALPHA_TEST); 112 */113 112 } 114 113 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Transform3.cpp
r2948 r2950 24 24 if (!mMatrix) return; 25 25 26 if ( (state->GetRenderType() == RenderState::DEFERRED) || (state->GetRenderType() == RenderState::DEPTH_PASS_DEFERRED))26 if (state->GetRenderType() == RenderState::DEFERRED) 27 27 { 28 28 cgGLSetMatrixParameterfc(sModelMatrixParam, (const float *)mMatrix->x); … … 40 40 if (!mMatrix) return; 41 41 42 if ( (state->GetRenderType() == RenderState::DEFERRED) || (state->GetRenderType() == RenderState::DEPTH_PASS_DEFERRED))42 if (state->GetRenderType() == RenderState::DEFERRED) 43 43 { 44 44 static Matrix4x4 identity = IdentityMatrix(); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r2949 r2950 592 592 void InitGLstate() 593 593 { 594 glClearColor( 0.7f, 0.0f, 0.2f, 0.0f);594 glClearColor(1.0f, 1.0f, 1.0f, 1.0f); 595 595 596 596 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); … … 945 945 case RenderState::DEPTH_PASS_DEFERRED: 946 946 947 state.Reset(); 948 949 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 947 glDisable(GL_MULTISAMPLE_ARB); 948 state.SetUseAlphaToCoverage(false); 949 950 state.SetRenderType(RenderState::DEPTH_PASS); 950 951 951 952 if (!fbo) InitFBO(); fbo->Bind(); … … 957 958 958 959 glClear(GL_DEPTH_BUFFER_BIT); 959 960 glDisable(GL_MULTISAMPLE_ARB); 961 962 state.SetRenderType(RenderState::DEPTH_PASS); 963 state.SetUseAlphaToCoverage(false); 964 965 glDisable(GL_ALPHA_TEST); 966 glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE_ARB); 967 968 state.Reset(); 960 //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 961 969 962 // the scene is rendered withouth any shading 970 963 glShadeModel(GL_FLAT); 971 964 glDisable(GL_LIGHTING); 972 973 965 glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); 974 975 PrintGLerror("here095");976 966 977 967 break; … … 998 988 999 989 if (showShadowMap && !renderLightView) 1000 {1001 990 RenderShadowMap(); 1002 } 1003 991 1004 992 //glPushAttrib(GL_VIEWPORT_BIT); 1005 993 glViewport(0, 0, texWidth, texHeight); 1006 994 1007 995 InitDeferredRendering(); 1008 1009 996 // draw to 3 color buffers 1010 997 glDrawBuffers(3, mrt); … … 1075 1062 // this would conveniently solves some issues (e.g, skys without shadows) 1076 1063 1077 //RenderSky();1064 RenderSky(); 1078 1065 1079 1066 … … 1909 1896 void RenderVisibleObjects() 1910 1897 { 1911 // draw all objects that have exactly the same depth as the current sample1912 //glDisable(GL_DEPTH_TEST);1913 glDepthFunc(GL_LEQUAL);1914 1915 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);1916 PrintGLerror("here05");1917 1898 if (renderType == RenderState::DEPTH_PASS_DEFERRED) 1918 1899 { 1919 if ((renderType == RenderState::DEFERRED) || (renderType == RenderState::DEPTH_PASS_DEFERRED)) 1920 { 1921 // set modelview matrix for shaders 1922 cgGLSetStateMatrixParameter(sModelViewProjMatrixParam, 1923 CG_GL_MODELVIEW_PROJECTION_MATRIX, 1924 CG_GL_MATRIX_IDENTITY); 1925 1926 static Matrix4x4 identity = IdentityMatrix(); 1927 cgGLSetMatrixParameterfc(Transform3::sModelMatrixParam, (const float *)identity.x); 1928 } 1929 1930 PrintGLerror("here06"); 1900 if (showShadowMap && !renderLightView) 1901 RenderShadowMap(); 1931 1902 1932 1903 glDisable(GL_LIGHTING); 1933 state.SetUseAlphaToCoverage(false);1934 1935 1904 glViewport(0, 0, texWidth, texHeight); 1936 1905 InitDeferredRendering(); 1937 1906 1938 PrintGLerror("here07");1939 //glClear(GL_COLOR_BUFFER_BIT);1940 1907 // draw to 3 color buffers 1941 1908 glDrawBuffers(3, mrt); 1942 PrintGLerror("here08");1943 //glClear(GL_DEPTH_BUFFER_BIT);1944 1909 } 1945 1910 else 1911 { 1912 glShadeModel(GL_SMOOTH); 1913 glEnable(GL_LIGHTING); 1946 1914 state.SetRenderType(RenderState::FIXED); 1947 1948 PrintGLerror("here2"); 1915 } 1916 1917 // draw all objects that have exactly the same depth as the current sample 1918 glDepthFunc(GL_LEQUAL); 1919 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 1920 1921 state.SetUseAlphaToCoverage(true); 1949 1922 state.Reset(); 1950 1951 PrintGLerror("here7"); 1952 1953 glShadeModel(GL_SMOOTH); 1954 glEnable(GL_LIGHTING); 1955 1956 PrintGLerror("here8"); 1957 1958 glDisable(GL_ALPHA_TEST); 1959 glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE_ARB); 1960 1961 PrintGLerror("here9"); 1962 1963 PrintGLerror("here3"); 1964 1923 1924 1965 1925 //cout << "visible: " << (int)traverser->GetVisibleObjects().size() << endl; 1966 1926
Note: See TracChangeset
for help on using the changeset viewer.