How to explode a drawing into primitives - explode

How can I convert an Drawing into primitives: Lines, Arcs, Texts, Circles, deleting every other objects (blocks, styles, groups, layers, shapes, etc.) so that there are no objects left that cannot be purged?

Related

Variations in sprite shape textures

I am currently trying out how to work with sprite shapes. I know how we can put different textures on different angles but Suppose i wanted to make variations with different images(sprites) on a single surface. For example, i want to make spots with puddle textures on a grass plain land. How will i do that?
I tried adding different textures in different angles but I couldn't figure out how i can change the repeating texture and make variations in a single surface in a sprite shape.

Is it possible to animate individual draw calls in a CALayer?

I'm drawing in a single CALayer between 100 and up to 1000 dots (colored circles actually) in a grid, when each dot state changes from hidden to shown and viceversa. So this layer is drawn quite a lot. The reason I went with a single layer and not 1000 layers is because I think performance would be hit with so many layers. Now I want to animate the dissappearance of (maybe multiple) dots over 2 seconds, a fade-off. Is that possible to do for each individual draw call?

Maximum of How many textures can be drawn inside 4 vertex data

I have two squares with six vertex as in the image. I want to add texture to them I want to add same texture about 30 times between two squares in metal is it Possible ? To my understanding I could able to add two textures
Is it possible add about 30 times same textures between two square

How can I draw a single triangle from a Vertex Buffer Object and set its color?

I have created a Vertex Buffer Object containing only vertices for triangles, for drawing with the GL_TRIANGLES option. My VBO has no color information because I change the color every frame.
Now I'm trying to draw individual triangles in a loop after setting the default vertex color like this in every iteration:
glColor4f(red, green, blue, 1);
But I'm not sure how to perform the actual drawing.
Must I use glDrawArrays if I want to pick one or two triangles out of the VBO to draw them with a specific color, or must I use glDrawElements?
Is there a more efficient way to set the color for each triangle in the VBO and then draw it? Or is it fine to call glColor44 and glDrawArrays in a loop for every frame?
First of all, I would rather suggest to ignore the slightly higher memory cost and just store a color with each vertex inside the VBO and therefore just duplicate the triangle's color for each of the triangle's vertices (you cannot set per-triangle colors). This will most probably be much more efficient than drawing single triangles in a loop. Keep in mind that the advantage of VBOs is not only their possible GPU storage, but also the fact that you don't need driver calls for each and every triangle or even vertex. So just duplicate your per-triangle colors into per-vertex colors and draw everything with a single call to glDrawArrays (glDrawElements won't buy you much if you need to duplicate almost every vertex anyway, which makes indices just useless).
Said that, you can of course draw individual triangles with glDrawArrays, that's what the first and count parameters are for. So if you have a VBO containing the 9 vertices of 3 triangles, just call
glDrawArrays(GL_TRIANGLES, 3, 3);
to draw only the 2nd triangle. That easy. And likewise can you use the count and offset parameters of glDrawElements to select a particular part of the index array to draw.

iPhone - Should I composite two images at runtime, or pre-render them at the cost of memory

I am building a cocos2d iPhone game.
There will be 6 'enemy spaceship sprites' that vary only by colour. I.e. all the sprites will have the same shape only some parts of the interior will have different colours.
My two options are:
1)
Create a template shape with a transparent interior.
At runtime, draw this shape on top of a small block of colour X.
The interior of the sprite will be colour X.
2)
Pre-render 6 different sprites
At run time, simply draw the sprite of a given colour.
What is the advantages and disadvantages of each method? Is there a best practice?
If I later wanted to animate the sprites, or dynamically change their colours, would this effect my choice of method?
Thanks!
I think first you need to figure out what it is that you're trying to do... Animation or a large number of color combinations make pre-rendering unfeasible. On the other hand, pre-rendering makes sense if you have a large number of ships on-screen at the same time, because you can use this technique to cut the number of drawing operations in half.