Project

General

Profile

« Previous | Next » 

Revision d582c116

Added by Leszek Koltunski over 7 years ago

Bug fix in RenderState.

View differences:

src/main/java/org/distorted/library/DistortedRenderState.java
109 109

  
110 110
  void apply()
111 111
    {
112
    // 1. Write to color buffer?
113

  
112 114
    if( mColorMaskR!=sColorMaskR || mColorMaskG!=sColorMaskG || mColorMaskB!=sColorMaskB || mColorMaskA!=sColorMaskA)
113 115
      {
114 116
      sColorMaskR = mColorMaskR;
......
118 120
      GLES30.glColorMask(sColorMaskR==1,sColorMaskG==1,sColorMaskB==1,sColorMaskA==1);
119 121
      }
120 122

  
123
    // 2. Enable Depth test?
124

  
121 125
    if( mDepthTest!=sDepthTest )
122 126
      {
123 127
      sDepthTest = mDepthTest;
128

  
124 129
      if( sDepthTest==0 ) GLES30.glDisable(GLES30.GL_DEPTH_TEST);
125 130
      else
126 131
        {
127 132
        GLES30.glEnable (GLES30.GL_DEPTH_TEST);
128 133

  
129
        if( mDepthMask!=sDepthMask )
130
          {
131
          sDepthMask = mDepthMask;
132
          GLES30.glDepthMask(sDepthMask==1);
133
          }
134

  
135 134
        if( mDepthFunc!=sDepthFunc )
136 135
          {
137 136
          sDepthFunc = mDepthFunc;
......
140 139
        }
141 140
      }
142 141

  
142
    // 3. Write to Depth buffer?
143

  
144
    if( mDepthMask!=sDepthMask )
145
      {
146
      sDepthMask = mDepthMask;
147
      GLES30.glDepthMask(sDepthMask==1);
148
      }
149

  
150
    // 4. Enable Blending?
151

  
143 152
    if( mBlend!=sBlend )
144 153
      {
145 154
      sBlend = mBlend;
155

  
146 156
      if( sBlend==0 ) GLES30.glDisable(GLES30.GL_BLEND);
147 157
      else
148 158
        {
......
157 167
        }
158 168
      }
159 169

  
170
    // 5. Enable Stencil Test?
171

  
160 172
    if( mStencilTest!=sStencilTest )
161 173
      {
162 174
      sStencilTest = mStencilTest;
175

  
163 176
      if( sStencilTest==0 ) GLES30.glDisable(GLES30.GL_STENCIL_TEST);
164 177
      else
165 178
        {
166 179
        GLES30.glEnable(GLES30.GL_STENCIL_TEST);
167 180

  
168
        if( mStencilMask!=sStencilMask )
169
          {
170
          sStencilMask = mStencilMask;
171
          GLES30.glStencilMask(sStencilMask);
172
          }
173

  
174 181
        if( mStencilFuncFunc!=sStencilFuncFunc || mStencilFuncRef!=sStencilFuncRef || mStencilFuncMask!=sStencilFuncMask )
175 182
          {
176 183
          sStencilFuncFunc = mStencilFuncFunc;
......
188 195
          }
189 196
        }
190 197
      }
198

  
199
    // 6. Write to Stencil buffer?
200

  
201
    if( mStencilMask!=sStencilMask )
202
      {
203
      sStencilMask = mStencilMask;
204
      GLES30.glStencilMask(sStencilMask);
205
      }
191 206
    }
192 207

  
193 208
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff