• Create Account

Banner advertising on our site currently available from just \$5!

# hockeyman

Member Since 18 Jul 2012
Offline Last Active Aug 29 2012 07:09 AM

### Topics I've Started

18 July 2012 - 08:29 AM

I am developing paint app. User can draw with mouse on my OpenGL view. He draws textured quads (textured to look like circle). But when he drags mouse faster there appears spacings between quads. So I calculate distance between previous point and current point, and if its bigger than something I need to add more quads to that distance automatically. How can I do that? I'm using vertex array.

Code:
```int count = [vertices count] * 8;
GLVertices = (GLfloat *)malloc(count * sizeof(GLfloat));
int currIndex = 0;
for (NSValue *locationValuetl in vertices) {
CGPoint loc = locationValuetl.pointValue;
GLVertices[currIndex++] = loc.x;
GLVertices[currIndex++] = loc.y;

}
for (NSValue *locationValuetr in vertices) {
CGPoint loc = locationValuetr.pointValue;
GLVertices[currIndex++] = loc.x;
GLVertices[currIndex++] = loc.y;
}
for (NSValue *locationValuell in vertices) {
CGPoint loc = locationValuell.pointValue;
GLVertices[currIndex++] = loc.x;
GLVertices[currIndex++] = loc.y;
}
for (NSValue *locationValuelr in vertices) {
CGPoint loc = locationValuelr.pointValue;
GLVertices[currIndex++] = loc.x;
GLVertices[currIndex++] = loc.y;
}
int distance1 = sqrt(GLVertices[currIndex - 1]*GLVertices[currIndex - 9] + GLVertices[currIndex]*GLVertices[currIndex - 8]);
if (distance1 > brushSize/4) {
//need to do something here
```

Image of current result:

Can someone help me?