diff --git a/Classes/WDGLUtilities.h b/Classes/WDGLUtilities.h index 9e3eaea..1cc4055 100644 --- a/Classes/WDGLUtilities.h +++ b/Classes/WDGLUtilities.h @@ -14,5 +14,5 @@ #import #import -void WDGLBuildQuadForRect(CGRect rect, CGAffineTransform transform, GLuint *quadVAO, GLuint *quadVBO, BOOL stroke); +void WDGLBuildQuadForRect(CGRect rect, CGAffineTransform transform, GLuint *quadVAO, GLuint *quadVBO); void WDGLRenderInRect(CGRect rect, CGAffineTransform transform); diff --git a/Classes/WDGLUtilities.m b/Classes/WDGLUtilities.m index 26dd6c5..c0dda2a 100644 --- a/Classes/WDGLUtilities.m +++ b/Classes/WDGLUtilities.m @@ -11,7 +11,7 @@ #import "WDGLUtilities.h" -void WDGLBuildQuadForRect(CGRect rect, CGAffineTransform transform, GLuint *quadVAO, GLuint *quadVBO, BOOL stroke) +void WDGLBuildQuadForRect(CGRect rect, CGAffineTransform transform, GLuint *quadVAO, GLuint *quadVBO) { CGPoint corners[4]; @@ -24,33 +24,19 @@ void WDGLBuildQuadForRect(CGRect rect, CGAffineTransform transform, GLuint *quad corners[i] = CGPointApplyAffineTransform(corners[i], transform); } + const GLfloat vertices[] = { + corners[0].x, corners[0].y, 0.0, 0.0, + corners[1].x, corners[1].y, 1.0, 0.0, + corners[3].x, corners[3].y, 0.0, 1.0, + corners[2].x, corners[2].y, 1.0, 1.0, + }; + glGenVertexArraysOES(1, quadVAO); glBindVertexArrayOES(*quadVAO); // create, bind, and populate VBO glGenBuffers(1, quadVBO); glBindBuffer(GL_ARRAY_BUFFER, *quadVBO); - - const GLfloat *vertices = NULL; - - if (stroke) { - const GLfloat quadVertices[] = { - corners[0].x, corners[0].y, 0.0, 0.0, - corners[1].x, corners[1].y, 1.0, 0.0, - corners[2].x, corners[2].y, 1.0, 1.0, - corners[3].x, corners[3].y, 0.0, 1.0 - }; - vertices = quadVertices; - } else { - const GLfloat quadVertices[] = { - corners[0].x, corners[0].y, 0.0, 0.0, - corners[1].x, corners[1].y, 1.0, 0.0, - corners[3].x, corners[3].y, 0.0, 1.0, - corners[2].x, corners[2].y, 1.0, 1.0, - }; - vertices = quadVertices; - } - glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * 16, vertices, GL_STATIC_DRAW); // set up attrib pointers diff --git a/Classes/WDPainting.m b/Classes/WDPainting.m index 66a66f6..455a84e 100644 --- a/Classes/WDPainting.m +++ b/Classes/WDPainting.m @@ -791,7 +791,7 @@ - (GLuint) quadVAO if (!quadVAO_) { [EAGLContext setCurrentContext:self.context]; CGRect bounds = CGRectMake(0, 0, self.width, self.height); - WDGLBuildQuadForRect(bounds, CGAffineTransformIdentity, &quadVAO_, &quadVBO_, NO); + WDGLBuildQuadForRect(bounds, CGAffineTransformIdentity, &quadVAO_, &quadVBO_); } return quadVAO_; diff --git a/Classes/WDShadowQuad.m b/Classes/WDShadowQuad.m index 639a4d5..57b3853 100644 --- a/Classes/WDShadowQuad.m +++ b/Classes/WDShadowQuad.m @@ -131,7 +131,7 @@ - (void) blitWithScale:(float)scale if (!CGRectEqualToRect(rect, lastRect)) { [self freeBuffers]; - WDGLBuildQuadForRect(rect, CGAffineTransformIdentity, &vao_, &vbo_, NO); + WDGLBuildQuadForRect(rect, CGAffineTransformIdentity, &vao_, &vbo_); } // Bind the texture to be used