SwingTextureRenderer Problem
Posted: 06 March 2012 03:11 AM   [ Ignore ]
Rank
Joined  2012-03-06
Total Posts:  2
New Member

Hi,

I have a problem using the SwingTextureRenderer class. Here comes my code:

public class MTHelloWorld extends AbstractScene {
...
public 
MTHelloWorld(AbstractMTApplication mtApplicationString name{
...
JPanel panel = new JPanel(true);
panel.setBounds(new Rectangle(100,50));
final 
SwingTextureRenderer swing =
                    new 
SwingTextureRenderer(mtApplicationpanel);

MTRectangle rectangle = new MTRectangle(300,300,0,200,200,mtApplication);
            
rectangle.setTexture(swing.getTextureToRenderTo());
            
swing.startTimedRefresh(1000);
            
swing.addPaintOcurredListener(new ActionListener() {
                
public void actionPerformed(ActionEvent arg0{
                    swing
.stopTimedRefresh(); //stop repainting after it was painted once
                
}
            }
);
getCanvas().addChild(rectangle);
}
...

I am using this version of mt4j: MT4j version 0.98 full (dev. preview) release. And I get a NullPointerException.

Exception in thread "Animation Thread" java.lang.NullPointerException
    at org
.mt4j.util.opengl.GLTexture.setupGLTexture(GLTexture.java:557)
    
at org.mt4j.util.SwingTextureRenderer.<init>(SwingTextureRenderer.java:156)
    
at keba.MTHelloWorld.<init>(MTHelloWorld.java:54)
    
at keba.StartHelloWorld.startUp(StartHelloWorld.java:26)
    
at org.mt4j.MTApplication.setup(MTApplication.java:328)
    
at processing.core.PApplet.handleDraw(PApplet.java:1580)
    
at processing.core.PApplet.run(PApplet.java:1502)
    
at java.lang.Thread.run(Unknown Source)

I have tried to figure out the problem in SwingTextureRenderer class and in GLTexture class but without success.

Profile
 
 
Posted: 07 March 2012 05:53 AM   [ Ignore ]   [ # 1 ]
Rank
Joined  2012-03-06
Total Posts:  2
New Member

Solved. Had a problem with my build path settings.

Profile
 
 
Posted: 06 August 2015 09:12 AM   [ Ignore ]   [ # 2 ]
Rank
Joined  2015-08-06
Total Posts:  1
New Member

Hi,
I have the same problem. Can you describe how you solved the build path settings?

Profile