SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components
I have created a HeatMap with the size of 25000 x 70. The application crashes with the following log:
E/libEGL: call to OpenGL ES API with no current context (logged once per thread)
E/libEGL: call to OpenGL ES API with no current context (logged once per thread)
E/libEGL: call to OpenGL ES API with no current context (logged once per thread)
D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
I/OpenGLRenderer: Initialized EGL, version 1.4
W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without…
D/EGL_emulation: eglCreateContext: 0x7faef90b6500: maj 2 min 0 rcv 2
D/EGL_emulation: eglMakeCurrent: 0x7faef90b6500: ver 2 0 (tinfo 0x7faf0489eec0)
D/EGL_emulation: eglMakeCurrent: 0x7faef90b6500: ver 2 0 (tinfo 0x7faf0489eec0)
D/EGL_emulation: eglCreateContext: 0x7faf04b65680: maj 2 min 0 rcv 2
D/EGL_emulation: eglMakeCurrent: 0x7faf04b65680: ver 2 0 (tinfo 0x7faf04b7e500)
E/emuglGLESv2_enc: device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glTexImage2D:1908 GL error 0x501 A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x41a10f90 in tid 2736 (GLThread 973)
Below is Kotlin code from my sample project that produces the error:
private const val WIDTH = 25000
private const val HEIGHT = 70
class MainActivity : AppCompatActivity()
{
private lateinit var chartBuilder: SciChartBuilder
override fun onCreate(savedInstanceState: Bundle?)
{
super.onCreate(savedInstanceState)
SciChartSurface.setRuntimeLicenseKey(getString(R.string.sciChart_license))
SciChartBuilder.init(this)
chartBuilder = SciChartBuilder.instance()
setContentView(R.layout.activity_main)
val background = findViewById<ViewGroup>(R.id.background)
val chartSurface = createChartSurface()
background.addView(chartSurface)
addPoints(chartSurface)
}
private fun createChartSurface(): SciChartSurface
{
val surface = SciChartSurface(this)
val xAxis = chartBuilder.newNumericAxis().build()
val yAxis = chartBuilder.newNumericAxis().build()
surface.xAxes.add(xAxis)
surface.yAxes.add(yAxis)
surface.renderableSeries.add(createSeries(WIDTH, HEIGHT))
return surface
}
private fun createSeries(width: Int, height: Int): FastUniformHeatmapRenderableSeries
{
val dataSeries = UniformHeatmapDataSeries(Int::class.javaObjectType, Int::class.javaObjectType, Float::class.javaObjectType, width, height)
return chartBuilder.newUniformHeatmap()
.withColorMap(ColorMap(intArrayOf(ColorUtil.DarkBlue, ColorUtil.CornflowerBlue, ColorUtil.DarkGreen, ColorUtil.Chartreuse, ColorUtil.Yellow, ColorUtil.Red), floatArrayOf(0f, 0.2f, 0.4f, 0.6f, 0.8f, 1f)))
.withDataSeries(dataSeries)
.build()
}
private fun addPoints(chartSurface: SciChartSurface)
{
@Suppress("UNCHECKED_CAST")
val dataSeries = chartSurface.renderableSeries.first().dataSeries as UniformHeatmapDataSeries<Int, Int, Float>
val xRange = 0 until WIDTH
for (i in 0 until HEIGHT)
{
val values = xRange.map { (i + it).toFloat() }
dataSeries.updateRangeZAt(0, i, values)
}
val renderableSeries = chartSurface.renderableSeries.first() as FastUniformHeatmapRenderableSeries
renderableSeries.minimum = dataSeries.zValues.minimum.toDouble()
renderableSeries.maximum = dataSeries.zValues.maximum.toDouble()
}
}
I think the heatmap is limited by maximum texture size in OpenGL. Query that using code like this.
https://stackoverflow.com/questions/26981125/get-opengl-max-texture-size
int[] maxTextureSize = new int[1];
GLES10.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0);
or
Canvas canvas = new Canvas();
canvas.getMaximumBitmapHeight() / 8
Then you can tile heat maps. For example, this case study was created by tiling Heatmaps in our Windows version of SciChart. They achieved a total of 100 million cells (10M x 10M)!
Best regards,
Andrew
Hi Miha,
I’m not sure that it’s a bug, you just reached limitation of OpenGL texture size which we use to draw heatmap. FastUniformHeatmapRenderableSeries just wasn’t designed for drawing of so large heatmaps and I’m not sure if there is something we can do without rewriting entire series. Anyway I logged this issue into our bug tracker and we’ll try to improve situation in one of our next releases.
Best regards,
Yura
Please login first to submit.