Problem with textures on Android

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
dozzer
Gnoblar
Posts: 3
Joined: Wed Apr 02, 2014 11:16 pm

Problem with textures on Android

Post by dozzer »

Hello all.
I am a beginner in Ogre so i make mistakes.
I got some code from samples and prepared an application for Android.
I started my app on Nexus Galaxy and got following picture
Can you help me ?
Image
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4308
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 137

Re: Problem with textures on Android

Post by spacegaier »

We need more concrete information to be able to help you. What are you trying to achieve, what are the errors, some relevant code, etc.
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
dozzer
Gnoblar
Posts: 3
Joined: Wed Apr 02, 2014 11:16 pm

Re: Problem with textures on Android

Post by dozzer »

Here is a log

Code: Select all

04-03 10:38:49.685: I/OGRE(12578): GL_VERSION = OpenGL ES 2.0 build 1.8.GOOGLENEXUS.ED945322@2198402
04-03 10:38:49.685: I/OGRE(12578): GL_VENDOR = Imagination Technologies
04-03 10:38:49.685: I/OGRE(12578): GL_RENDERER = PowerVR SGX 540
04-03 10:38:49.685: I/OGRE(12578): GL_EXTENSIONS = GL_EXT_debug_marker GL_OES_rgb8_rgba8 GL_OES_depth24 GL_OES_vertex_half_float GL_OES_texture_float GL_OES_texture_half_float GL_OES_element_index_uint GL_OES_mapbuffer GL_OES_fragment_precision_high GL_OES_compressed_ETC1_RGB8_texture GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_required_internalformat GL_OES_depth_texture GL_OES_get_program_binary GL_OES_packed_depth_stencil GL_OES_standard_derivatives GL_OES_vertex_array_object GL_OES_egl_sync GL_EXT_multi_draw_arrays GL_EXT_texture_format_BGRA8888 GL_EXT_discard_framebuffer GL_EXT_shader_texture_lod GL_IMG_shader_binary GL_IMG_texture_compression_pvrtc GL_IMG_texture_npot GL_IMG_texture_format_BGRA8888 GL_IMG_read_format GL_IMG_program_binary GL_IMG_multisampled_render_to_texture
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_EXT_debug_marker
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_OES_rgb8_rgba8
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_OES_depth24
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_OES_vertex_half_float
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_OES_texture_float
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_OES_texture_half_float
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_OES_element_index_uint
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_OES_mapbuffer
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_OES_fragment_precision_high
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_OES_compressed_ETC1_RGB8_texture
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_OES_EGL_image
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_OES_EGL_image_external
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_OES_required_internalformat
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_OES_depth_texture
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_OES_get_program_binary
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_OES_packed_depth_stencil
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_OES_standard_derivatives
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_OES_vertex_array_object
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_OES_egl_sync
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_EXT_multi_draw_arrays
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_EXT_texture_format_BGRA8888
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_EXT_discard_framebuffer
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_EXT_shader_texture_lod
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_IMG_shader_binary
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_IMG_texture_compression_pvrtc
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_IMG_texture_npot
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_IMG_texture_format_BGRA8888
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_IMG_read_format
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_IMG_program_binary
04-03 10:38:49.685: I/OGRE(12578): EXT:GL_IMG_multisampled_render_to_texture
04-03 10:38:49.685: I/OGRE(12578): **************************************
04-03 10:38:49.685: I/OGRE(12578): *** OpenGL ES 2.x Renderer Started ***
04-03 10:38:49.685: I/OGRE(12578): **************************************
04-03 10:38:49.685: I/OGRE(12578): GLSL ES support detected
04-03 10:38:49.685: I/OGRE(12578): Registering ResourceManager for type GpuProgram
04-03 10:38:49.692: I/OGRE(12578): GL ES 2: Using FBOs for rendering to textures
04-03 10:38:49.692: E/IMGSRV(12578): :0: ComputeFrameBufferCompleteness: Unknown texture format
04-03 10:38:49.692: E/IMGSRV(12578): :0: ComputeFrameBufferCompleteness: Unknown texture format
04-03 10:38:49.692: E/IMGSRV(12578): :0: ComputeFrameBufferCompleteness: Unknown texture format
04-03 10:38:49.692: E/IMGSRV(12578): :0: ComputeFrameBufferCompleteness: Unknown texture format
04-03 10:38:49.708: I/OGRE(12578): FBO PF_R5G6B5 depth/stencil support: D0S0 D0S8 D16S0 D16S8 D24S0 D24S8 Packed-D24S8 
04-03 10:38:49.731: I/OGRE(12578): FBO PF_B5G6R5 depth/stencil support: D0S0 D0S8 D16S0 D16S8 D24S0 D24S8 Packed-D24S8 
04-03 10:38:49.770: I/OGRE(12578): FBO PF_A4R4G4B4 depth/stencil support: D0S0 D0S8 D16S0 D16S8 D24S0 D24S8 Packed-D24S8 
04-03 10:38:49.786: I/OGRE(12578): FBO PF_A1R5G5B5 depth/stencil support: D0S0 D0S8 D16S0 D16S8 D24S0 D24S8 Packed-D24S8 
04-03 10:38:49.810: I/OGRE(12578): FBO PF_R8G8B8 depth/stencil support: D0S0 D0S8 D16S0 D16S8 D24S0 D24S8 Packed-D24S8 
04-03 10:38:49.833: I/OGRE(12578): FBO PF_B8G8R8 depth/stencil support: D0S0 D0S8 D16S0 D16S8 D24S0 D24S8 Packed-D24S8 
04-03 10:38:49.856: I/OGRE(12578): FBO PF_A8R8G8B8 depth/stencil support: D0S0 D0S8 D16S0 D16S8 D24S0 D24S8 Packed-D24S8 
04-03 10:38:49.872: I/OGRE(12578): FBO PF_A8B8G8R8 depth/stencil support: D0S0 D0S8 D16S0 D16S8 D24S0 D24S8 Packed-D24S8 
04-03 10:38:49.888: I/OGRE(12578): FBO PF_B8G8R8A8 depth/stencil support: D0S0 D0S8 D16S0 D16S8 D24S0 D24S8 Packed-D24S8 
04-03 10:38:49.903: E/IMGSRV(12578): :0: ComputeFrameBufferCompleteness: Unknown texture format
04-03 10:38:49.903: E/IMGSRV(12578): :0: ComputeFrameBufferCompleteness: Unknown texture format
04-03 10:38:49.903: I/OGRE(12578): [GLES2] : Valid FBO targets PF_R5G6B5 PF_B5G6R5 PF_A4R4G4B4 PF_A1R5G5B5 PF_R8G8B8 PF_B8G8R8 PF_A8R8G8B8 PF_A8B8G8R8 PF_B8G8R8A8 
04-03 10:38:49.903: I/OGRE(12578): RenderSystem capabilities
04-03 10:38:49.903: I/OGRE(12578): -------------------------
04-03 10:38:49.903: I/OGRE(12578): RenderSystem Name: OpenGL ES 2.x Rendering Subsystem
04-03 10:38:49.903: I/OGRE(12578): GPU Vendor: imagination technologies
04-03 10:38:49.903: I/OGRE(12578): Device Name: PowerVR SGX 540
04-03 10:38:49.903: I/OGRE(12578): Driver Version: 0.0.0.0
04-03 10:38:49.903: I/OGRE(12578):  * Fixed function pipeline: no
04-03 10:38:49.903: I/OGRE(12578):  * Hardware generation of mipmaps: yes
04-03 10:38:49.903: I/OGRE(12578):  * Texture blending: yes
04-03 10:38:49.903: I/OGRE(12578):  * Anisotropic texture filtering: no
04-03 10:38:49.903: I/OGRE(12578):  * Dot product texture operation: yes
04-03 10:38:49.903: I/OGRE(12578):  * Cube mapping: yes
04-03 10:38:49.903: I/OGRE(12578):  * Hardware stencil buffer: yes
04-03 10:38:49.903: I/OGRE(12578):    - Stencil depth: 8
04-03 10:38:49.903: I/OGRE(12578):    - Two sided stencil support: yes
04-03 10:38:49.903: I/OGRE(12578):    - Wrap stencil values: yes
04-03 10:38:49.903: I/OGRE(12578):  * Hardware vertex / index buffers: yes
04-03 10:38:49.903: I/OGRE(12578):  * Vertex programs: yes
04-03 10:38:49.903: I/OGRE(12578):  * Number of floating-point constants for vertex programs: 128
04-03 10:38:49.903: I/OGRE(12578):  * Number of integer constants for vertex programs: 128
04-03 10:38:49.903: I/OGRE(12578):  * Number of boolean constants for vertex programs: 128
04-03 10:38:49.903: I/OGRE(12578):  * Fragment programs: yes
04-03 10:38:49.903: I/OGRE(12578):  * Number of floating-point constants for fragment programs: 64
04-03 10:38:49.903: I/OGRE(12578):  * Number of integer constants for fragment programs: 64
04-03 10:38:49.903: I/OGRE(12578):  * Number of boolean constants for fragment programs: 64
04-03 10:38:49.903: I/OGRE(12578):  * Geometry programs: no
04-03 10:38:49.903: I/OGRE(12578):  * Number of floating-point constants for geometry programs: 0
04-03 10:38:49.903: I/OGRE(12578):  * Number of integer constants for geometry programs: 0
04-03 10:38:49.903: I/OGRE(12578):  * Number of boolean constants for geometry programs: 0
04-03 10:38:49.903: I/OGRE(12578):  * Tesselation Hull programs: no
04-03 10:38:49.903: I/OGRE(12578):  * Number of floating-point constants for tesselation hull programs: 0
04-03 10:38:49.903: I/OGRE(12578):  * Number of integer constants for tesselation hull programs: 0
04-03 10:38:49.903: I/OGRE(12578):  * Number of boolean constants for tesselation hull programs: 0
04-03 10:38:49.903: I/OGRE(12578):  * Tesselation Domain programs: no
04-03 10:38:49.903: I/OGRE(12578):  * Number of floating-point constants for tesselation domain programs: 0
04-03 10:38:49.903: I/OGRE(12578):  * Number of integer constants for tesselation domain programs: 0
04-03 10:38:49.903: I/OGRE(12578):  * Number of boolean constants for tesselation domain programs: 0
04-03 10:38:49.903: I/OGRE(12578):  * Compute programs: no
04-03 10:38:49.903: I/OGRE(12578):  * Number of floating-point constants for compute programs: 0
04-03 10:38:49.903: I/OGRE(12578):  * Number of integer constants for compute programs: 0
04-03 10:38:49.903: I/OGRE(12578):  * Number of boolean constants for compute programs: 0
04-03 10:38:49.903: I/OGRE(12578):  * Supported Shader Profiles: glsles
04-03 10:38:49.903: I/OGRE(12578):  * Texture Compression: yes
04-03 10:38:49.903: I/OGRE(12578):    - DXT: no
04-03 10:38:49.903: I/OGRE(12578):    - VTC: no
04-03 10:38:49.903: I/OGRE(12578):    - PVRTC: yes
04-03 10:38:49.903: I/OGRE(12578):    - BC4/BC5: no
04-03 10:38:49.903: I/OGRE(12578):    - BC6H/BC7: no
04-03 10:38:49.911: I/OGRE(12578):  * Scissor Rectangle: yes
04-03 10:38:49.911: I/OGRE(12578):  * Hardware Occlusion Query: no
04-03 10:38:49.911: I/OGRE(12578):  * User clip planes: no
04-03 10:38:49.911: I/OGRE(12578):  * VET_UBYTE4 vertex element type: yes
04-03 10:38:49.911: I/OGRE(12578):  * Infinite far plane projection: yes
04-03 10:38:49.911: I/OGRE(12578):  * Hardware render-to-texture: yes
04-03 10:38:49.911: I/OGRE(12578):  * Floating point textures: yes
04-03 10:38:49.911: I/OGRE(12578):  * Non-power-of-two textures: no
04-03 10:38:49.911: I/OGRE(12578):  * 1d textures: yes
04-03 10:38:49.911: I/OGRE(12578):  * Volume textures: no
04-03 10:38:49.911: I/OGRE(12578):  * Multiple Render Targets: 1
04-03 10:38:49.911: I/OGRE(12578):    - With different bit depths: no
04-03 10:38:49.911: I/OGRE(12578):  * Point Sprites: yes
04-03 10:38:49.911: I/OGRE(12578):  * Extended point parameters: yes
04-03 10:38:49.911: I/OGRE(12578):  * Max Point Size: 0.000000
04-03 10:38:49.911: I/OGRE(12578):  * Vertex texture fetch: no
04-03 10:38:49.911: I/OGRE(12578):  * Number of world matrices: 0
04-03 10:38:49.911: I/OGRE(12578):  * Number of texture units: 8
04-03 10:38:49.911: I/OGRE(12578):  * Stencil buffer depth: 8
04-03 10:38:49.911: I/OGRE(12578):  * Number of vertex blend matrices: 0
04-03 10:38:49.911: I/OGRE(12578):  * Render to Vertex Buffer : no
04-03 10:38:49.911: I/OGRE(12578):  * Hardware Atomic Counters: no
04-03 10:38:49.911: I/OGRE(12578):  * GL 1.5 without VBO workaround: no
04-03 10:38:49.911: I/OGRE(12578):  * Frame Buffer objects: yes
04-03 10:38:49.911: I/OGRE(12578):  * Frame Buffer objects (ARB extension): no
04-03 10:38:49.911: I/OGRE(12578):  * Frame Buffer objects (ATI extension): no
04-03 10:38:49.911: I/OGRE(12578):  * PBuffer support: no
04-03 10:38:49.911: I/OGRE(12578):  * GL 1.5 without HW-occlusion workaround: no
04-03 10:38:49.911: I/OGRE(12578):  * Vertex Array Objects: yes
04-03 10:38:49.911: I/OGRE(12578):  * Separate shader objects: no
04-03 10:38:49.911: I/OGRE(12578): DefaultWorkQueue('Root') initialising on thread main.
04-03 10:38:49.911: I/OGRE(12578): Particle Renderer Type 'billboard' registered
04-03 10:38:49.919: I/OGRE(12578): SceneManagerFactory for type 'OctreeSceneManager' registered.
04-03 10:38:49.919: V/MyApp(12578): setupScene
04-03 10:38:49.919: I/OGRE(12578): while
04-03 10:38:49.919: I/OGRE(12578): while
04-03 10:38:50.060: I/OGRE(12578): Added resource location '/' of type 'APKFileSystem' to resource group 'General'
04-03 10:38:50.138: I/OGRE(12578): Added resource location '/RTShaderLib/GLSLES' of type 'APKFileSystem' to resource group 'General'
04-03 10:38:50.138: I/OGRE(12578): Added resource location '/SdkTrays.zip' of type 'APKZip' to resource group 'General'
04-03 10:38:50.138: I/OGRE(12578): Added resource location '/Sinbad.zip' of type 'APKZip' to resource group 'General'
04-03 10:38:50.138: I/OGRE(12578): Added resource location '/car.zip' of type 'APKZip' to resource group 'General'
04-03 10:38:50.138: I/OGRE(12578): Initialising resource group General
04-03 10:38:50.138: I/OGRE(12578): Parsing scripts for resource group General
04-03 10:38:50.864: I/OGRE(12578): Parsing script SdkTrays.material
04-03 10:38:50.872: I/OGRE(12578): Parsing script Sinbad.material
04-03 10:38:50.880: I/OGRE(12578): Parsing script car.material
04-03 10:38:50.888: I/OGRE(12578): Finished parsing scripts for resource group General
04-03 10:38:50.888: I/OGRE(12578): Creating resources for group General
04-03 10:38:50.888: I/OGRE(12578): All done
04-03 10:38:50.888: I/OGRE(12578): Mesh: Loading sinbad.mesh.
04-03 10:38:50.935: I/OGRE(12578): Skeleton: Loading Sinbad.skeleton
04-03 10:38:51.005: I/OGRE(12578): WARNING: sinbad.mesh is an older format ([MeshSerializer_v1.40]); you should upgrade it as soon as possible using the OgreMeshUpgrade tool.
04-03 10:38:51.044: I/OGRE(12578): Texture: sinbad_body.tga: Loading 1 faces(PF_R8G8B8,512x512x1) with 9 hardware generated mipmaps from Image. Internal format is PF_R8G8B8,512x512x1.
04-03 10:38:51.091: I/OGRE(12578): Texture: sinbad_clothes.tga: Loading 1 faces(PF_R8G8B8,512x512x1) with 9 hardware generated mipmaps from Image. Internal format is PF_R8G8B8,512x512x1.
04-03 10:38:51.122: I/OGRE(12578): Texture: sinbad_sword.tga: Loading 1 faces(PF_R8G8B8,256x256x1) with 8 hardware generated mipmaps from Image. Internal format is PF_R8G8B8,256x256x1.
04-03 10:38:51.122: I/OGRE(12578): WARNING: the mesh 'sinbad.mesh' includes vertices with more than 4 bone assignments. The lowest weighted assignments beyond this limit have been removed, so your animation may look slightly different. To eliminate this, reduce the number of bone assignments per vertex on your mesh to 4.
04-03 10:38:51.130: I/OGRE(12578): Viewport for camera 'MyCam', actual dimensions 4L: 0 T: 0 W: 720 H: 1184
04-03 10:38:51.130: V/MyApp(12578): setupScene finish
04-03 10:38:51.130: V/MyApp(12578):  ident = 1
04-03 10:38:51.130: V/MyApp(12578): handleCmd 6
04-03 10:38:51.130: V/MyApp(12578): APP_CMD_GAINED_FOCUS

