Commit 7ab1f6d1 authored by Gaëtan Renaudeau's avatar Gaëtan Renaudeau

Using 'a big triangle' rather than '2 triangles'

see https://github.com/ProjectSeptemberInc/gl-react/issues/60
parent a78e1c71
......@@ -723,7 +723,7 @@ public class GLCanvas extends GLSurfaceView
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
glDrawArrays(GL_TRIANGLES, 0, 6);
glDrawArrays(GL_TRIANGLES, 0, 3);
}
private void render () {
......
......@@ -189,12 +189,9 @@ public class GLShader {
glBindBuffer(GL_ARRAY_BUFFER, buffer[0]);
float buf[] = {
-1.0f, -1.0f,
1.0f, -1.0f,
-1.0f, 1.0f,
-1.0f, 1.0f,
1.0f, -1.0f,
1.0f, 1.0f
-1.0f, -1.0f,
-1.0f, 4.0f,
4.0f, -1.0f
};
FloatBuffer bufferData = ByteBuffer.allocateDirect(buf.length * 4)
.order(ByteOrder.nativeOrder())
......
......@@ -520,7 +520,7 @@ RCT_NOT_IMPLEMENTED(-init)
RCT_PROFILE_BEGIN_EVENT(0, @"draw", nil);
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glDrawArrays(GL_TRIANGLES, 0, 6);
glDrawArrays(GL_TRIANGLES, 0, 3);
RCT_PROFILE_END_EVENT(0, @"gl", nil);
RCT_PROFILE_END_EVENT(0, @"gl", nil);
......
......@@ -389,11 +389,8 @@ GLuint compileShader (NSString* shaderName, NSString* shaderString, GLenum shade
glBindBuffer(GL_ARRAY_BUFFER, buffer);
GLfloat buf[] = {
-1.0, -1.0,
1.0, -1.0,
-1.0, 1.0,
-1.0, 1.0,
1.0, -1.0,
1.0, 1.0
-1.0, 4.0,
4.0, -1.0
};
glBufferData(GL_ARRAY_BUFFER, sizeof(buf), buf, GL_STATIC_DRAW);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment