Author Topic: ERROR: glAttachShader - vertex shader: glError 1280  (Read 24924 times)

Offline zammbi

  • float
  • ****
  • Posts: 361
    • View Profile
ERROR: glAttachShader - vertex shader: glError 1280
« on: October 15, 2013, 11:26:28 pm »
I noticed in our crash logs we are getting a "vertex shader: glError 1280" crash. Looking this up the error it is a GL_INVALID_ENUM.

This happens on the HTC One, Sony Xperia L and the Samsung S4, which I don't have access too. I have now updated the latest JPCT version (did you fix such an error in the past?), so I guess I'll soon see if such an error goes away once we release it. But I thought I'll log it in here in the meantime in case someone knows more about it.

Crash:

Code: [Select]
Package: nz.co.nuffie.android.crichq
Version: 2594
Android: 4.1.2
Manufacturer: HTC
Model: HTC One
Date: Sun Oct 13 13:44:59 MST 2013

java.lang.RuntimeException: [ 1381697099906 ] - ERROR: glAttachShader - vertex shader: glError 1280
at com.threed.jpct.Logger.log(Logger.java:189)
at com.threed.jpct.GLSLShader.checkError(GLSLShader.java:808)
at com.threed.jpct.GLSLShader.createProgram(GLSLShader.java:774)
at com.threed.jpct.GLSLShader.loadProgram(GLSLShader.java:766)
at com.threed.jpct.GLSLShader.preInit(GLSLShader.java:276)
at com.threed.jpct.GL20.setShader(GL20.java:336)
at com.threed.jpct.GLRenderer.setShader(GLRenderer.java:510)
at com.threed.jpct.GLRenderer.setLineShader(GLRenderer.java:2060)
at com.threed.jpct.GLRenderer.enableLineMode(GLRenderer.java:1978)
at com.threed.jpct.World.draw(World.java:1331)
at com.threed.jpct.World.draw(World.java:1083)
at nz.co.nuffie.android.crichq.ptichmapandwagonwheel.World3dBase.renderWorld(World3dBase.java:734)
at nz.co.nuffie.android.crichq.ptichmapandwagonwheel.World3dBase.onDrawFrame(World3dBase.java:791)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1516)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

Log:
Quote
DEBUG PhoneRank : Runtime.getRuntime().maxMemory:      384 Mb
Runtime.getRuntime().freeMemory:      1 Mb
Runtime.getRuntime().totalMemory:      28 Mb
Debug.getNativeHeapAllocatedSize:      50 Mb
Debug.getNativeHeapFreeSize:         0 Mb
Debug.getNativeHeapSize:            50 Mb
Debug.getThreadAllocSize:            0 Kb
Debug.getGlobalAllocSize:            0 Kb
Debug.getGlobalFreedSize:            0 Kb
memoryInfo.getTotalPss:            140 Mb
memoryInfo.getTotalPrivateDirty:      128 Mb
memoryInfo.getTotalSharedDirty:      39 Mb
memoryInfo.dalvikPss:               28 Mb
memoryInfo.dalvikPrivateDirty:         28 Mb
memoryInfo.nativePss:               0 Mb
memoryInfo.nativePrivateDirty:         0 Mb
JPCT texture usage:               1 Kb
Memory Left:                     307 Mb
Memory Left (based on Pss):         244 Mb
activityManager.getMemoryClass:      192 Mb
CPU Cores Free:                  2
DEBUG PhoneRank : Max Mem: 384 Mem Left:307
DEBUG PhoneRank : Very high ram free.
DEBUG WW : Turning on AA with transparency.
DEBUG WW : Using OpenGL 2.0
DEBUG GoogleAnalyticsActivity : Not a tracked activity
DEBUG OnlineViewWorld3dActivity : ON RUNNING
DEBUG PhoneRank : Checking Model: HTC One
DEBUG nz.co.nuffie.android.crichq.ptichmapandwagonwheel.OnlineViewWorld3dActivity$1 : SERVICE CONNECTED
DEBUG WWPollTask : RUNNING: true
DEBUG OnlineViewWorld3dActivity : URL: http://www.crichq.com/mobile/matches/live_matches/68921/wagon_wheel
DEBUG CricHQService : Http Response Code: 0
DEBUG 3d : World is null. Creating...
DEBUG PhoneRank : Using hardware renderer (Not PixelFlinger): Adreno (TM) 320
DEBUG PhoneRank : Max Mem: 384 Mem Left:300
DEBUG PhoneRank : Very high ram free.
DEBUG 3d : Change camera view to: PITCH_MAP
VERBOSE CricHQCrashManagerListener : Getting username for crash report...
DEBUG CricHQCrashManagerListener : Sending crash report to hockey...

Phone Stats:
Runtime.getRuntime().maxMemory:      384 Mb
Runtime.getRuntime().freeMemory:      7 Mb
Runtime.getRuntime().totalMemory:      49 Mb
Debug.getNativeHeapAllocatedSize:      49 Mb
Debug.getNativeHeapFreeSize:         5 Mb
Debug.getNativeHeapSize:            55 Mb
Debug.getThreadAllocSize:            0 Kb
Debug.getGlobalAllocSize:            0 Kb
Debug.getGlobalFreedSize:            0 Kb
memoryInfo.getTotalPss:            165 Mb
memoryInfo.getTotalPrivateDirty:      152 Mb
memoryInfo.getTotalSharedDirty:      39 Mb
memoryInfo.dalvikPss:               49 Mb
memoryInfo.dalvikPrivateDirty:         49 Mb
memoryInfo.nativePss:               0 Mb
memoryInfo.nativePrivateDirty:         0 Mb
JPCT texture usage:               8195 Kb
Memory Left:                     292 Mb
Memory Left (based on Pss):         219 Mb
activityManager.getMemoryClass:      192 Mb
CPU Cores Free:                  2

« Last Edit: October 15, 2013, 11:31:08 pm by zammbi »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: ERROR: glAttachShader - vertex shader: glError 1280
« Reply #1 on: October 15, 2013, 11:58:36 pm »
You have no device to test this on or just no S4? I remember some problem in that domain, but i'm not sure if it was this particular one. The funny thing is, that the call that is associated with this error doesn't even raise this kind of errors. Must be something between this call and the last error check then...!?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: ERROR: glAttachShader - vertex shader: glError 1280
« Reply #2 on: October 16, 2013, 12:04:00 am »
If it's not fixed with the new version and you haven't already, consider to try the latest beta from here: http://jpct.de/download/beta/jpct_ae.jar

Offline zammbi

  • float
  • ****
  • Posts: 361
    • View Profile
Re: ERROR: glAttachShader - vertex shader: glError 1280
« Reply #3 on: October 16, 2013, 12:39:30 am »
Quote
You have no device to test this on or just no S4?
I don't have any of the newer devices that this crash happen on. It might happen after I change the camera POV.

It's odd that it happens only on these newer devices. Has something changed in the newer chips?
They might of broken something with OpenGL ES 3?
All the devices I listed above support OpenGL 3.0: http://en.wikipedia.org/wiki/OpenGL_ES

Quote
If it's not fixed with the new version and you haven't already, consider to try the latest beta from here: http://jpct.de/download/beta/jpct_ae.jar
Thanks. I guess I'll wait and see if it is fixed when we do the next update. The next release date is some time still.
« Last Edit: October 16, 2013, 03:18:56 am by zammbi »

Offline rainfalls

  • byte
  • *
  • Posts: 27
    • View Profile
Re: ERROR: glAttachShader - vertex shader: glError 1280
« Reply #4 on: November 11, 2013, 01:13:23 am »
Hi Egon,

I also encountered this error on my teclast pad (its OpenGL and hardware info is listed in the attached image 1). The program I tested was the AE vertion example of "HelloShader", which runs properly on my old Xperia Play (Android 2.3) as well as the new Nexus 7 2013. On this teclast pad it gives "ERROR: glAttachShader - vertex shader: glError 1280" while compling the shader as zammbi had on his devices.