Here is a source code

Code: Select all

#define OGRE_STATIC_GLES2
#define OGRE_STATIC_ParticleFX
#define OGRE_STATIC_OctreeSceneManager
#include "OgreStaticPluginLoader.h"

#include <EGL/egl.h>
#include <android/log.h>
#include <android_native_app_glue.h>

#include "Ogre.h"
#include "OgreRenderWindow.h"
#include "OgreStringConverter.h"
#include "RTShaderHelper.h"
#include "Android/OgreAndroidEGLWindow.h"
#include "Android/OgreAPKFileSystemArchive.h"
#include "Android/OgreAPKZipArchive.h"

#define APPNAME "MyApp"

static Ogre::RenderWindow* gRenderWnd = NULL;
static Ogre::Root* gRoot = NULL;
static Ogre::StaticPluginLoader* gStaticPluginLoader = NULL;
static AAssetManager* gAssetMgr = NULL; 
static Ogre::SceneManager* gSceneMgr = NULL;
static Ogre::ShaderGeneratorTechniqueResolverListener* gMatListener = NULL;

static float counter = 0.0f;
static Ogre::Camera* camera  = NULL;

const unsigned int TEXTURE_SIZE = 128;
using namespace Ogre;

static Ogre::DataStreamPtr openAPKFile(const Ogre::String& fileName)
{
	Ogre::DataStreamPtr stream;
    AAsset* asset = AAssetManager_open(gAssetMgr, fileName.c_str(), AASSET_MODE_BUFFER);
    if(asset)
    {
		off_t length = AAsset_getLength(asset);
        void* membuf = OGRE_MALLOC(length, Ogre::MEMCATEGORY_GENERAL);
        memcpy(membuf, AAsset_getBuffer(asset), length);
        AAsset_close(asset);
                
        stream = Ogre::DataStreamPtr(new Ogre::MemoryDataStream(membuf, length, true, true));
    }
    return stream;
}

