opensciencemap / vtm

a vector-tile map library written in java - running on android, desktop and within the browser
GNU Lesser General Public License v3.0
238 stars 176 forks source link

Screenshot and export project in jar file #75

Closed Bezzu closed 10 years ago

Bezzu commented 10 years ago

Hello, I would like to know if exits a method to capture a screenshot of the map. And I would like to know if you have already done (and in which way) the jar file of the project.

Thanks.

hjanetzek commented 10 years ago

No there is no method to take screenshots within vtm.

Jars can be created with './gradlew --info clean install'

Bezzu commented 10 years ago

Thanks for the reply. can I ask you a suggestion about how can I implement a method to capture a screenshot? Because traditional methods does not work and save a black image.

hjanetzek commented 10 years ago

I guess one has to render to a FBO with a texture as color attachment.Then one needs to have a GL driver thats supports reading back pixel data of the texture.

It might not be that simple - but you could look into OffscreenRenderer class for the first part

stleusc commented 10 years ago

This link could help...

http://stackoverflow.com/questions/4731589/android-opengl-screenshot

Bezzu commented 10 years ago

thanks a week ago I found the same way to solve the problem and after some tests I took, it seems to work. The only problem is that I can do the screenshot only from the class MapReader before calling mBufferPool.releaseBuffers(). there is another way or is it correct?

hjanetzek commented 10 years ago

The suggested method seems to work when capturing the frame at the end of onDrawFrame: https://github.com/opensciencemap/vtm/commit/7df00e05431ee7813e0ffce6c84b9738e8b86a77