With the lib you gave above (http://jpct.de/download/beta/jpct_ae.jar), the error was gone and the activity started successfully on this pad but it didn't show the right texture, as in the 2nd attached image. (With this new beta library, everything was still fine on Xperia Play).

[attachment deleted by admin]

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: ERROR: glAttachShader - vertex shader: glError 1280
« Reply #5 on: November 11, 2013, 08:25:18 am »
Could you please post the complete log output of that run?

Offline rainfalls

  • byte
  • *
  • Posts: 27
    • View Profile
Re: ERROR: glAttachShader - vertex shader: glError 1280
« Reply #6 on: November 11, 2013, 12:03:15 pm »
Here is the logcat. (By the way, I changed the Android project build target to 4.2.2. If it was kept to be original 2.3.3 as in the sample, even with the new beta lib, the sample program still crashed on the glError 1280.)
Code: [Select]
11-11 10:56:39.910: I/jPCT-AE(26933): onCreate
11-11 10:56:40.070: I/jPCT-AE(26933): onResume
11-11 10:56:40.260: D/libEGL(26933): loaded /vendor/lib/egl/libEGL_POWERVR_SGX544_115.so
11-11 10:56:40.300: D/libEGL(26933): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX544_115.so
11-11 10:56:40.310: D/libEGL(26933): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX544_115.so
11-11 10:56:40.440: D/OpenGLRenderer(26933): Enabling debug mode 0
11-11 10:56:40.460: D/libEGL(26933): Enabling MSAA 4x
11-11 10:56:40.460: D/libEGL(26933): Enabling MSAA 4x
11-11 10:56:40.530: I/jPCT-AE(26933): onSurfaceCreated
11-11 10:56:40.560: I/jPCT-AE(26933): GLRenderer created with id 0 on Thread[GLThread 2105,5,main]
11-11 10:56:40.560: I/jPCT-AE(26933): GL context is 1116808864
11-11 10:56:40.570: I/jPCT-AE(26933): Initializing GL20 render pipeline...
11-11 10:56:40.570: I/jPCT-AE(26933): Accessing shaders via JAR!
11-11 10:56:40.570: I/jPCT-AE(26933): Loading default shaders !
11-11 10:56:40.570: I/jPCT-AE(26933): 0 shaders in replacement map!
11-11 10:56:40.570: I/jPCT-AE(26933): Default fragment shader is: /defaultFragmentShader.src
11-11 10:56:40.690: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:40.690: I/jPCT-AE(26933): Text file from InputStream loaded...2416 bytes
11-11 10:56:40.690: I/jPCT-AE(26933): Default vertex shader is: /defaultVertexShader.src
11-11 10:56:40.710: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:40.720: I/jPCT-AE(26933): Text file from InputStream loaded...4496 bytes
11-11 10:56:40.720: D/dalvikvm(26933): GC_CONCURRENT freed 178K, 13% free 8943K/10172K, paused 8ms+3ms, total 66ms
11-11 10:56:40.720: I/jPCT-AE(26933): Compiling shader program!
11-11 10:56:40.760: I/jPCT-AE(26933): Handles of 210003: 4/44/5
11-11 10:56:40.760: I/jPCT-AE(26933): Loading default shaders (Tex0Amb)!
11-11 10:56:40.760: I/jPCT-AE(26933): 0 shaders in replacement map!
11-11 10:56:40.760: I/jPCT-AE(26933): Default fragment shader is: /defaultFragmentShader.src
11-11 10:56:40.780: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:40.780: I/jPCT-AE(26933): Text file from InputStream loaded...199 bytes
11-11 10:56:40.780: I/jPCT-AE(26933): Default vertex shader is: /defaultVertexShader.src
11-11 10:56:40.780: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:40.780: I/jPCT-AE(26933): Text file from InputStream loaded...757 bytes
11-11 10:56:40.780: I/jPCT-AE(26933): Compiling shader program!
11-11 10:56:40.780: I/jPCT-AE(26933): Handles of 420006: 1/5/2
11-11 10:56:40.780: I/jPCT-AE(26933): Loading default shaders (Tex0)!
11-11 10:56:40.780: I/jPCT-AE(26933): 0 shaders in replacement map!
11-11 10:56:40.780: I/jPCT-AE(26933): Default fragment shader is: /defaultFragmentShader.src
11-11 10:56:40.790: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:40.790: I/jPCT-AE(26933): Text file from InputStream loaded...201 bytes
11-11 10:56:40.790: I/jPCT-AE(26933): Default vertex shader is: /defaultVertexShader.src
11-11 10:56:40.790: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:40.800: I/jPCT-AE(26933): Text file from InputStream loaded...4020 bytes
11-11 10:56:40.800: I/jPCT-AE(26933): Compiling shader program!
11-11 10:56:40.810: I/jPCT-AE(26933): Handles of 630009: 1/41/2
11-11 10:56:40.810: I/jPCT-AE(26933): Loading default shaders (Tex1)!
11-11 10:56:40.810: I/jPCT-AE(26933): 0 shaders in replacement map!
11-11 10:56:40.810: I/jPCT-AE(26933): Default fragment shader is: /defaultFragmentShader.src
11-11 10:56:40.810: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:40.810: I/jPCT-AE(26933): Text file from InputStream loaded...997 bytes
11-11 10:56:40.810: I/jPCT-AE(26933): Default vertex shader is: /defaultVertexShader.src
11-11 10:56:40.810: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:40.810: I/jPCT-AE(26933): Text file from InputStream loaded...4390 bytes
11-11 10:56:40.810: I/jPCT-AE(26933): Compiling shader program!
11-11 10:56:40.820: I/jPCT-AE(26933): Handles of 840012: 2/44/3
11-11 10:56:40.820: I/jPCT-AE(26933): Loading default shaders (Tex0Light0)!
11-11 10:56:40.820: I/jPCT-AE(26933): 0 shaders in replacement map!
11-11 10:56:40.820: I/jPCT-AE(26933): Default fragment shader is: /defaultFragmentShader.src
11-11 10:56:40.830: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:40.830: I/jPCT-AE(26933): Text file from InputStream loaded...201 bytes
11-11 10:56:40.830: I/jPCT-AE(26933): Default vertex shader is: /defaultVertexShader.src
11-11 10:56:40.830: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:40.840: I/jPCT-AE(26933): Text file from InputStream loaded...1293 bytes
11-11 10:56:40.840: I/jPCT-AE(26933): Compiling shader program!
11-11 10:56:40.840: I/jPCT-AE(26933): Handles of 1050015: 1/11/2
11-11 10:56:40.840: I/jPCT-AE(26933): Loading default shaders (Fog)!
11-11 10:56:40.840: I/jPCT-AE(26933): 0 shaders in replacement map!
11-11 10:56:40.840: I/jPCT-AE(26933): Default fragment shader is: /defaultFragmentShader.src
11-11 10:56:40.850: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:40.850: I/jPCT-AE(26933): Text file from InputStream loaded...328 bytes
11-11 10:56:40.850: I/jPCT-AE(26933): Default vertex shader is: /defaultVertexShader.src
11-11 10:56:40.850: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:40.850: I/jPCT-AE(26933): Text file from InputStream loaded...4267 bytes
11-11 10:56:40.850: I/jPCT-AE(26933): Compiling shader program!
11-11 10:56:40.860: I/jPCT-AE(26933): Handles of 1260018: 1/44/2
11-11 10:56:40.860: I/jPCT-AE(26933): Loading default shaders (FogLight0)!
11-11 10:56:40.860: I/jPCT-AE(26933): 0 shaders in replacement map!
11-11 10:56:40.860: I/jPCT-AE(26933): Default fragment shader is: /defaultFragmentShader.src
11-11 10:56:40.860: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:40.860: I/jPCT-AE(26933): Text file from InputStream loaded...328 bytes
11-11 10:56:40.860: I/jPCT-AE(26933): Default vertex shader is: /defaultVertexShader.src
11-11 10:56:40.870: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:40.870: I/jPCT-AE(26933): Text file from InputStream loaded...1608 bytes
11-11 10:56:40.870: I/jPCT-AE(26933): Compiling shader program!
11-11 10:56:40.870: I/jPCT-AE(26933): Handles of 1470021: 1/15/2
11-11 10:56:40.870: I/jPCT-AE(26933): Loading default shaders (Depth)!
11-11 10:56:40.870: I/jPCT-AE(26933): 0 shaders in replacement map!
11-11 10:56:40.870: I/jPCT-AE(26933): Default fragment shader is: /defaultFragmentShader.src
11-11 10:56:40.880: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:40.880: I/jPCT-AE(26933): Text file from InputStream loaded...745 bytes
11-11 10:56:40.880: I/jPCT-AE(26933): Default vertex shader is: /defaultVertexShader.src
11-11 10:56:40.880: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:40.880: I/jPCT-AE(26933): Text file from InputStream loaded...248 bytes
11-11 10:56:40.880: I/jPCT-AE(26933): Compiling shader program!
11-11 10:56:40.880: I/jPCT-AE(26933): Handles of 1680024: 1/1/-1
11-11 10:56:40.880: I/jPCT-AE(26933): GL20 render pipeline initialized!
11-11 10:56:40.880: I/jPCT-AE(26933): OpenGL vendor:     Imagination Technologies
11-11 10:56:40.880: I/jPCT-AE(26933): OpenGL renderer:   PowerVR SGX 544MP
11-11 10:56:40.880: I/jPCT-AE(26933): OpenGL version:    OpenGL ES 2.0 build 1.10@2379759
11-11 10:56:40.880: I/jPCT-AE(26933): OpenGL renderer initialized (using 2/8 texture stages)
11-11 10:56:40.890: I/jPCT-AE(26933): Loading Texture...
11-11 10:56:40.930: D/dalvikvm(26933): GC_FOR_ALLOC freed 150K, 12% free 9017K/10228K, paused 36ms, total 37ms
11-11 10:56:40.940: I/dalvikvm-heap(26933): Grow heap (frag case) to 10.335MB for 524304-byte allocation
11-11 10:56:40.970: D/dalvikvm(26933): GC_CONCURRENT freed <1K, 12% free 9529K/10744K, paused 4ms+1ms, total 22ms
11-11 10:56:40.970: D/dalvikvm(26933): WAIT_FOR_CONCURRENT_GC blocked 18ms
11-11 10:56:41.060: D/dalvikvm(26933): GC_FOR_ALLOC freed 21K, 12% free 9508K/10744K, paused 15ms, total 15ms
11-11 10:56:41.060: I/dalvikvm-heap(26933): Grow heap (frag case) to 11.315MB for 1048592-byte allocation
11-11 10:56:41.080: D/dalvikvm(26933): GC_FOR_ALLOC freed 0K, 11% free 10532K/11772K, paused 17ms, total 17ms
11-11 10:56:41.080: I/jPCT-AE(26933): Texture loaded...1048576 bytes/512*512 pixels!
11-11 10:56:41.100: I/jPCT-AE(26933): Loading Texture...
11-11 10:56:41.100: D/dalvikvm(26933): GC_CONCURRENT freed 512K, 15% free 10039K/11772K, paused 3ms+2ms, total 24ms
11-11 10:56:41.100: D/dalvikvm(26933): WAIT_FOR_CONCURRENT_GC blocked 3ms
11-11 10:56:41.110: I/dalvikvm-heap(26933): Grow heap (frag case) to 11.333MB for 524304-byte allocation
11-11 10:56:41.120: D/dalvikvm(26933): GC_FOR_ALLOC freed <1K, 11% free 10551K/11772K, paused 16ms, total 16ms
11-11 10:56:41.140: D/dalvikvm(26933): GC_CONCURRENT freed <1K, 11% free 10551K/11772K, paused 3ms+2ms, total 18ms
11-11 10:56:41.240: I/jPCT-AE(26933): onPause
11-11 10:56:41.280: D/dalvikvm(26933): GC_FOR_ALLOC freed 18K, 11% free 10533K/11772K, paused 15ms, total 15ms
11-11 10:56:41.290: I/dalvikvm-heap(26933): Grow heap (frag case) to 12.316MB for 1048592-byte allocation
11-11 10:56:41.300: D/dalvikvm(26933): GC_FOR_ALLOC freed 0K, 10% free 11557K/12800K, paused 15ms, total 15ms
11-11 10:56:41.300: I/jPCT-AE(26933): Texture loaded...1048576 bytes/512*512 pixels!
11-11 10:56:41.310: I/jPCT-AE(26933): Loading Texture...
11-11 10:56:41.320: D/dalvikvm(26933): GC_CONCURRENT freed 512K, 14% free 11576K/13316K, paused 2ms+1ms, total 22ms
11-11 10:56:41.390: D/dalvikvm(26933): GC_FOR_ALLOC freed 18K, 14% free 11558K/13316K, paused 14ms, total 14ms
11-11 10:56:41.390: I/dalvikvm-heap(26933): Grow heap (frag case) to 13.317MB for 1048592-byte allocation
11-11 10:56:41.410: D/dalvikvm(26933): GC_FOR_ALLOC freed <1K, 13% free 12582K/14344K, paused 15ms, total 15ms
11-11 10:56:41.410: I/jPCT-AE(26933): Texture loaded...1048576 bytes/512*512 pixels!
11-11 10:56:41.420: D/dalvikvm(26933): GC_CONCURRENT freed 514K, 16% free 12075K/14344K, paused 1ms+1ms, total 17ms
11-11 10:56:41.420: D/dalvikvm(26933): WAIT_FOR_CONCURRENT_GC blocked 9ms
11-11 10:56:41.430: I/dalvikvm-heap(26933): Grow heap (frag case) to 13.822MB for 1048592-byte allocation
11-11 10:56:41.450: D/dalvikvm(26933): GC_CONCURRENT freed <1K, 15% free 13099K/15372K, paused 5ms+2ms, total 20ms
11-11 10:56:41.450: D/dalvikvm(26933): WAIT_FOR_CONCURRENT_GC blocked 15ms
11-11 10:56:41.450: I/dalvikvm-heap(26933): Grow heap (frag case) to 14.822MB for 1048592-byte allocation
11-11 10:56:41.470: D/dalvikvm(26933): GC_FOR_ALLOC freed <1K, 14% free 14123K/16400K, paused 15ms, total 15ms
11-11 10:56:41.490: D/dalvikvm(26933): GC_FOR_ALLOC freed <1K, 14% free 14123K/16400K, paused 15ms, total 15ms
11-11 10:56:41.490: I/dalvikvm-heap(26933): Grow heap (frag case) to 15.822MB for 1048592-byte allocation
11-11 10:56:41.510: D/dalvikvm(26933): GC_FOR_ALLOC freed 0K, 14% free 15147K/17428K, paused 18ms, total 18ms
11-11 10:56:41.530: I/jPCT-AE(26933): Loading Texture...
11-11 10:56:41.530: I/jPCT-AE(26933): Texture loaded...4096 bytes/64*16 pixels!
11-11 10:56:41.530: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:41.530: I/jPCT-AE(26933): Text file from InputStream loaded...1438 bytes
11-11 10:56:41.530: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:41.530: I/jPCT-AE(26933): Text file from InputStream loaded...1209 bytes
11-11 10:56:41.530: I/jPCT-AE(26933): Normal vectors calculated in 0ms!
11-11 10:56:41.530: I/jPCT-AE(26933): Tangent vectors calculated in 0ms!
11-11 10:56:41.530: I/jPCT-AE(26933): Adding Lightsource: 0
11-11 10:56:41.530: I/jPCT-AE(26933): Memory usage before compacting: 15197 KB used out of 17428 KB. Max. memory available to the VM is 196608 KB.
11-11 10:56:41.560: D/dalvikvm(26933): GC_EXPLICIT freed 43K, 14% free 15155K/17428K, paused 3ms+4ms, total 33ms
11-11 10:56:41.590: D/dalvikvm(26933): GC_EXPLICIT freed <1K, 14% free 15154K/17428K, paused 2ms+4ms, total 29ms
11-11 10:56:41.740: I/jPCT-AE(26933): Memory usage after compacting: 15155 KB used out of 17428 KB. Max. memory available to the VM is 196608 KB.
11-11 10:56:41.750: I/jPCT-AE(26933): Subobject of object 0/object2 compiled to indexed fixed point data using 6/4 vertices in 2ms!
11-11 10:56:41.750: I/jPCT-AE(26933): Processing and uploading vertices of subobject of object 0/object2 took 2ms
11-11 10:56:41.750: I/jPCT-AE(26933): Object 0/object2 compiled to 1 subobjects in 3ms!
11-11 10:56:41.750: I/jPCT-AE(26933): Object 'object2' uses one texture set!
11-11 10:56:41.750: I/jPCT-AE(26933): Saving master Activity!
11-11 10:56:41.750: I/jPCT-AE(26933): Allocating native memory for 512*512 texture(true/false/false/false/): 524288 bytes!
11-11 10:56:41.750: I/jPCT-AE(26933): Creating texture buffer of size 131072
11-11 10:56:41.770: I/jPCT-AE(26933): New texture's id is: 70001
11-11 10:56:41.780: I/jPCT-AE(26933): Mipmaps generated by the GPU in 4ms
11-11 10:56:41.780: I/jPCT-AE(26933): New texture uploaded: com.threed.jpct.Texture@42950f70 in thread Thread[GLThread 2105,5,main]
11-11 10:56:41.780: I/jPCT-AE(26933): Allocating native memory for 512*512 texture(true/false/false/false/): 524288 bytes!
11-11 10:56:41.780: I/jPCT-AE(26933): Creating texture buffer of size 131072
11-11 10:56:41.800: D/dalvikvm(26933): GC_FOR_ALLOC freed 3085K, 25% free 13630K/17944K, paused 16ms, total 16ms
11-11 10:56:41.830: I/jPCT-AE(26933): New texture's id is: 140002
11-11 10:56:41.840: I/jPCT-AE(26933): Mipmaps generated by the GPU in 9ms
11-11 10:56:41.840: I/jPCT-AE(26933): New texture uploaded: com.threed.jpct.Texture@42922190 in thread Thread[GLThread 2105,5,main]
11-11 10:56:41.840: I/jPCT-AE(26933): Compiling shader program!
11-11 10:56:41.840: I/jPCT-AE(26933): Handles of 1890027: 3/10/1
11-11 10:56:41.840: I/jPCT-AE(26933): Creating buffers...
11-11 10:56:41.840: I/jPCT-AE(26933): VBO created for object 'object2'
11-11 10:56:41.850: I/jPCT-AE(26933): [ 1384167401860 ] - WARNING: Texture's size is 64/16, but textures should be square for OpenGL ES2.0! This may result in a black texture!
11-11 10:56:41.850: I/jPCT-AE(26933): Allocating native memory for 64*16 texture(true/false/false/false/): 2048 bytes!
11-11 10:56:41.850: I/jPCT-AE(26933): Creating texture buffer of size 512
11-11 10:56:41.850: I/jPCT-AE(26933): New texture's id is: 210003
11-11 10:56:41.850: I/jPCT-AE(26933): New texture uploaded: com.threed.jpct.Texture@429229c8 in thread Thread[GLThread 2105,5,main]
11-11 10:56:41.930: I/jPCT-AE(26933): onResume
11-11 10:56:41.930: D/libEGL(26933): Enabling MSAA 4x
11-11 10:56:41.930: D/libEGL(26933): Enabling MSAA 4x
11-11 10:56:41.990: I/jPCT-AE(26933): onSurfaceCreated
11-11 10:56:41.990: I/jPCT-AE(26933): Visibility lists disposed!
11-11 10:56:41.990: I/jPCT-AE(26933): [ 1384167402005 ] - WARNING: Unable to dispose gl related resources because the current context has changed!
11-11 10:56:41.990: I/jPCT-AE(26933): Renderer disposed!
11-11 10:56:41.990: I/jPCT-AE(26933): GLRenderer disposed with id 0 on Thread[GLThread 2105,5,main]
11-11 10:56:41.990: I/jPCT-AE(26933): GLRenderer created with id 1 on Thread[GLThread 2105,5,main]
11-11 10:56:41.990: I/jPCT-AE(26933): GL context is 1116940368
11-11 10:56:41.990: I/jPCT-AE(26933): Initializing GL20 render pipeline...
11-11 10:56:41.990: I/jPCT-AE(26933): Loading default shaders !
11-11 10:56:41.990: I/jPCT-AE(26933): 0 shaders in replacement map!
11-11 10:56:41.990: I/jPCT-AE(26933): Default fragment shader is: /defaultFragmentShader.src
11-11 10:56:42.000: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:42.000: I/jPCT-AE(26933): Text file from InputStream loaded...2416 bytes
11-11 10:56:42.000: I/jPCT-AE(26933): Default vertex shader is: /defaultVertexShader.src
11-11 10:56:42.000: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:42.020: I/jPCT-AE(26933): Text file from InputStream loaded...4496 bytes
11-11 10:56:42.020: I/jPCT-AE(26933): Compiling shader program!
11-11 10:56:42.030: I/jPCT-AE(26933): Handles of 210003: 4/44/5
11-11 10:56:42.030: I/jPCT-AE(26933): Loading default shaders (Tex0Amb)!
11-11 10:56:42.030: I/jPCT-AE(26933): 0 shaders in replacement map!
11-11 10:56:42.030: I/jPCT-AE(26933): Default fragment shader is: /defaultFragmentShader.src
11-11 10:56:42.030: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:42.030: I/jPCT-AE(26933): Text file from InputStream loaded...199 bytes
11-11 10:56:42.030: I/jPCT-AE(26933): Default vertex shader is: /defaultVertexShader.src
11-11 10:56:42.030: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:42.030: I/jPCT-AE(26933): Text file from InputStream loaded...757 bytes
11-11 10:56:42.030: I/jPCT-AE(26933): Compiling shader program!
11-11 10:56:42.030: I/jPCT-AE(26933): Handles of 420006: 1/5/2
11-11 10:56:42.030: I/jPCT-AE(26933): Loading default shaders (Tex0)!
11-11 10:56:42.030: I/jPCT-AE(26933): 0 shaders in replacement map!
11-11 10:56:42.040: I/jPCT-AE(26933): Default fragment shader is: /defaultFragmentShader.src
11-11 10:56:42.040: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:42.040: I/jPCT-AE(26933): Text file from InputStream loaded...201 bytes
11-11 10:56:42.040: I/jPCT-AE(26933): Default vertex shader is: /defaultVertexShader.src
11-11 10:56:42.040: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:42.040: I/jPCT-AE(26933): Text file from InputStream loaded...4020 bytes
11-11 10:56:42.040: I/jPCT-AE(26933): Compiling shader program!
11-11 10:56:42.040: I/jPCT-AE(26933): Handles of 630009: 1/41/2
11-11 10:56:42.040: I/jPCT-AE(26933): Loading default shaders (Tex1)!
11-11 10:56:42.040: I/jPCT-AE(26933): 0 shaders in replacement map!
11-11 10:56:42.040: I/jPCT-AE(26933): Default fragment shader is: /defaultFragmentShader.src
11-11 10:56:42.040: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:42.050: I/jPCT-AE(26933): Text file from InputStream loaded...997 bytes
11-11 10:56:42.050: I/jPCT-AE(26933): Default vertex shader is: /defaultVertexShader.src
11-11 10:56:42.050: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:42.050: I/jPCT-AE(26933): Text file from InputStream loaded...4390 bytes
11-11 10:56:42.050: I/jPCT-AE(26933): Compiling shader program!
11-11 10:56:42.050: I/jPCT-AE(26933): Handles of 840012: 2/44/3
11-11 10:56:42.050: I/jPCT-AE(26933): Loading default shaders (Tex0Light0)!
11-11 10:56:42.050: I/jPCT-AE(26933): 0 shaders in replacement map!
11-11 10:56:42.050: I/jPCT-AE(26933): Default fragment shader is: /defaultFragmentShader.src
11-11 10:56:42.050: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:42.050: I/jPCT-AE(26933): Text file from InputStream loaded...201 bytes
11-11 10:56:42.050: I/jPCT-AE(26933): Default vertex shader is: /defaultVertexShader.src
11-11 10:56:42.060: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:42.060: I/jPCT-AE(26933): Text file from InputStream loaded...1293 bytes
11-11 10:56:42.060: I/jPCT-AE(26933): Compiling shader program!
11-11 10:56:42.070: I/jPCT-AE(26933): Handles of 1050015: 1/11/2
11-11 10:56:42.070: I/jPCT-AE(26933): Loading default shaders (Fog)!
11-11 10:56:42.070: I/jPCT-AE(26933): 0 shaders in replacement map!
11-11 10:56:42.070: I/jPCT-AE(26933): Default fragment shader is: /defaultFragmentShader.src
11-11 10:56:42.070: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:42.080: I/jPCT-AE(26933): Text file from InputStream loaded...328 bytes
11-11 10:56:42.080: I/jPCT-AE(26933): Default vertex shader is: /defaultVertexShader.src
11-11 10:56:42.080: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:42.080: I/jPCT-AE(26933): Text file from InputStream loaded...4267 bytes
11-11 10:56:42.080: I/jPCT-AE(26933): Compiling shader program!
11-11 10:56:42.080: I/jPCT-AE(26933): Handles of 1260018: 1/44/2
11-11 10:56:42.080: I/jPCT-AE(26933): Loading default shaders (FogLight0)!
11-11 10:56:42.090: I/jPCT-AE(26933): 0 shaders in replacement map!
11-11 10:56:42.090: I/jPCT-AE(26933): Default fragment shader is: /defaultFragmentShader.src
11-11 10:56:42.100: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:42.100: I/jPCT-AE(26933): Text file from InputStream loaded...328 bytes
11-11 10:56:42.100: I/jPCT-AE(26933): Default vertex shader is: /defaultVertexShader.src
11-11 10:56:42.100: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:42.100: I/jPCT-AE(26933): Text file from InputStream loaded...1608 bytes
11-11 10:56:42.100: I/jPCT-AE(26933): Compiling shader program!
11-11 10:56:42.100: I/jPCT-AE(26933): Handles of 1470021: 1/15/2
11-11 10:56:42.100: I/jPCT-AE(26933): Loading default shaders (Depth)!
11-11 10:56:42.100: I/jPCT-AE(26933): 0 shaders in replacement map!
11-11 10:56:42.100: I/jPCT-AE(26933): Default fragment shader is: /defaultFragmentShader.src
11-11 10:56:42.110: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:42.110: I/jPCT-AE(26933): Text file from InputStream loaded...745 bytes
11-11 10:56:42.110: I/jPCT-AE(26933): Default vertex shader is: /defaultVertexShader.src
11-11 10:56:42.120: I/jPCT-AE(26933): Loading file from InputStream
11-11 10:56:42.120: I/jPCT-AE(26933): Text file from InputStream loaded...248 bytes
11-11 10:56:42.120: I/jPCT-AE(26933): Compiling shader program!
11-11 10:56:42.120: I/jPCT-AE(26933): Handles of 1680024: 1/1/-1
11-11 10:56:42.120: I/jPCT-AE(26933): GL20 render pipeline initialized!
11-11 10:56:42.120: I/jPCT-AE(26933): OpenGL vendor:     Imagination Technologies
11-11 10:56:42.120: I/jPCT-AE(26933): OpenGL renderer:   PowerVR SGX 544MP
11-11 10:56:42.120: I/jPCT-AE(26933): OpenGL version:    OpenGL ES 2.0 build 1.10@2379759
11-11 10:56:42.120: I/jPCT-AE(26933): OpenGL renderer initialized (using 2/8 texture stages)
11-11 10:56:42.130: I/jPCT-AE(26933): Allocating native memory for 512*512 texture(true/false/false/false/): 524288 bytes!
11-11 10:56:42.130: I/jPCT-AE(26933): Creating texture buffer of size 131072
11-11 10:56:42.160: D/dalvikvm(26933): GC_FOR_ALLOC freed 1186K, 24% free 13744K/17944K, paused 32ms, total 32ms
11-11 10:56:42.190: I/jPCT-AE(26933): New texture's id is: 70001
11-11 10:56:42.200: I/jPCT-AE(26933): Mipmaps generated by the GPU in 4ms
11-11 10:56:42.200: I/jPCT-AE(26933): New texture uploaded: com.threed.jpct.Texture@42950f70 in thread Thread[GLThread 2105,5,main]
11-11 10:56:42.200: I/jPCT-AE(26933): Allocating native memory for 512*512 texture(true/false/false/false/): 524288 bytes!
11-11 10:56:42.200: I/jPCT-AE(26933): Creating texture buffer of size 131072
11-11 10:56:42.230: I/jPCT-AE(26933): New texture's id is: 140002
11-11 10:56:42.230: I/jPCT-AE(26933): Mipmaps generated by the GPU in 4ms
11-11 10:56:42.230: I/jPCT-AE(26933): New texture uploaded: com.threed.jpct.Texture@42922190 in thread Thread[GLThread 2105,5,main]
11-11 10:56:42.230: I/jPCT-AE(26933): Recompiling shader because of context change!
11-11 10:56:42.230: I/jPCT-AE(26933): Compiling shader program!
11-11 10:56:42.230: I/jPCT-AE(26933): Handles of 1890027: 3/10/1
11-11 10:56:42.230: I/jPCT-AE(26933): OpenGL context has changed(2)...recovering for renderer 1/0!
11-11 10:56:42.230: I/jPCT-AE(26933): Creating buffers...
11-11 10:56:42.250: I/jPCT-AE(26933): [ 1384167402261 ] - WARNING: Texture's size is 64/16, but textures should be square for OpenGL ES2.0! This may result in a black texture!
11-11 10:56:42.250: I/jPCT-AE(26933): Allocating native memory for 64*16 texture(true/false/false/false/): 2048 bytes!
11-11 10:56:42.250: I/jPCT-AE(26933): Creating texture buffer of size 512
11-11 10:56:42.250: I/jPCT-AE(26933): New texture's id is: 210003
11-11 10:56:42.250: I/jPCT-AE(26933): New texture uploaded: com.threed.jpct.Texture@429229c8 in thread Thread[GLThread 2105,5,main]
11-11 10:56:42.300: D/dalvikvm(26933): GC_CONCURRENT freed 2115K, 27% free 13225K/17944K, paused 9ms+4ms, total 62ms
11-11 10:56:50.150: I/jPCT-AE(26933): onPause
« Last Edit: November 11, 2013, 03:03:02 pm by EgonOlsen »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: ERROR: glAttachShader - vertex shader: glError 1280
« Reply #7 on: November 11, 2013, 05:56:15 pm »
There's no error in this log output.

Offline rainfalls

  • byte
  • *
  • Posts: 27
    • View Profile
Re: ERROR: glAttachShader - vertex shader: glError 1280
« Reply #8 on: November 11, 2013, 06:27:23 pm »
When I

(1) used the new beta lib you linked above in the HelloShader sample,
AND
(2) changed the Android project build target to 4.2.2,

the results were:

(1) the activity of the sample program could be started without error on my teclast pad (the previously listed log),
BUT
(2) the texture of the rendered object was not correct, as shown in the second image in my first post.

And, if I:

(1) used the old lib (jpct-ae.1.27.2013.07.04) in the HelloShader sample,
OR
(2) set android project build target back to 2.3.3 as originally in the sample souce code,

then the activity of the program could not be started with the compling shader error "ERROR: glAttachShader - vertex shader: glError 1280". Do you need the log in those two situations?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: ERROR: glAttachShader - vertex shader: glError 1280
« Reply #9 on: November 11, 2013, 08:52:53 pm »
I see. And i really dislike Android's Activity management. It's not clear to me what it does there...there are some devices out there that do strange things. I'm not sure if that the root cause for the problem, but this one behaves strange anyway. It calls onSurfaceChanged twice, an onPause inbetween and onResume after the it is done with the first onSurfaceChanged. That doesn't make any sense...

However, i've changed the example to behave like my RPG game does. Please give it a try and see if that changes something:

Code: [Select]
package com.threed.jpct.shader;

import java.lang.reflect.Field;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

import android.app.Activity;
import android.content.res.Resources;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.ScaleGestureDetector.OnScaleGestureListener;

import com.threed.jpct.Camera;
import com.threed.jpct.FrameBuffer;
import com.threed.jpct.GLSLShader;
import com.threed.jpct.ITextureEffect;
import com.threed.jpct.Light;
import com.threed.jpct.Loader;
import com.threed.jpct.Logger;
import com.threed.jpct.Object3D;
import com.threed.jpct.Primitives;
import com.threed.jpct.RGBColor;
import com.threed.jpct.SimpleVector;
import com.threed.jpct.Texture;
import com.threed.jpct.TextureInfo;
import com.threed.jpct.TextureManager;
import com.threed.jpct.World;
import com.threed.jpct.util.MemoryHelper;

/**
 *
 *
 * @author EgonOlsen
 *
 */
public class HelloShader extends Activity implements OnScaleGestureListener {

// Used to handle pause and resume...
private static HelloShader master = null;

private ScaleGestureDetector gestureDec = null;

private GLSurfaceView mGLView;
private MyRenderer renderer = null;
private FrameBuffer fb = null;
private World world = null;
private RGBColor back = new RGBColor(50, 50, 100);

private float touchTurn = 0;
private float touchTurnUp = 0;

private float xpos = -1;
private float ypos = -1;

private Texture font = null;

private Object3D plane;
private Light light;

private GLSLShader shader = null;

private float scale = 0.05f;

protected void onCreate(Bundle savedInstanceState) {
Logger.log("onCreate");
Logger.setLogLevel(Logger.LL_DEBUG);

if (master != null) {
copy(master);
}

super.onCreate(savedInstanceState);
mGLView = new GLSurfaceView(getApplication());

// Enable the OpenGL ES2.0 context
mGLView.setEGLContextClientVersion(2);

renderer = new MyRenderer();
mGLView.setRenderer(renderer);
setContentView(mGLView);

gestureDec = new ScaleGestureDetector(this.getApplicationContext(), this);
}

@Override
protected void onPause() {
Logger.log("onPause");
super.onPause();
mGLView.onPause();
}

@Override
protected void onResume() {
Logger.log("onResume");
super.onResume();
mGLView.onResume();
}

@Override
protected void onStop() {
Logger.log("onStop");
super.onStop();
}

private void copy(Object src) {
try {
Logger.log("Copying data from master Activity!");
Field[] fs = src.getClass().getDeclaredFields();
for (Field f : fs) {
f.setAccessible(true);
f.set(this, f.get(src));
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}

public boolean onTouchEvent(MotionEvent me) {

gestureDec.onTouchEvent(me);

if (me.getAction() == MotionEvent.ACTION_DOWN) {
xpos = me.getX();
ypos = me.getY();
return true;
}

if (me.getAction() == MotionEvent.ACTION_UP) {
xpos = -1;
ypos = -1;
touchTurn = 0;
touchTurnUp = 0;
return true;
}

if (me.getAction() == MotionEvent.ACTION_MOVE) {
float xd = me.getX() - xpos;
float yd = me.getY() - ypos;

xpos = me.getX();
ypos = me.getY();

touchTurn = xd / -100f;
touchTurnUp = yd / -100f;
return true;
}

try {
Thread.sleep(15);
} catch (Exception e) {
// No need for this...
}

return super.onTouchEvent(me);
}

protected boolean isFullscreenOpaque() {
return true;
}

class MyRenderer implements GLSurfaceView.Renderer {

private boolean hasToCreateBuffer = false;
private GL10 lastInstance = null;
private int w = 0;
private int h = 0;
private int fps = 0;
private int lfps = 0;

private long time = System.currentTimeMillis();

public MyRenderer() {
Texture.defaultToMipmapping(true);
Texture.defaultTo4bpp(true);
}

public void onSurfaceChanged(GL10 gl, int width, int height) {
Resources res = getResources();

if (master == null) {
Logger.log("Initializing buffer...");
fb = new FrameBuffer(width, height);

Logger.log("Initializing game...");
world = new World();

TextureManager tm = TextureManager.getInstance();

Texture face = new Texture(res.openRawResource(R.raw.face));
Texture normals = new Texture(res.openRawResource(R.raw.face_norm), true);
Texture heighty = new Texture(res.openRawResource(R.raw.face_height2));

plane = Primitives.getPlane(1, 100);

TexelGrabber grabber = new TexelGrabber();
heighty.setEffect(grabber);
heighty.applyEffect();
int[] heighties = grabber.getAlpha();

AlphaMerger setter = new AlphaMerger(heighties);
normals.setEffect(setter);
normals.applyEffect();

font = new Texture(res.openRawResource(R.raw.numbers));
font.setMipmap(false);

tm.addTexture("face", face);
tm.addTexture("normals", normals);

TextureInfo ti = new TextureInfo(TextureManager.getInstance().getTextureID("face"));
ti.add(TextureManager.getInstance().getTextureID("normals"), TextureInfo.MODE_BLEND);

plane.setTexture(ti);

shader = new GLSLShader(Loader.loadTextFile(res.openRawResource(R.raw.vertexshader_offset)), Loader.loadTextFile(res.openRawResource(R.raw.fragmentshader_offset)));
plane.setShader(shader);
plane.setSpecularLighting(true);
shader.setStaticUniform("invRadius", 0.0003f);

plane.build();
plane.strip();

world.addObject(plane);

light = new Light(world);
light.enable();

light.setIntensity(60, 50, 50);
light.setPosition(SimpleVector.create(-10, -50, -100));

world.setAmbientLight(10, 10, 10);

Camera cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEOUT, 70);
cam.lookAt(plane.getTransformedCenter());

MemoryHelper.compact();

world.compileAllObjects();

if (master == null) {
Logger.log("Saving master Activity!");
master = HelloShader.this;
}
} else {
if (lastInstance != gl) {
Logger.log("Setting buffer creation flag...");
this.hasToCreateBuffer = true;
w = width;
h = height;
}
}
lastInstance = gl;
}

public void onSurfaceCreated(GL10 gl, EGLConfig config) {
Logger.log("onSurfaceCreated");
}

public void onDrawFrame(GL10 gl) {

if (this.hasToCreateBuffer) {
Logger.log("Recreating buffer...");
hasToCreateBuffer = false;
fb = new FrameBuffer(w, h);
}

if (touchTurn != 0) {
plane.rotateY(touchTurn);
touchTurn = 0;
}

if (touchTurnUp != 0) {
plane.rotateX(touchTurnUp);
touchTurnUp = 0;
}

shader.setUniform("heightScale", scale);

fb.clear(back);
world.renderScene(fb);
world.draw(fb);
blitNumber(lfps, 5, 5);
fb.display();

if (System.currentTimeMillis() - time >= 1000) {
lfps = fps;
fps = 0;
time = System.currentTimeMillis();
}
fps++;
}

private void blitNumber(int number, int x, int y) {
if (font != null) {
String sNum = Integer.toString(number);

for (int i = 0; i < sNum.length(); i++) {
char cNum = sNum.charAt(i);
int iNum = cNum - 48;
fb.blit(font, iNum * 5, 0, x, y, 5, 9, 5, 9, 10, true, null);
x += 5;
}
}
}
}

public boolean onScale(ScaleGestureDetector detector) {
float div = detector.getCurrentSpan() - detector.getPreviousSpan();
div /= 5000;

scale += div;

if (scale > 0.063f) {
scale = 0.063f;
}
if (scale < 0) {
scale = 0;
}

return true;
}

public boolean onScaleBegin(ScaleGestureDetector detector) {
// TODO Auto-generated method stub
return true;
}

public void onScaleEnd(ScaleGestureDetector detector) {
// TODO Auto-generated method stub
}

/**
* Merges the height map into the alpha channel of the normal map.
*
* @author EgonOlsen
*
*/
private static class AlphaMerger implements ITextureEffect {

private int[] alpha = null;

public AlphaMerger(int[] alpha) {
this.alpha = alpha;
}

public void apply(int[] arg0, int[] arg1) {
int end = arg1.length;
for (int i = 0; i < end; i++) {
arg0[i] = arg1[i] & 0x00ffffff | alpha[i];
}
}

public boolean containsAlpha() {
return true;
}

public void init(Texture arg0) {
// TODO Auto-generated method stub
}
}

/**
* Extracts the alpha channel from a texture.
*
* @author EgonOlsen
*
*/
private static class TexelGrabber implements ITextureEffect {

private int[] alpha = null;

public void apply(int[] arg0, int[] arg1) {
alpha = new int[arg1.length];
int end = arg1.length;
for (int i = 0; i < end; i++) {
alpha[i] = (arg1[i] << 24);
}
}

public int[] getAlpha() {
return alpha;
}

public boolean containsAlpha() {
return true;
}

public void init(Texture arg0) {
// TODO Auto-generated method stub
}
}
}


Offline rainfalls

  • byte
  • *
  • Posts: 27
    • View Profile
Re: ERROR: glAttachShader - vertex shader: glError 1280
« Reply #10 on: November 11, 2013, 09:43:11 pm »
Hi Egon, unfortunately, I still had the same grey texture on this pad with your new java src codes (new beta jpct-ae lib + 4.2.2 android project build target), and it worked well on the old Xperia Play again.

I'll make a simpler shader to have a further check with your new lib if I can find some spare time tomorrow.

Attached the new log if you are interested:

Code: [Select]
11-11 20:26:58.010: I/jPCT-AE(31516): onCreate
11-11 20:26:58.010: I/jPCT-AE(31516): Copying data from master Activity!
11-11 20:26:58.020: I/jPCT-AE(31516): onResume
11-11 20:26:58.090: D/libEGL(31516): Enabling MSAA 4x
11-11 20:26:58.090: D/libEGL(31516): Enabling MSAA 4x
11-11 20:26:58.160: I/jPCT-AE(31516): onSurfaceCreated
11-11 20:26:58.160: I/jPCT-AE(31516): Setting buffer creation flag...
11-11 20:26:58.160: I/jPCT-AE(31516): Recreating buffer...
11-11 20:26:58.160: I/jPCT-AE(31516): GLRenderer created with id 2 on Thread[GLThread 2248,5,main]
11-11 20:26:58.160: I/jPCT-AE(31516): GL context is 1121456288
11-11 20:26:58.160: I/jPCT-AE(31516): Initializing GL20 render pipeline...
11-11 20:26:58.160: I/jPCT-AE(31516): Loading default shaders !
11-11 20:26:58.160: I/jPCT-AE(31516): 0 shaders in replacement map!
11-11 20:26:58.160: I/jPCT-AE(31516): Default fragment shader is: /defaultFragmentShader.src
11-11 20:26:58.160: I/jPCT-AE(31516): Loading file from InputStream
11-11 20:26:58.170: I/jPCT-AE(31516): Text file from InputStream loaded...2416 bytes
11-11 20:26:58.170: I/jPCT-AE(31516): Default vertex shader is: /defaultVertexShader.src
11-11 20:26:58.170: I/jPCT-AE(31516): Loading file from InputStream
11-11 20:26:58.170: I/jPCT-AE(31516): Text file from InputStream loaded...4496 bytes
11-11 20:26:58.170: I/jPCT-AE(31516): Compiling shader program!
11-11 20:26:58.200: I/jPCT-AE(31516): Handles of 210003: 4/44/5
11-11 20:26:58.200: I/jPCT-AE(31516): Loading default shaders (Tex0Amb)!
11-11 20:26:58.200: I/jPCT-AE(31516): 0 shaders in replacement map!
11-11 20:26:58.200: I/jPCT-AE(31516): Default fragment shader is: /defaultFragmentShader.src
11-11 20:26:58.210: I/jPCT-AE(31516): Loading file from InputStream
11-11 20:26:58.210: I/jPCT-AE(31516): Text file from InputStream loaded...199 bytes
11-11 20:26:58.210: I/jPCT-AE(31516): Default vertex shader is: /defaultVertexShader.src
11-11 20:26:58.220: I/jPCT-AE(31516): Loading file from InputStream
11-11 20:26:58.220: I/jPCT-AE(31516): Text file from InputStream loaded...757 bytes
11-11 20:26:58.220: I/jPCT-AE(31516): Compiling shader program!
11-11 20:26:58.230: I/jPCT-AE(31516): Handles of 420006: 1/5/2
11-11 20:26:58.230: I/jPCT-AE(31516): Loading default shaders (Tex0)!
11-11 20:26:58.230: I/jPCT-AE(31516): 0 shaders in replacement map!
11-11 20:26:58.230: I/jPCT-AE(31516): Default fragment shader is: /defaultFragmentShader.src
11-11 20:26:58.230: I/jPCT-AE(31516): Loading file from InputStream
11-11 20:26:58.240: I/jPCT-AE(31516): Text file from InputStream loaded...201 bytes
11-11 20:26:58.240: I/jPCT-AE(31516): Default vertex shader is: /defaultVertexShader.src
11-11 20:26:58.240: I/jPCT-AE(31516): Loading file from InputStream
11-11 20:26:58.240: I/jPCT-AE(31516): Text file from InputStream loaded...4020 bytes
11-11 20:26:58.240: I/jPCT-AE(31516): Compiling shader program!
11-11 20:26:58.250: I/jPCT-AE(31516): Handles of 630009: 1/41/2
11-11 20:26:58.250: I/jPCT-AE(31516): Loading default shaders (Tex1)!
11-11 20:26:58.250: I/jPCT-AE(31516): 0 shaders in replacement map!
11-11 20:26:58.250: I/jPCT-AE(31516): Default fragment shader is: /defaultFragmentShader.src
11-11 20:26:58.260: I/jPCT-AE(31516): Loading file from InputStream
11-11 20:26:58.260: I/jPCT-AE(31516): Text file from InputStream loaded...997 bytes
11-11 20:26:58.260: I/jPCT-AE(31516): Default vertex shader is: /defaultVertexShader.src
11-11 20:26:58.260: I/jPCT-AE(31516): Loading file from InputStream
11-11 20:26:58.270: I/jPCT-AE(31516): Text file from InputStream loaded...4390 bytes
11-11 20:26:58.270: I/jPCT-AE(31516): Compiling shader program!
11-11 20:26:58.270: I/jPCT-AE(31516): Handles of 840012: 2/44/3
11-11 20:26:58.270: I/jPCT-AE(31516): Loading default shaders (Tex0Light0)!
11-11 20:26:58.270: I/jPCT-AE(31516): 0 shaders in replacement map!
11-11 20:26:58.270: I/jPCT-AE(31516): Default fragment shader is: /defaultFragmentShader.src
11-11 20:26:58.280: I/jPCT-AE(31516): Loading file from InputStream
11-11 20:26:58.280: I/jPCT-AE(31516): Text file from InputStream loaded...201 bytes
11-11 20:26:58.280: I/jPCT-AE(31516): Default vertex shader is: /defaultVertexShader.src
11-11 20:26:58.290: I/jPCT-AE(31516): Loading file from InputStream
11-11 20:26:58.300: I/jPCT-AE(31516): Text file from InputStream loaded...1293 bytes
11-11 20:26:58.300: I/jPCT-AE(31516): Compiling shader program!
11-11 20:26:58.300: I/jPCT-AE(31516): Handles of 1050015: 1/11/2
11-11 20:26:58.300: I/jPCT-AE(31516): Loading default shaders (Fog)!
11-11 20:26:58.300: I/jPCT-AE(31516): 0 shaders in replacement map!
11-11 20:26:58.300: I/jPCT-AE(31516): Default fragment shader is: /defaultFragmentShader.src
11-11 20:26:58.310: I/jPCT-AE(31516): Loading file from InputStream
11-11 20:26:58.310: I/jPCT-AE(31516): Text file from InputStream loaded...328 bytes
11-11 20:26:58.310: I/jPCT-AE(31516): Default vertex shader is: /defaultVertexShader.src
11-11 20:26:58.310: I/jPCT-AE(31516): Loading file from InputStream
11-11 20:26:58.310: I/jPCT-AE(31516): Text file from InputStream loaded...4267 bytes
11-11 20:26:58.320: I/jPCT-AE(31516): Compiling shader program!
11-11 20:26:58.320: I/jPCT-AE(31516): Handles of 1260018: 1/44/2
11-11 20:26:58.320: I/jPCT-AE(31516): Loading default shaders (FogLight0)!
11-11 20:26:58.320: I/jPCT-AE(31516): 0 shaders in replacement map!
11-11 20:26:58.320: I/jPCT-AE(31516): Default fragment shader is: /defaultFragmentShader.src
11-11 20:26:58.330: I/jPCT-AE(31516): Loading file from InputStream
11-11 20:26:58.330: I/jPCT-AE(31516): Text file from InputStream loaded...328 bytes
11-11 20:26:58.330: I/jPCT-AE(31516): Default vertex shader is: /defaultVertexShader.src
11-11 20:26:58.330: I/jPCT-AE(31516): Loading file from InputStream
11-11 20:26:58.330: I/jPCT-AE(31516): Text file from InputStream loaded...1608 bytes
11-11 20:26:58.330: I/jPCT-AE(31516): Compiling shader program!
11-11 20:26:58.340: I/jPCT-AE(31516): Handles of 1470021: 1/15/2
11-11 20:26:58.340: I/jPCT-AE(31516): Loading default shaders (Depth)!
11-11 20:26:58.340: I/jPCT-AE(31516): 0 shaders in replacement map!
11-11 20:26:58.340: I/jPCT-AE(31516): Default fragment shader is: /defaultFragmentShader.src
11-11 20:26:58.340: I/jPCT-AE(31516): Loading file from InputStream
11-11 20:26:58.350: I/jPCT-AE(31516): Text file from InputStream loaded...745 bytes
11-11 20:26:58.350: I/jPCT-AE(31516): Default vertex shader is: /defaultVertexShader.src
11-11 20:26:58.350: I/jPCT-AE(31516): Loading file from InputStream
11-11 20:26:58.350: I/jPCT-AE(31516): Text file from InputStream loaded...248 bytes
11-11 20:26:58.350: I/jPCT-AE(31516): Compiling shader program!
11-11 20:26:58.350: I/jPCT-AE(31516): Handles of 1680024: 1/1/-1
11-11 20:26:58.360: I/jPCT-AE(31516): GL20 render pipeline initialized!
11-11 20:26:58.360: I/jPCT-AE(31516): OpenGL vendor:     Imagination Technologies
11-11 20:26:58.360: I/jPCT-AE(31516): OpenGL renderer:   PowerVR SGX 544MP
11-11 20:26:58.360: I/jPCT-AE(31516): OpenGL version:    OpenGL ES 2.0 build 1.10@2379759
11-11 20:26:58.360: I/jPCT-AE(31516): OpenGL renderer initialized (using 2/8 texture stages)
11-11 20:26:58.360: I/jPCT-AE(31516): Creating new matrix cache!
11-11 20:26:58.360: I/jPCT-AE(31516): Allocating native memory for 512*512 texture(true/false/false/false/): 524288 bytes!
11-11 20:26:58.370: I/jPCT-AE(31516): Creating texture buffer of size 131072
11-11 20:26:58.400: I/jPCT-AE(31516): New texture's id is: 70001
11-11 20:26:58.410: I/jPCT-AE(31516): Mipmaps generated by the GPU in 9ms
11-11 20:26:58.410: I/jPCT-AE(31516): New texture uploaded: com.threed.jpct.Texture@42953c98 in thread Thread[GLThread 2248,5,main]
11-11 20:26:58.410: I/jPCT-AE(31516): Allocating native memory for 512*512 texture(true/false/false/false/): 524288 bytes!
11-11 20:26:58.460: D/dalvikvm(31516): GC_FOR_ALLOC freed 1244K, 24% free 13265K/17404K, paused 44ms, total 44ms
11-11 20:26:58.460: I/jPCT-AE(31516): Creating texture buffer of size 131072
11-11 20:26:58.490: I/jPCT-AE(31516): New texture's id is: 140002
11-11 20:26:58.500: I/jPCT-AE(31516): Mipmaps generated by the GPU in 9ms
11-11 20:26:58.500: I/jPCT-AE(31516): New texture uploaded: com.threed.jpct.Texture@429152a8 in thread Thread[GLThread 2248,5,main]
11-11 20:26:58.500: I/jPCT-AE(31516): Recompiling shader because of context change!
11-11 20:26:58.500: I/jPCT-AE(31516): Compiling shader program!
11-11 20:26:58.500: I/jPCT-AE(31516): Handles of 1890027: 3/10/1
11-11 20:26:58.500: I/jPCT-AE(31516): OpenGL context has changed(2)...recovering for renderer 2/1!
11-11 20:26:58.500: I/jPCT-AE(31516): Creating buffers...
11-11 20:26:58.510: I/jPCT-AE(31516): [ 1384201618525 ] - WARNING: Texture's size is 64/16, but textures should be square for OpenGL ES2.0! This may result in a black texture!
11-11 20:26:58.510: I/jPCT-AE(31516): Allocating native memory for 64*16 texture(true/false/false/false/): 2048 bytes!
11-11 20:26:58.510: I/jPCT-AE(31516): Creating texture buffer of size 512
11-11 20:26:58.510: I/jPCT-AE(31516): New texture's id is: 210003
11-11 20:26:58.510: I/jPCT-AE(31516): New texture uploaded: com.threed.jpct.Texture@42945c08 in thread Thread[GLThread 2248,5,main]
11-11 20:26:58.580: I/jPCT-AE(31516): onStop

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: ERROR: glAttachShader - vertex shader: glError 1280
« Reply #11 on: November 11, 2013, 11:01:15 pm »
Can you post the log right from the beginning? Your log misses the first onSurfaceChanged call.

Offline rainfalls

  • byte
  • *
  • Posts: 27
    • View Profile
Re: ERROR: glAttachShader - vertex shader: glError 1280
« Reply #12 on: November 11, 2013, 11:25:30 pm »
Hi Egon,

I just found the problem. It is all about this code:

Code: [Select]
Texture.defaultToMipmapping(true);
I set it to be false, then the sample worked. I set the Android project build target back to 2.3.3 and changed the ae library back to your last stable one (jpct-ae.1.27.2013.07.04), and it still worked.

I wonder if zammbi can check this on his phones, but to me disabling mipmapping makes the sample work on all my devices.

Do you still need a full log when mipmapping is enabled?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: ERROR: glAttachShader - vertex shader: glError 1280
« Reply #13 on: November 12, 2013, 07:50:03 am »
No, i don't need it then. You might want to try to enable mipmaps again, but set http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Config.html#internalMipmapCreation to true to shift the actual mipmap creation from the GPU to the CPU. If that helps too, i'll make it the default in the next version.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: ERROR: glAttachShader - vertex shader: glError 1280
« Reply #14 on: November 12, 2013, 08:34:50 am »
I wonder if zammbi can check this on his phones, but to me disabling mipmapping makes the sample work on all my devices.
It's unlikely that these two problems (zammbi's and yours) are related. 1280 is a generic gl error that can happen in a lot of cases. If you want to be sure, you would have to query gl's error pipeline after each command or otherwise, it will stay in there and you'll get it once you decide to read out that pipeline with no relation to the actual command that caused it.