static void setupScene()
{
	__android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "setupScene");

	Ogre::ConfigFile cf;
    cf.load(openAPKFile("resources.cfg"));

	Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
	while (seci.hasMoreElements())
	{
		LogManager::getSingleton().logMessage("while");
		Ogre::String sec, type, arch;
		sec = seci.peekNextKey();
		Ogre::ConfigFile::SettingsMultiMap* settings = seci.getNext();
		Ogre::ConfigFile::SettingsMultiMap::iterator i;

		for (i = settings->begin(); i != settings->end(); i++)
		{
			type = i->first;
			arch = i->second;
			Ogre::ResourceGroupManager::getSingleton().addResourceLocation(arch, type, sec);
		}
	}

	Ogre::ResourceGroupManager::getSingletonPtr()->initialiseResourceGroup(Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);

	Ogre::RTShader::ShaderGenerator::initialize();
	Ogre::RTShader::ShaderGenerator::getSingletonPtr()->setTargetLanguage("glsles");
	gMatListener = new Ogre::ShaderGeneratorTechniqueResolverListener();
	Ogre::MaterialManager::getSingleton().addListener(gMatListener);

	gSceneMgr = gRoot->createSceneManager(Ogre::ST_GENERIC);
	Ogre::RTShader::ShaderGenerator::getSingletonPtr()->addSceneManager(gSceneMgr);


	Ogre::Entity* pEntity = gSceneMgr->createEntity("SinbadInstance", "sinbad.mesh");
	Ogre::SceneNode* pNode = gSceneMgr->getRootSceneNode()->createChildSceneNode();
	pNode->attachObject(pEntity);

	camera = gSceneMgr->createCamera("MyCam");
	camera->setNearClipDistance(1.0f);
	camera->setFarClipDistance(100000.0f);
	camera->setPosition(0,0,20.0f);
	camera->lookAt(0,0,0);
	camera->setAutoAspectRatio(true);

	Ogre::Viewport* vp = gRenderWnd->addViewport(camera);
	vp->setBackgroundColour(Ogre::ColourValue(1,1,0));
	vp->setMaterialScheme(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);

	Ogre::RTShader::ShaderGenerator::getSingletonPtr()->invalidateScheme(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
	__android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "setupScene finish");
}

