B4J Question Strange things with limits of Pane and Canvas...

Magma

Expert
Licensed User
Longtime User
Hi there...

I am having a little problem with the limits of pane...

I was working very good with pane - a project with ruler - so this must be extremely big... but have no problem... but when i moved the project to other computer strange things happened..

error:
java.lang.NullPointerException
at com.sun.javafx.sg.prism.NGCanvas$RenderBuf.validate(NGCanvas.java:213)
at com.sun.javafx.sg.prism.NGCanvas.initCanvas(NGCanvas.java:640)
at com.sun.javafx.sg.prism.NGCanvas.renderContent(NGCanvas.java:603)
at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2053)
at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1945)
at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:235)
at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:576)
at com.sun.javafx.sg.prism.NGNode.renderForClip(NGNode.java:2294)
at com.sun.javafx.sg.prism.NGNode.renderRectClip(NGNode.java:2188)
at com.sun.javafx.sg.prism.NGNode.renderClip(NGNode.java:2214)
at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2047)
at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1945)
at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:235)
at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:576)
at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2053)
at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1945)
at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:477)
at com.sun.javafx.tk.quantum.ViewPainter.paintImpl(ViewPainter.java:330)
at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:91)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
at java.lang.Thread.run(Thread.java:748)

Here is a small project to understand it...

B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private Pane1 As Pane
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout(1) 'Load the layout file. - just loading a pane
    MainForm.Show
    Dim a As Canvas
    a.Initialize("aa")
    Pane1.AddNode(a,0,0,10000,10000) 'if i have it at 8000 works ok... but my project needs about 259200 pixels.. worked fine with my pc - but in other pcs have problems... 10000 gives problem too..
    a.DrawCircle(50,50,20,fx.Colors.Red,True,1)
End Sub

'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub

Sub Pane1_MouseClicked (EventData As MouseEvent)
    
End Sub

Tried with labels no problem...

The problem seems to be at canvas & pane combination... but the strange is that at my pc works....

i am using jdk 131 - tried to install at other pcs but the same... hope this fix that but nope...

How to bypass this problem ?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can disable hardware acceleration and enable logging with this line:
B4X:
#VirtualMachineArgs: -Dprism.order=sw -Dprism.verbose=true
This is only relevant when you run the project from the IDE. Otherwise you will need to add it to the command line: java -jar <your jar> -Dprism...

I don't know if it will help or not.

You can create a scaled down canvas and resize the generated bitmap. Or better only draw the visible part of the ruler.
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
@Erel...

no that not works...

I ve installed b4j to other pc- the same app that works to me at the other not works...

How working to my pc (have ati vga) and not at others... +works at another having Nvidia VGA (jdk 131 and java runtime latest)

What exactly is the problem at pane with the width/height of canvas ?

The only difference is that i have installed and other older version of jdk - at my pc - but the latest is java 8 131..

Is it possible to have something with Graphics card ? ... pc's tried and not work have simple Intel... and working pc have Nvidia and ATI.

i ll try it at other pc have graphics card extra (nvidia, ati)...
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
STRANGE...

but... found the reason...

The reason is the simple VGA card.... needs ATI or NVIDIA... wow ?

Canvas can be bigger that ~8000pixels when you have Graphics Card ATI/NVIDIA... tested at simple ATI 5450 works, NVIDIA GT730, and NVIDIA GTX1060 there works perfect... with any java runtime...

at least found the reason - now i must think how i will solve or sell that ! :)
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
I can give you remote desktop for presentation to you...

After 5 tests i ve made...

3 pcs having Nvidia, ATI latest tech (ATI 5450+)... can run it ok
2 pcs having Intel 3D got java.lang.NullPointerException

May be javafx automatically use GPU for big images/graphics...
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Is there a way to pass a variable through command line and the read it...
Yes. Please start a new thread for this question.

So then i ll turn off the ruller if no external vga... or is there a way to check the chipset of vga ? ATI NVIDIA Intel ?
There is no API to get the display driver.
 
Upvote 0
Top