Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions library/src/main/java/org/wysaid/common/TextureDrawer.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public class TextureDrawer {
" gl_FragColor = texture2D(inputImageTexture, texCoord);\n" +
"}";

public static final float[] vertices = {-1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f};
public static final int DRAW_FUNCTION = GLES20.GL_TRIANGLE_FAN;
public static final float[] vertices = {-1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f};
public static final int DRAW_FUNCTION = GLES20.GL_TRIANGLE_STRIP;

protected ProgramObject mProgram;
protected int mVertBuffer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void drawTextures() {
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, mVertBuffer);
GLES20.glEnableVertexAttribArray(0);
GLES20.glVertexAttribPointer(0, 2, GLES20.GL_FLOAT, false, 0, 0);
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_FAN, 0, 4);
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
}

public void drawTextures(int texY, int texU, int texV) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void drawTextures() {
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, mVertBuffer);
GLES20.glEnableVertexAttribArray(0);
GLES20.glVertexAttribPointer(0, 2, GLES20.GL_FLOAT, false, 0, 0);
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_FAN, 0, 4);
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
}

public void drawTextures(int texY, int texUV) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public Viewport(int _x, int _y, int _width, int _height) {
protected static final String FLIPSCALE_NAME = "flipScale";
protected static final String TRANSFORM_NAME = "transform";

public static final float[] vertices = {-1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f};
public static final int DRAW_FUNCTION = GLES20.GL_TRIANGLE_FAN;
public static final float[] vertices = {-1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f};
public static final int DRAW_FUNCTION = GLES20.GL_TRIANGLE_STRIP;

protected int TEXTURE_2D_BINDABLE;

Expand Down
2 changes: 1 addition & 1 deletion library/src/main/jni/cge/common/cgeGlobal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ bool g_shouldUsePBO = true;
int CGEGlobalConfig::viewWidth = 1024;
int CGEGlobalConfig::viewHeight = 768;
GLuint CGEGlobalConfig::sVertexBufferCommon = 0;
float CGEGlobalConfig::sVertexDataCommon[8] = { -1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f };
float CGEGlobalConfig::sVertexDataCommon[8] = { -1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f };

void cgeInitFilterStatus()
{
Expand Down
2 changes: 1 addition & 1 deletion library/src/main/jni/cge/common/cgeImageFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void CGEImageFilterInterface::render2Texture(CGEImageHandlerInterface* handler,
if (m_uniformParam != nullptr)
m_uniformParam->assignUniforms(handler, m_program.programID());

glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
cgeCheckGLError("glDrawArrays");
}

Expand Down
16 changes: 8 additions & 8 deletions library/src/main/jni/cge/common/cgeTextureUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ void TextureDrawer::drawTexture(GLuint src)
glVertexAttribPointer(0, 2, GL_FLOAT, false, 0, 0);

m_program.bind();
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}

void TextureDrawer::setRotation(float rad)
Expand Down Expand Up @@ -590,7 +590,7 @@ void TextureDrawer4ExtOES::drawTexture(GLuint src)
glVertexAttribPointer(0, 2, GL_FLOAT, false, 0, 0);

m_program.bind();
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
#endif

Expand Down Expand Up @@ -622,7 +622,7 @@ void TextureDrawerYUV::drawTextures()
glBindBuffer(GL_ARRAY_BUFFER, m_vertBuffer);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 2, GL_FLOAT, false, 0, 0);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}

CGEConstString TextureDrawerYUV::getFragmentShaderString()
Expand Down Expand Up @@ -765,7 +765,7 @@ void CGELerpBlurUtil::calcWithTexture(GLuint texture, int width, int height, GLu
m_framebuffer.bindTexture2D(m_texCache[0].texID);
glBindTexture(GL_TEXTURE_2D, texture);
glViewport(0, 0, m_texCache[0].size.width, m_texCache[0].size.height);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glFlush();

// down scale
Expand All @@ -776,7 +776,7 @@ void CGELerpBlurUtil::calcWithTexture(GLuint texture, int width, int height, GLu
glViewport(0, 0, texCache.size.width, texCache.size.height);

glBindTexture(GL_TEXTURE_2D, m_texCache[i - 1].texID);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glFlush();
}

Expand All @@ -788,7 +788,7 @@ void CGELerpBlurUtil::calcWithTexture(GLuint texture, int width, int height, GLu
glViewport(0, 0, texCache.size.width, texCache.size.height);

glBindTexture(GL_TEXTURE_2D, m_texCache[i].texID);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glFlush();
}

Expand All @@ -797,7 +797,7 @@ void CGELerpBlurUtil::calcWithTexture(GLuint texture, int width, int height, GLu
m_framebuffer.bindTexture2D(target);
glViewport(0, 0, targetWidth, targetHeight);
glBindTexture(GL_TEXTURE_2D, m_texCache[0].texID);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
}

Expand All @@ -809,7 +809,7 @@ void CGELerpBlurUtil::drawTexture(GLuint texID)
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texID);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}