static int32_t handleInput(struct android_app* app, AInputEvent* event) 
{
	__android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "handleInput");
}

static void handleCmd(struct android_app* app, int32_t cmd)
{
	__android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "handleCmd %d", cmd);
    switch (cmd) 
    {
        case APP_CMD_SAVE_STATE:
        	__android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "APP_CMD_SAVE_STATE");
            break;
        case APP_CMD_INIT_WINDOW:
        	__android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "APP_CMD_INIT_WINDOW");
            if(app->window && gRoot)
            {
                AConfiguration* config = AConfiguration_new();
                AConfiguration_fromAssetManager(config, app->activity->assetManager);
                gAssetMgr = app->activity->assetManager;
				
                if(!gRenderWnd)
                {
				    Ogre::ArchiveManager::getSingleton().addArchiveFactory( new Ogre::APKFileSystemArchiveFactory(app->activity->assetManager) );
					Ogre::ArchiveManager::getSingleton().addArchiveFactory( new Ogre::APKZipArchiveFactory(app->activity->assetManager) );
				
                    Ogre::NameValuePairList opt;
                    opt["externalWindowHandle"] = Ogre::StringConverter::toString((int)app->window);
                    opt["androidConfig"] = Ogre::StringConverter::toString((int)config);
                           
					gRenderWnd = gRoot->createRenderWindow("OgreWindow", 0, 0, false, &opt);
		
					setupScene();
                }
                else
                {
					static_cast<Ogre::AndroidEGLWindow*>(gRenderWnd)->_createInternalResources(app->window, config);
                }
                AConfiguration_delete(config);
            }
            break;
        case APP_CMD_TERM_WINDOW:
        	__android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "APP_CMD_TERM_WINDOW");
            if(gRoot && gRenderWnd)
				static_cast<Ogre::AndroidEGLWindow*>(gRenderWnd)->_destroyInternalResources();
            break;
        case APP_CMD_GAINED_FOCUS:
        	counter = 0.0f;
        	__android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "APP_CMD_GAINED_FOCUS");
            break;
        case APP_CMD_LOST_FOCUS:
        	__android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "APP_CMD_LOST_FOCUS");
            break;
    }
}





