Since PVR file format and PVRTexTool utility supports ETC compression -- I want to use it for my textures in the Android project.
Unfortunately I found no libs or samples how to load ETC1 OpenGL texture from PVR file.
One source I have is Objective-C PVR loader for iOS. But I need some example on C++ for Android NDK.
Unfortunately there doesn't seem to be much info on this out there, however there are a couple of things. http://www.brokenteapotstudios.com/android-game-development-blog/2011/05/loading-opengl-textures-in-c-and-etc1-texture-compression.html provides most of the info needed. If you want to use the header version, the header format is described here http://www.mhgames.org/2012/03/android-development-loading-etc1-textures-from-ndk/
Hopefully that's helpful :)
Read this first regarding compressed textures on android:
http://developer.android.com/guide/topics/graphics/opengl.html (scroll down to the "OpenGL Versions and Device Compatibility" chapter)
There's also the ETC1Util class (as referred from the link above) :
http://developer.android.com/reference/android/opengl/ETC1Util.html
Logical thing to do would be to use ETC1Util.isETC1Supported() to see if ETC1 is supported on your device and if not, provide a fallback option.
I also recommend you take a look (if you haven't done so already) at the PowerVR android sdk:
http://www.imgtec.com/powervr/insider/sdkdownloads/index.asp
I haven't taken a look at it myself, but I'm sure it's got what you are looking for.
So, I don't think there's any need for Objective-C...
Good luck!
Related
I have a video(.mp4) file in my SDCard,I want to reduce a size of .mp4 file and upload this file to a server.
One way you can do this is to use ffmpeg.
There are several ways of using ffmpeg in an Android program:
use the native libraries directly from c using JNI
use a library which provides a wrapper around the 'ffmpeg' cmd line utility (also uses JNI in the wrapper library)
call ffmpeg cmd line via 'exec' from within you Android app
Of the three, I personally have used the wrapper approach in the past and found it worked well. IMHO, the documentation and examples available with the native libraries represented quite a steep learning curve.
Note, if you do use 'exec' there are some things it is worth being aware of - see bottom of this answer: https://stackoverflow.com/a/25002844/334402.
The wrapper does have limitations - at heart, the ffmpeg cmd line tool is not intended to be used this way and you have to keep that in mind, but it does work. There is an example project available on github which seems to have a reasonable user base - I did not use it myself but I did refer to it and found it useful, especially for an issue you will find if you need to call your ffmpeg wrapper more than once from the same activity or task:
https://github.com/jhotovy/android-ffmpeg
See this answer (and the questions and answers it is part if) for some more specifics on the 'calling ffmpeg two times' solution:
https://stackoverflow.com/a/28752190/334402
I want to create an app that will display position on some floor plan. Navigation is implementing via WiFi in certain way, I've done it and so now I have a problem of displaying floor plan.
It might be in some vector format, after surfing internet for some time I've decided that it must be svg file.
I found some solutions, but it isn't working for me!
Library svg-android
There is opportunity to display .svg files, but only "simple" files. It works fine only for file in tutorial, but not for any other .svg file (for example, some other file, that you'll create with Inkscape).
So, I decided, that I'll parse .svg file, make DOM from it, somehow get objects and attributes and draw it via OpenGL ES.
Apache Batik
At first glance, very good solution, but there is a problem. Android has some "native" apache libraries and when I try to do something with batik, it throws NoClassDefFoundError, because it's searching not in batik libraries, but in "native" libraries.
Of course, we can add source code in our project, take only batik parser for .svg files and edit it in some way, but there is a lot of work, with same success we can write our own parser.
Tiny Line
There is no trial version, but if we'll see description of how it works for svg files and android, we'll see that there is only rasterization of such files and that's all.
Is there any solution better than writing own parser?
Did anyone come across this problem?
I would suggest using #1. Don't write your own parser. It's just going to be a huge headache.
How detailed does your floor plan have to be? android-svg supports SVG fairly well. It just doesn't have great support for filters or light sources. Your SVG isn't going to have those in them (I hope).
If you don't want to do that, look into quad trees. You can render out a huge image and break that down into a quadtree like format then only load the quads you require.
I have authored an SVG libaray for android the website is
http://www.vectoroid.com
the main thing missing is SVG arc support this is currently fixed and will be in a release in the near future.
I am looking for feedback on it, as i have been working on it for about a year. So if you have any please do tell ...
I've using yet another SVG for Android; seems it is relatively new.
GPLv3, CSS2 support, fonts, texts and spans, linear and radial gradients, SVG and SVGZ, initial filtering support, images from assets, from web and inline base64-encoded images. Fastest from all I've tried.
Of course filters support might be better, but except this it works well and even displays 20-megabytes SVG files.
Successfully tested these 2 libraries:
https://github.com/BigBadaboom/androidsvg - Apache License 2.0
https://scand.com/products/svgkit-android/ - needed tweaking to compile with modern SDK (suppress warnings, update gradle file); LGPL / commercial
androidsvg looks better so far.
I have a problem with an image for an android game. The problem is not a problem with the code because the code that I use I took from a book (Beginning Android 4 Games Developer).
The problem is this: I know the format that I have to use in android: png, but I don't know the settings for this format that I have to use (like RGB565...). Because if I use simply png, when I run the game the images are not good. So I need someone to explain to which settings I need to use for images for android games.
P.S The software that I used is photoshop. If there is better software for this purpose tell me.
I think there is a strong misconception in your understanding of Android and how it implements graphics. You are not constrained to .png for nearly any of your development. The .png and .9.png are only enforced strictly for managing drawable constants.
Android uses Java and has the capability to utilize nearly any graphical format. In particular native support for .bmp, .png, and .jpg are present for every device and Android OS version. You may even create your graphics in realtime byte by byte.
As for a good image editor, there are a number out there. I often use a combination of GIMP and Photoshop, myself.
Hope this helps,
FuzzicalLogic
I am trying to resize video file on Android device using FFmpeg. Remark: I cant use FFmpeg as binary - in my case it should be used as shared library (only FFmpeg C API is accessible).
I did not find any documentation regarding video resizing, however it looks like algorithm is following:
10 OPEN video_stream FROM video.mp4
20 READ packet FROM video_stream INTO frame
30 IF frame NOT COMPLETE GOTO 20
40 RESIZE frame
50 WRITE frame TO converted_video.mp4
60 GOTO 20
Should I use sws_scale function in order to resize frame? Is there any other (easier?) way to resize video file using FFmpeg C API?
From what I remember, sws_scale() is the way to do this with recent FFmpeg versions. Despite the extra steps like preparing an SwsContext it's not that hard to use, and there are examples such as the tutorial on the site you referenced.
Older versions also had an img_convert() function which was a bit simpler to use, and for a while it was still in the library but not in the usual headers -- it still worked if you supplied your own prototype (taken from an older version). This may still work, if you're willing to chance it -- though I haven't tried it with the latest versions. It's probably safer and better to use sws_scale(), though.
It's also possible to handle the scaling outside of the FFmpeg libraries, but it's likely more trouble than it's worth in this case. The Doxygen documentation for the libraries describes the AVPicture structure well enough to work with it directly, or transfer the image to/from some other form. The main difficulty is ensuring you can work with or convert the color/pixel format used -- if you would have to convert it to another format, you should use sws_scale() for at least that much, if not the resizing as well.
I am looking into Renderscript capabilities and stuck with the A3D (Android 3d) file format. I can't find an easy way to convert a Collada file into an A3D format to store my blender model.
I was wondering if you guys have an idea I could try maybe?
Does anyone have a working code sample so that is can see what im doing wrong?
More info: http://developer.android.com/reference/android/renderscript/FileA3D.html
Edit: Not to be mistaken for the Asci3d file extention ( also *.a3d )
As of Ice Cream Sandwich (perhaps earlier) there is a tool in the Android source to convert between Collada and A3D.
The tool is called a3dconvert; you can browse the source online here (in the ICS branch): https://github.com/android/platform_development/tree/ics-mr1-release/tools/a3dconvert
Usage:
a3dconvert input_file a3d_output_file
Currently .obj and .dae (collada) input files are accepted.
This tool has been removed as of newer releases (Jelly Bean, it looks like). This probably because the graphics portion of Renderscript has been deprecated.
I'm not sure A3D is a good format but if you have to write a converter here is a description of both formats:
http://scorpion.tordivel.no/help/UsersGuide/General/ImageOperations/ImageFormats/ImageFormats_a3d.htm
http://en.wikipedia.org/wiki/COLLADA
And here is some sample code to read Collada:
http://sourceforge.net/projects/colladaloader/
If you're going from Blender to A3D, I would consider writing a Python script to go directly to A3D format from Blender. The A3D format seems rather simplistic and if you're only accessing the Mesh data, the Blender API isn't too hard to follow. Of course if you don't already know it, you'll have to pick up some Python syntax.
I knew nothing of Python when I first wanted to pull some information from Blender myself, and looking at existing .py scripts (like the OBJ export), the Blender API and learning some basic Python syntax I was able to write my first (rather simple) script in just a few hours or so.
http://colladablender.illusoft.com/cms/ is a project making a plugin for Blender to read Collada directly.
Also, Carrara could be used to convert your files to something Blender supports.