Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Graphic filter not working on device for Android 6.0.1 w/ Nvidia Shield (?)
Started by paul.cardwell Sep 26 2016 12:13 PM

9 replies to this topic
filter shadow blurgaussian linearwipe
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

paul.cardwell

[GLOBAL: userInfoPane.html]
paul.cardwell
  • Contributor

  • 142 posts
  • Corona SDK

I have been writing a UI library and noticed something today I was not expecting.   When using code like...

--
-- filter for shadow
--
function newShadowShape( shape, options )
  local g = display.newGroup()
  g.x, g.y = display.contentCenterX, display.contentCenterY

  local style = options.style or "filter.blurGaussian"
  local width, height = options.width, options.height
  local offsetX, offsetY = (options.offsetX or 0), (options.offsetY or 0)
  local size = options.size
  local cornerRadius = options.cornerRadius or 5
  local opacity = options.opacity

  if shape == "rect" then
    display.newRect( g, offsetX, offsetY, width+size, height+size ).fill = {1,1,1,0}
    display.newRect( g, offsetX, offsetY, width, height ).fill = {0,0,0}
  elseif shape == "rounded_rect" then
    display.newRoundedRect( g, offsetX, offsetY, width+size, height+size, cornerRadius ).fill = {1,1,1,0}
    display.newRoundedRect( g, offsetX, offsetY, width, height, cornerRadius ).fill = {0,0,0}
  elseif shape == "circle" then
    local radius = width * 0.5
    display.newCircle( g, offsetX, offsetY, radius * 1.5 ).fill = {1,1,1,0}
    display.newCircle( g, offsetX, offsetY, radius ).fill = {0,0,0}
  end

  local c = display.capture( g )
  g = display.remove( g )

  c.fill.effect = style
  if style == "filter.blurGaussian" then
    c.fill.effect.horizontal.blurSize = size
    c.fill.effect.horizontal.sigma = size
    c.fill.effect.vertical.blurSize = size
    c.fill.effect.vertical.sigma = size
  elseif style == "filter.linearWipe" then
    c.fill.effect.direction = { 1, 1 }
    c.fill.effect.smoothness = 1
    c.fill.effect.progress = 0.5
  end

  c.alpha = opacity or 0.3

  return c
end

local background = display.newRect( 0, 0, display.contentWidth, display.contentHeight)
    background.anchorX = 0
    background.anchorY = 0
    background.x, background.y = 0, 0
    background:setFillColor( 0, .74, .83 )

local shadow = newShadowShape("rect", {
    width = 200,
    height = 200,
    size = 20,
    opacity = 0.4,
})

shadow.x = 300
shadow.y = 200

 

In the simulator it works just great.  I create the APK for my Android 6.0.1 device and the effect doesn't show? Any clues as to why?  Do I need to enable anything?



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 22,046 posts
  • Corona Staff

It could be a highPrecision rendering problem. Have you tried adding the shaderPrecision variable to  your config.lua?
 

application =
{
	content =
	{
		width = 320,
		height = 480,
		scale = "letterbox",
                shaderPrecision = "highp"
	},
}


[TOPIC: post.html]
#3

paul.cardwell

[GLOBAL: userInfoPane.html]
paul.cardwell
  • Contributor

  • 142 posts
  • Corona SDK