void android_main(struct android_app* state)
{
	__android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "android_main");
    app_dummy();
    
	if(gRoot == NULL)
	{
		gRoot = new Ogre::Root();
		Ogre::LogManager::getSingleton().getDefaultLog()->setLogDetail(
						Ogre::LL_BOREME);
#ifdef OGRE_STATIC_LIB
        gStaticPluginLoader = new Ogre::StaticPluginLoader();
        gStaticPluginLoader->load();
#endif
        gRoot->setRenderSystem(gRoot->getAvailableRenderers().at(0));
//        gRoot->setRenderSystem(new Ogre::GLES2RenderSystem());
        gRoot->initialise(false);
	}			

    state->onAppCmd = &handleCmd;
    state->onInputEvent = &handleInput;
    
    int ident, events;
    struct android_poll_source* source;
    
    while (true)
    {
        while ((ident = ALooper_pollAll(0, NULL, &events, (void**)&source)) >= 0)
        {
        	__android_log_print(ANDROID_LOG_VERBOSE, APPNAME, " ident = %d",ident);
            if (source != NULL){
                source->process(state, source);
            }
            
            if (state->destroyRequested != 0){
                return;
            }
        }
        
		if(gRenderWnd != NULL && gRenderWnd->isActive())
		{
			gRenderWnd->windowMovedOrResized();
			gRoot->renderOneFrame();

			camera->setPosition(0,0,10);
//			__android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "renderOneFrame i= %f",counter);
//			counter += 0.1f;
		}
    }
}
dozzer
Gnoblar
Posts: 3
Joined: Wed Apr 02, 2014 11:16 pm

Re: Problem with textures on Android

Post by dozzer »

Hello all.

Here is an archive with full souces.
https://www.dropbox.com/s/6hrz7qh1k6jmo ... tivity.zip
heweitykc
Gnoblar
Posts: 1
Joined: Sun Apr 20, 2014 4:02 pm

Re: Problem with textures on Android

Post by heweitykc »

there is same problem in my mtk machine. (lenovo s5000)