Canvas Resize – Some Update?


I use JME3.0 within a Netbeans framework, i.e. Swing environment. My Canvas is part of a JInternalFrame of a JDesktop pane. Works pretty good. I can remember in JME 2.0 you had to reset the settings if the canvas resized to tell the engine to use the new width and height. This was important for picking etc.

Is there something to do in JME3.0?

Short: What do I have to do to keep everything in the render queue up to date after my canvas has been resized?




The canvas should handle resizing automatically. The canvas context will defer resize events down to the rendermanager level to resize all the cameras and such.

Ok, thanks.


i know that this question has be answered a time ago, but i’ve another problem while resizing the canvas. The constellation is the same like Equilibrium wrote, but in addition a FilterPostProcessor is attached to the main viewport. I tested resizing without a FilterPostProcessor attached and it worked very well. But since i’ve attached the processor the resize process will encounter a black screen. Removing it from the scene processor system will solve the problem but i definitely have to make use of that processor :wink: Any ideas what the solution could be?




I have got the same problem. It is all the same with all FilterPostProcessors and all Filters. I can also not use BloomFilter in a Swing environment although BloomFilter works in normal application mode.

It has something to do with the rendering in swing environment. I already asked for solving the problem especially with BloomFilter and the JME3 guys answered that they will look for it. You have to wait until it is solved. Don’t use FilterPostProcessor until problem is solved. It doesn’t work anyway with any filter.



Thanks for the answer…

I’ve already noticed that it doesn’t work with the FilterPostProcessor attached. In the moment i solved the problem by detaching the processor each time a resize event was requested. Works, but isn’t a good solution i think. Another problem is that attaching the FilterPostProcessor and rendering without a filter added will disable the complete rendering pipeline. Hope that is due to my current implementation :wink:



You guys really know how to put the pressure :stuck_out_tongue:

@oOMoeOo Could you provide a test case for the issue?

The second issue (disabling rendering pipeline when there are no filter) should not happen, there again could you provide a reproducible test case?


no pressure at all :slight_smile:

I just want to have the BloomFilter, BloomFilter, BloomFilter… :slight_smile:



Well, putting the pressure wasn’t my intent :wink:

I checked the second issue again and now it seems to work. We visualize software and currently switching from jme2 to jme3. For this step i’m implementing a handling to add and remove different filters dynamically and during the development process i noticed that adding a filter post processor without having one filter enabled will cause a black screen. The current implementation contains much concurrent steps. Could have been a synchronization prob. In the moment it seems to work :wink: if i can reproduce it i’ll post it here.

The first problem is much easier to reproduce. Just have a look at the startApp-method from test.awt.TestCanvas. If you set the frame resizable, add the FilterPostProcessor and maybe a SSAOFilter, execute it and try to resize the frame, the canvas will become black. In addition i think that there is a cursor update missing after reentering the canvas. The cursor is still represented by an arrow if you quickly slowly move the mouse from outside the frame inside the canvas.


public static void startApp(){


app.enqueue(new Callable<Void>(){

public Void call(){

if (app instanceof SimpleApplication){

SimpleApplication simpleApp = (SimpleApplication) app;


FilterPostProcessor proc = new FilterPostProcessor(simpleApp.getAssetManager());

proc.addFilter(new SSAOFilter());



return null;






Which kind of application do you program? I also used JME2 but JME3 is much better.

Well I’m part of a research group in germany. We’re visualizing object oriented software projects. In java context that means classes are buildings, packages are streets, subpackages are substreets, coupling degrees are edges and so one. Hope the picture explains it much better :wink:

What about you?


I am from Austria. I am programming a scientific suite for molecule building, cyrstals, molecular dynamics…scientific stuff but for private use and fun only…

Sound really interesting, we’re also do it for private use but switching to JME3 will be a great step. Hope that stereo processing will added soon :wink:

ok thanks for the test case i’m gonna look at this :wink:

Committed a fix in last SVN, Filters resize properly.

However there is still an issue with SSAO and CartoonEdge filters when resizing.

@Equilibrium I can’t reproduce your problem , bloom works properly in a canvas. Do you have some particles or bitmap text in your scene?

Uaah, and the code went red :wink:

Saw that the RawInputListener got two more methods. Have some classes implementing the RawInputListener interface. Currently both the methods are called all the time as fast as possible. Is this a desired feature? Was happy all the time, that using the RawInputListener doesn’t lead on to much input calls.

But now it seems, that attaching/detaching the LightScattering, SSAO and RadialBlurFilter during the update-call doesn’t work anymore. My current implementation provides an user interface for all the filters. Filters can be enabled/disabled and the basic parameters set:

By calling update from the SystemListener all the registered modules are updated. Any idea why dynamically adding the LightScattering, SSAO and RadialBlurFilters doesn’t work anymore?



Now receiving the following warning while initializing the Filter:


[java]03.01.2011 14:42:17 com.jme3.renderer.lwjgl.LwjglRenderer updateShaderSourceData

WARNUNG: Common/MatDefs/SSAO/ssao.frag compile error: 0(14) : error C7551: OpenGL first class arrays require #version 120[/java]


[java]03.01.2011 14:45:42 com.jme3.renderer.lwjgl.LwjglRenderer updateShaderSourceData

WARNUNG: Common/MatDefs/Blur/RadialBlur.frag compile error: 0(5) : error C7551: OpenGL first class arrays require #version 120[/java]


[java]03.01.2011 14:45:24 com.jme3.renderer.lwjgl.LwjglRenderer updateShaderSourceData

WARNUNG: Common/MatDefs/Light/LightScattering.frag compile error: 0(18) : error C7011: implicit cast from "int" to "float"[/java]

Hey cool! I need that for JMP would you share your code?

About the rawinput listener, i did not made the change, i can’t help you on that.

For the last issue, sorry, I fixed it now.

Hey thank you very much, LightScattering and RadialBlur are working now. But using SSAO leads on to the following result:

Well i would like to share my code but overall we’re talking about 80 classes containing that stuff. It’s not only the ui for the filters, in addition i’ve implemented a handling which makes me possible to update the scene only if i want to reduce the cpu occupation, customized pick- and pickmotionlistening, basic modules like compass, grounds, sky domes, mouse looking and so on. Maybe i could cut out the basic parts with the module management if it is enough for you!?



erf damn it!

I wrongly committed a test on ssao (this is the normal output).

oh…great google code is down i can’t commit…

Note that SSAO will need more work to properly resize