void CGELerpBlurUtil::_clearMipmaps()
Expand Down
6 changes: 3 additions & 3 deletions library/src/main/jni/cge/filters/cgeAdvancedEffectsCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void CGEAdvancedEffectOneStepFilterHelper::render2Texture(CGEImageHandlerInterfa
CGESizei sz = handler->getOutputFBOSize();
m_program.sendUniformf(paramStepsName, 1.0f / sz.width, 1.0f / sz.height);
}
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
cgeCheckGLError("glDrawArrays");
}

Expand All @@ -51,7 +51,7 @@ void CGEAdvancedEffectTwoStepFilterHelper::render2Texture(CGEImageHandlerInterfa
glBindTexture(GL_TEXTURE_2D, srcTexture);

m_program.sendUniformf(paramStepsName, 0.0f, 1.0f / sz.height);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
// Pass Two
handler->swapBufferFBO();
Expand All @@ -61,7 +61,7 @@ void CGEAdvancedEffectTwoStepFilterHelper::render2Texture(CGEImageHandlerInterfa
glBindTexture(GL_TEXTURE_2D, handler->getBufferTextureID());

m_program.sendUniformf(paramStepsName, 1.0f / sz.width, 0.0f);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}

} // namespace CGE
2 changes: 1 addition & 1 deletion library/src/main/jni/cge/filters/cgeBlendFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ void CGEBlendTileFilter::render2Texture(CGEImageHandlerInterface* handler, GLuin

if (m_uniformParam != nullptr)
m_uniformParam->assignUniforms(handler, m_program.programID());
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
cgeCheckGLError("glDrawArrays");
}

Expand Down
2 changes: 1 addition & 1 deletion library/src/main/jni/cge/filters/cgeDynamicWaveFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void CGEDynamicWaveFilter::render2Texture(CGEImageHandlerInterface* handler, GLu
if (m_uniformParam != nullptr)
m_uniformParam->assignUniforms(handler, m_program.programID());

glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
cgeCheckGLError("glDrawArrays");
}

Expand Down
2 changes: 1 addition & 1 deletion library/src/main/jni/cge/filters/cgeHalftoneFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void CGEHalftoneFilter::render2Texture(CGE::CGEImageHandlerInterface* handler, G
float dotPercent = m_dotSize / sz.width;
m_program.sendUniformf(paramAspectRatio, aspectRatio);
m_program.sendUniformf(paramDotPercent, dotPercent, dotPercent / aspectRatio);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
cgeCheckGLError("glDrawArrays");
}
} // namespace CGE
8 changes: 4 additions & 4 deletions library/src/main/jni/cge/filters/cgeLerpblurFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void CGELerpblurFilter::render2Texture(CGEImageHandlerInterface* handler, GLuint
m_framebuffer.bindTexture2D(m_texCache[0].texID);
glBindTexture(GL_TEXTURE_2D, srcTexture);
glViewport(0, 0, m_texCache[0].size.width, m_texCache[0].size.height);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glFlush();

// down scale
Expand All @@ -159,7 +159,7 @@ void CGELerpblurFilter::render2Texture(CGEImageHandlerInterface* handler, GLuint
glViewport(0, 0, texCache.size.width, texCache.size.height);

glBindTexture(GL_TEXTURE_2D, m_texCache[i - 1].texID);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glFlush();
}

Expand All @@ -171,13 +171,13 @@ void CGELerpblurFilter::render2Texture(CGEImageHandlerInterface* handler, GLuint
glViewport(0, 0, texCache.size.width, texCache.size.height);

glBindTexture(GL_TEXTURE_2D, m_texCache[i].texID);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glFlush();
}

handler->setAsTarget();
glBindTexture(GL_TEXTURE_2D, m_texCache[0].texID);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}

void CGELerpblurFilter::setMipmapBase(float value)
Expand Down
2 changes: 1 addition & 1 deletion library/src/main/jni/cge/filters/cgeMinValueFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ void CGEMinValueFilter3x3::render2Texture(CGEImageHandlerInterface* handler, GLu
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, srcTexture);

glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
cgeCheckGLError("glDrawArrays");
}
} // namespace CGE
Expand Down
4 changes: 2 additions & 2 deletions library/src/main/jni/cge/filters/cgeMotionFlowFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ void CGEMotionFlowFilter::render2Texture(CGEImageHandlerInterface* handler, GLui
{
glUniform1f(m_alphaLoc, alpha += m_dAlpha);
glBindTexture(GL_TEXTURE_2D, texID);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}

glUniform1f(m_alphaLoc, alpha += m_dAlpha);
glBindTexture(GL_TEXTURE_2D, srcTexture);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

glDisable(GL_BLEND);

Expand Down
2 changes: 1 addition & 1 deletion library/src/main/jni/cge/filters/cgeMultipleEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void CGEMutipleMixFilter::render2Texture(CGEImageHandlerInterface* handler, GLui
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, srcTexture);

glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
cgeCheckGLError("glDrawArrays");
}

Expand Down
6 changes: 3 additions & 3 deletions library/src/main/jni/cge/filters/cgeMultipleEffectsCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ void CGELomoFilter::render2Texture(CGEImageHandlerInterface* handler, GLuint src
m_program.sendUniformf(paramSaturationName, sat);
}

glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
cgeCheckGLError("glDrawArrays");
}

Expand Down Expand Up @@ -516,7 +516,7 @@ void CGELomoWithCurveFilter::render2Texture(CGEImageHandlerInterface* handler, G
m_program.sendUniformf(paramSaturationName, sat);
}

glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
cgeCheckGLError("glDrawArrays");
}

Expand Down Expand Up @@ -680,7 +680,7 @@ void CGEColorScaleFilter::render2Texture(CGEImageHandlerInterface* handler, GLui
m_program.sendUniformf(paramColorScaleName, colorScale[0], colorScale[1]);
}

glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
cgeCheckGLError("glDrawArrays");
}

Expand Down
8 changes: 4 additions & 4 deletions library/src/main/jni/cge/filters/cgeSharpenBlurAdjust.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,13 @@ void CGESharpenBlurFilter::render2Texture(CGEImageHandlerInterface* handler, GLu
handler->setAsTarget();
glBindTexture(GL_TEXTURE_2D, srcTexture);
m_program.sendUniformf(paramBlurNormalName, 0.0f, 1.0f);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

// Pass Two
handler->swapBufferFBO();
glBindTexture(GL_TEXTURE_2D, handler->getBufferTextureID());
m_program.sendUniformf(paramBlurNormalName, 1.0f, 0.0f);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}

//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -286,13 +286,13 @@ void CGEBlurFastFilter::render2Texture(CGEImageHandlerInterface* handler, GLuint
handler->setAsTarget();
glBindTexture(GL_TEXTURE_2D, handler->getBufferTextureID());
m_program.sendUniformf(paramBlurNormalName, 0.0f, 1.0f);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

// Pass Two
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, dstTexture, 0);
glBindTexture(GL_TEXTURE_2D, handler->getTargetTextureID());
m_program.sendUniformf(paramBlurNormalName, 1.0f, 0.0f);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}

void CGEBlurFastFilter::setSamplerScale(int value)
Expand Down
6 changes: 3 additions & 3 deletions library/src/main/jni/cge/filters/cgeSketchFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ void CGESketchFilter::render2Texture(CGE::CGEImageHandlerInterface* handler, GLu
glBindTexture(GL_TEXTURE_2D, srcTexture);
glUniform2f(m_maxValueFilter.getStepsLocation(), 1.0f / sz.width, 1.0f / sz.height);

glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

//
// glBindTexture(GL_TEXTURE_2D, handler->getTargetTextureID());
// glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
// glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}

glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, handler->getTargetTextureID(), 0);
Expand All @@ -113,7 +113,7 @@ void CGESketchFilter::render2Texture(CGE::CGEImageHandlerInterface* handler, GLu
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, m_textureCache);

glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
cgeCheckGLError("glDrawArrays");
}

Expand Down
2 changes: 1 addition & 1 deletion library/src/main/jni/custom/cgeMultiInputFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void CGEMultiInputFilter::render2Texture(CGEImageHandlerInterface* handler, GLui
}
}

glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}

void CGEMultiInputFilter::updateInputTextures(GLuint* textures, int count)
Expand Down
2 changes: 1 addition & 1 deletion library/src/main/jni/custom/customFilter_0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,5 @@ void CustomFilter_0::render2Texture(CGEImageHandlerInterface* handler, GLuint sr
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, srcTexture);

glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
2 changes: 1 addition & 1 deletion library/src/main/jni/interface/cgeVideoPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void CGEVideoPlayerYUV420P::render()
glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer);
glEnableVertexAttribArray(m_posAttribLocation);
glVertexAttribPointer(m_posAttribLocation, 2, GL_FLOAT, GL_FALSE, 0, 0);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}

void CGEVideoPlayerYUV420P::setRotation(float rad)
Expand Down