Openlayers 3 Handle tile load error - openlayers-3

I know there is a tileloaderror event fired if a tile fails to load, but how do I use that event to replace the missing tile with a 256x256 transparent png? At the moment if a tile is missing and you zoom in then the zoomed out portion of the tile is still available, I want to replace it with a blank to stop this.
Any ideas?

Set value of useInterimTilesOnError to false

Related

What does Tile based rendering mean?

tile based
I am wondering what ‘tile based’ here means about figma.
Any one got any paper or ideas.
Thanks a lot!!!!
Divide your canvas up into a grid. Each square on that grid is a tile. This renderer would render each of those tiles individually, then save the resulting image somewhere. Each of these images are then drawn onto the grid at the spot where they are supposed to go.
It allows The renderer to cache each tile, so it only needs to render tiles that just came into view. Or if something in one tile changes, you only need to re-render that one tile and not the entire screen.

webgl strange rendering artifacts

UPDATE:
I have posted the code online to demonstrate the issue:
http://cutama.github.io/
To see the problem, position the mouse on the red rectangle and zoom in and out using the mouse scroller. After a while you will see the triangles flickering, then use the left mouse button to rotate.
Controls:
left mouse click&drag: orbit, middle mouse click&drag: pan, mouse scroll: zoom
END UPDATE
I have encountered a strange rendering problem with webgl. Whenever I moved the camera around, some triangles appear to be missing randomly. See pictures below.
I have been digging around but could not find the cause. Any ideas what may be causing this?
This is the normal rendering of the geometry:
Missing triangles:
Another missing triangles:
Did some debugging with webgl inspector.
GL Trace:
Clicking on the missing pixel show that it is being depth culled, but nothing is in front of it...so why is it culled?
Comparison with normal unculled pixel:
Vertex data inside the buffer. The triangles are very small. Is this causing the problem?
I don't know what makes this bug. But, I will list what you might need to consider.
Check you specified correct PrimitiveTopology(It should be gl.TRIANGLES in many case)
Check you rendered wether gl.DrawElements or gl.DrawArrays.
If you are using index buffer, you should use gl.DrawElements
Check you are using correct culling configuration.
Check you are using correct depth comparing function.(If you are not using depth test,you don't need to care about this)
Found the issue is caused by incorrect triangle indices in the model..still not sure why it would cause flickering.

Fill image with different color by detecting the different parts

I have an Image of a landscape which i need to fill with different colors.
When i select colors from palette and start scrubbing on any particular part, only that part should get the color even if by mistake i take my finger outside of that image part.
So basically i need to detect which part of image have i tapped so that only that part takes the color.
I am developing this app in Cocos2dx, but any help in logic would be a good point to start.
Here is an example of what i want.
Note : I know i could achieve this by taking separate images and then detecting touches, but that increases the app size by alot of MB's.
I guess user will be able to draw only on white part of the image.
If above is true, what i want you to do is, in your touchesMoved method, check if any black color (non white) pixel is present between previous touch point and current touch point.
If there is no such black pixel, then draw it else dont draw it.

How to make the PNG's transparent region not be listened by the EventListener when a touch event happened?

I didn't find a variable that could make the PNG picture's transparent region not being touched.
Does DisplayObject have a function or variable that could make that transparent region can't be touched?
Thanks for your answer.
you need to use a mask to disable the transparent touch, please refer to this tutorial:
http://www.coronalabs.com/blog/2012/05/29/how-to-use-bitmap-masks/
I don't remeber any function but you can divide your picture in pieces. Or you can use sprite sheets and select the desired area.

iOs draw an intereactive map

I need to draw an interactive map for an iOs application. For example it can be the map of the US showing the states. It will need to show all the states in different colors ( I'll get this from a delegate colorForStateNo: ) It will need to allow the user to select a state by touching it, when the color will change, and a "stick out" effect should be shown, maybe even a symbol animated to appear over the selected state. Also the color of some states will need to change depending on external events. This color change will mean an animation like a circle starting in the middle of the state and progressing towards the edges changing the color from the current one to the one inside the circle.
Can this be done ,easily in core-graphics? Or is it only possible with Open GL ES? What is the easiest way to do this? I have worked with core graphics and it doesn't seem to handle animation very well, I just redraw the entire screen when something needed to move... Also how could I use an external image to draw the map? Setting up a lot of drawLineToPoint seems like , a lot of work to draw only one state let alone the whole map ...
You could create the map using vector graphics and then have that converted to OpenGL calls.
Displaying SVG in OpenGL without intermediate raster
EDIT: The link applies to C++, but you may be able to find a similar solution.

Resources