I added the "shaderPrecision" but no change. :(   ..and thanks for the quick reply!

 

I will try this on a Nexus 7 2013 and see what it does.

 

I also submitted a bug ticket.



[TOPIC: post.html]
#4

paul.cardwell

[GLOBAL: userInfoPane.html]
paul.cardwell
  • Contributor

  • 142 posts
  • Corona SDK

..and it didn't work on Nexus 7 2013 w/ Android 6.0.1. 



[TOPIC: post.html]
#5

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 22,046 posts
  • Corona Staff

Any messages in the console log?



[TOPIC: post.html]
#6

paul.cardwell

[GLOBAL: userInfoPane.html]
paul.cardwell
  • Contributor

  • 142 posts
  • Corona SDK

How do I get the log from the App running on the device?  I think there is a "adb" android debugger from the command line, but I haven't used it.  Any tips/web pages would be good so I can get the log.



[TOPIC: post.html]
#7

paul.cardwell

[GLOBAL: userInfoPane.html]
paul.cardwell
  • Contributor

  • 142 posts
  • Corona SDK

Here is the log from the debugger on the device:

09-28 09:18:53.715   677  1192 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.anedix.cardwell.paul.cards/com.ansca.corona.CoronaActivity (has extras)} from uid 10011 on display 0
09-28 09:18:53.722  1154  1154 D ShieldTech_Services: Starting service
09-28 09:18:53.726   246   707 E nvaudio_hw: nvaudio_out_set_parameters: Could not find the usecase (0) in the list
09-28 09:18:53.726   677  1233 W BroadcastQueue: Permission Denial: broadcasting Intent { act=com.android.launcher3.action.LAUNCH flg=0x10 (has extras) } from com.android.launcher3 (pid=1260, uid=10011) requires com.google.android.launcher.permission.RECEIVE_LAUNCH_BROADCASTS due to receiver com.google.android.gms/.icing.proxy.ApplicationLauncherReceiver
09-28 09:18:53.727   677   690 W BroadcastQueue: Permission Denial: broadcasting Intent { act=com.android.launcher3.action.LAUNCH flg=0x10 (has extras) } from com.android.launcher3 (pid=1260, uid=10011) requires com.google.android.launcher.permission.RECEIVE_LAUNCH_BROADCASTS due to receiver com.google.android.googlequicksearchbox/com.google.android.apps.gsa.search.core.icingsync.ApplicationLaunchReceiver
09-28 09:18:53.730 31180 31192 W SearchService: Abort, client detached.
09-28 09:18:53.732 31180 31180 I MicroDetector: Keeping mic open: false
09-28 09:18:53.732 31180  2627 I AudioController: internalShutdown
09-28 09:18:53.732 31180  4471 I DeviceStateChecker: DeviceStateChecker cancelled
09-28 09:18:53.732 31180  2627 I MicrophoneInputStream: mic_close com.google.android.apps.gsa.speech.audio.ag@9050384
09-28 09:18:53.732 31180  1554 I MicroRecognitionRunner: Stopping hotword detection.
09-28 09:18:53.745   677   695 W ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.bindService:1287 com.nvidia.ControllerMapper.MapperClient$ServiceClient.connect:849 com.nvidia.ControllerMapper.MapperClient.<init>:111 android.view.ViewRootImpl.handleWindowActivated:905 android.view.ViewRootImpl$ViewRootHandler.handleMessage:3620
09-28 09:18:53.746 31180  4472 I MicroRecognitionRunner: Detection finished
09-28 09:18:53.748   677 11028 I ActivityManager: Start proc 4542:com.anedix.cardwell.paul.cards/u0a141 for activity com.anedix.cardwell.paul.cards/com.ansca.corona.CoronaActivity
09-28 09:18:53.828  4542  4542 I MultiDex: VM with version 2.1.0 has multidex support
09-28 09:18:53.828  4542  4542 I MultiDex: install
09-28 09:18:53.828  4542  4542 I MultiDex: VM has multidex support, MultiDex support library is disabled.
09-28 09:18:53.844 22966 22966 D QuickMenuService: IsTopFullScreen: true
09-28 09:18:53.879  4542  4542 I art     : Thread[1,tid=4542,Native,Thread*=0xb444a500,peer=0x73eb23b0,"main"] recursive attempt to load library "/data/app/com.anedix.cardwell.paul.cards-2/lib/arm/libjnlua5.1.so"
09-28 09:18:53.884  4542  4542 I OpenAL_SLES: alc_opensles_init
09-28 09:18:54.128  4542  4562 D OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
09-28 09:18:54.143  1154  1154 D RSMouse : mFeatureEnabled=true  mPackageEnabled=true
09-28 09:18:54.179  4542  4562 I OpenGLRenderer: Initialized EGL, version 1.4
09-28 09:18:54.286  4542  4558 V GLSurfaceView: glGetString(7937) returns NVIDIA Tegra;
09-28 09:18:54.316   677   695 I ActivityManager: Displayed com.anedix.cardwell.paul.cards/com.ansca.corona.CoronaActivity: +586ms
09-28 09:18:54.317  4542  4558 V Corona  : > Class.forName: network.LuaLoader
09-28 09:18:54.317  4542  4558 V Corona  : < Class.forName: network.LuaLoader
09-28 09:18:54.318  4542  4558 V Corona  : Loading via reflection: network.LuaLoader
09-28 09:18:54.326  4542  4558 I Corona  : Platform: SHIELD Tablet K1 / ARM Neon / 6.0.1 / NVIDIA Tegra / OpenGL ES 3.2 NVIDIA 361.00 / 2016.2963 / English | US | en_US | en
09-28 09:18:54.331 31180 31180 I MemoryTrimmer: Trimming objects from memory, since app is in the background.
09-28 09:18:54.350  4542  4558 E linker  : readlink('/proc/self/fd/41') failed: Permission denied [fd=41]
09-28 09:18:54.350  4542  4558 E linker  : warning: unable to get realpath for the library "/data/app/com.anedix.cardwell.paul.cards-2/lib/arm/liblicensing.so". Will use given name.
09-28 09:18:54.352  4542  4558 V Corona  : > Class.forName: CoronaProvider.licensing.google.LuaLoader
09-28 09:18:54.352  4542  4558 V Corona  : < Class.forName: CoronaProvider.licensing.google.LuaLoader
09-28 09:18:54.355  4542  4558 V Corona  : Loading via reflection: CoronaProvider.licensing.google.LuaLoader
09-28 09:18:54.747 31180 31180 I MemoryTrimmer: Trimming objects from memory, since app is in the background.
09-28 09:19:02.978   677   692 E BatteryStatsImpl: All kernel wakelocks had time of zero
09-28 09:19:02.979   677   692 E BatteryStatsImpl: All kernel wakelocks were set stale. new version=0
09-28 09:19:03.000  1110  1110 I DownloadManagerWrapper: onReceive() : Charging = true
09-28 09:19:03.015 31180 31180 I MemoryTrimmer: Trimming objects from memory, since app is in the background.
09-28 09:19:03.043   677   677 V NotificationService: pkg=mobi.infolife.taskmanager canInterrupt=false intercept=true
09-28 09:19:03.954 31180 31180 I MemoryTrimmer: Trimming objects from memory, since app is in the background.



[TOPIC: post.html]
#8

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 22,046 posts
  • Corona Staff

I see that you also filed a bug report on this. Our QA team verified it's a bug and it's been added to the bug tracker. I don't know when it will get worked on however.

 

Rob



[TOPIC: post.html]
#9

paul.cardwell

[GLOBAL: userInfoPane.html]
paul.cardwell
  • Contributor

  • 142 posts
  • Corona SDK

Thanks for chasing it down Rob. I am glad it wasn't just me.  I will continue forward with the UI library and see what alternative methods I can provide for shadows.



[TOPIC: post.html]
#10

paul.cardwell

[GLOBAL: userInfoPane.html]
paul.cardwell
  • Contributor

  • 142 posts
  • Corona SDK

Just thought I'd update..

 

After fiddling around and scanning the forums :).  I came up with a new solution for the shadow implementation.  The solution works in simulator, device and device suspend/resume (w/ textures intact).  It uses corona method display.newSnapshot() and attaches the event "applicationResume" for refreshing the shadow textures.

 

I can post an example if anyone wants to see it.  It has been implemented in the UI library I am making.




[topic_controls]
[/topic_controls]