JBuilder - Need Help with jPCT!!!

Started by Albareth, December 30, 2003, 08:51:12 PM

Previous topic - Next topic

Albareth

Ok, I've compiled my project with no troubles, and I try to run it.  However, the main runtime window for the engine is not coming up.  I get the console data, but not the graphics...  Please Help!!!

EgonOlsen

Maybe your application (i assume that it is an application, not an applet!?) exits with an exception before the frame opens?
Personally, i use JBuilder to edit and compile my stuff, but i always use the console and some batch-files to start the compiled app. Can't really tell you why i'm doing it this way...maybe i'm just used to it.

BTW: What happened to the problem with the textures?

Albareth

Well, my application runs/compiles in JBuilder (i.e. I get a console), but I don't get the graphical window...  And when I try to run it outside of JBuilder I get a Main Class Not Found error...

Also, the Texture bug was just a problem with the code that you used in TerrainGL...  Java didn't like that method, so I switched it to the Bounce method...  Now it's taking my texture with a width of 1024 and saying that it is an improper size, then it shrinks it down to 256...

EgonOlsen

Quote from: "Albareth"Well, my application runs/compiles in JBuilder (i.e. I get a console), but I don't get the graphical window...  And when I try to run it outside of JBuilder I get a Main Class Not Found error...

Also, the Texture bug was just a problem with the code that you used in TerrainGL...  Java didn't like that method, so I switched it to the Bounce method...  Now it's taking my texture with a width of 1024 and saying that it is an improper size, then it shrinks it down to 256...
What's the console's output (if any...).
About the texture: 1024 is a proper size and shouldn't be rescaled. What may happen anyway is, that the height is not a power of 2, which causes a rescale of the height to 256. Which size is the texture in?

EgonOlsen

BTW: If the way TerrainGL loads its textures doesn't work for you but the way Bounce does it works, you are writing an Applet, don't you? Bounce is applet only. That would explain why you don't get a graphical output when using JBuilder/Netbeans. An Applet can't run as standalone but needs an "applet-container" like the Appletviewer (comes with the JDK) or a browser to run. Maybe using one of these options will solve your problem!?

Albareth

Well, the console's output is:
Exception in thread "main" java.lang.NoClassDefFoundError: game

and no, I'm not writing an applet...  It's just the method of loading textures that I borrowed from Bounce...

EgonOlsen

Quote from: "Albareth"Well, the console's output is:
Exception in thread "main" java.lang.NoClassDefFoundError: game

and no, I'm not writing an applet...  It's just the method of loading textures that I borrowed from Bounce...
Have you configured the class to start in the Project Properties (in the Run-Tab)?

I still don't get how you can use Bounce's texture loading method...Bounce does
zoom=new Texture(this.getDocumentBase(), "bouncedata/zoom.gif");
That can't work in an Application unless your application extends Applet for whatever reason. Anyway, if this works and your previous approach wasn't, something with the path to your files had been wrong before.

Albareth

Texture tex = new Texture("d:/13th/SESD/com/resources/dreadhull.jpg");
   texMan.addTexture("DreadHull", tex);
is the code that I use to load the texture into the texture manager...
and that error that I got in the console was from the MS-DOS Prompt...  my code works in JBuilder, and the program runs...[/code]

EgonOlsen

Quote from: "Albareth"Texture tex = new Texture("d:/13th/SESD/com/resources/dreadhull.jpg");
   texMan.addTexture("DreadHull", tex);
is the code that I use to load the texture into the texture manager...
and that error that I got in the console was from the MS-DOS Prompt...  my code works in JBuilder, and the program runs...
I guess we were talking about different things then. The code is of course fine the way it is. Have you tried something like
java -cp %CLASSPATH%;. game in the console (or whatever your main-class is called)?
You mean that the code runs in JBuilder and you just don't get the frame displayed?

Albareth

I am using the classpath in the console...  and the frame is not getting displayed in JBuilder...  but the code runs.

my output in JBuilder:
D:\JBuilder9\jdk1.4\bin\javaw -classpath "D:\13th\SESD\com\classes;D:\13th\SESD\com\lib\lwjgl\lwjgl.jar;D:\13th\SESD\com\lib\jpct\jpct.jar;D:\JBuilder9\jdk1.4\demo\jfc\Java2D\Java2Demo.jar;D:\JBuilder9\jdk1.4\demo\plugin\jfc\Java2D\Java2Demo.jar;D:\JBuilder9\jdk1.4\jre\lib\charsets.jar;D:\JBuilder9\jdk1.4\jre\lib\ext\dnsns.jar;D:\JBuilder9\jdk1.4\jre\lib\ext\ldapsec.jar;D:\JBuilder9\jdk1.4\jre\lib\ext\localedata.jar;D:\JBuilder9\jdk1.4\jre\lib\ext\sunjce_provider.jar;D:\JBuilder9\jdk1.4\jre\lib\im\indicim.jar;D:\JBuilder9\jdk1.4\jre\lib\jaws.jar;D:\JBuilder9\jdk1.4\jre\lib\jce.jar;D:\JBuilder9\jdk1.4\jre\lib\jsse.jar;D:\JBuilder9\jdk1.4\jre\lib\rt.jar;D:\JBuilder9\jdk1.4\jre\lib\sunrsasign.jar;D:\JBuilder9\jdk1.4\lib\dt.jar;D:\JBuilder9\jdk1.4\lib\htmlconverter.jar;D:\JBuilder9\jdk1.4\lib\tools.jar"  Game
Please enter your Player ID:

1
Please enter your password:

1
Your username is 1 and your password is 1

Java version is: 1.4.1_02

-> support for BufferedImage

-> using BufferedImage

Software renderer (legacy mode) initialized

Loading Texture...d:/13th/SESD/com/resources/dreadhull.jpg

[ Wed Dec 31 21:11:01 EST 2003 ] - WARNING: Unsupported Texture width...resizing to a width of 256 pixels!

Loading Texture...d:/13th/SESD/com/resources/dreadhullspec.jpg

[ Wed Dec 31 21:11:02 EST 2003 ] - WARNING: Unsupported Texture width...resizing to a width of 256 pixels!

Loading Texture...d:/13th/SESD/com/resources/tipmap.jpg

Loading Texture...d:/13th/SESD/com/resources/windowmap.jpg

Loading Texture...d:/13th/SESD/com/resources/windowreflect.jpg

Adding Lightsource: 0

Created 31 triangle-strips for objectID 0 in 15 pass(es)

[/list]

EgonOlsen

OK, so obviously SOME code is running, but that doesn't mean that the method that opens the frame will ever be called. Without looking at the code, it's impossible to tell what's wrong here. But it's most likely a problem with your code, not with JBuilder. The fact that it doesn't work in Netbeans seconds this.
Maybe you can post the code if it's not too large!?
About the textures: Please check their width again. jPCT checks for the width in a switch-case statement. Supported widths are 8,16,32,64,128,256,512,1024,2048,4192. Everything else will be scaled down (or up) to 256. The same is true for the height.

Albareth

Well, I got the code working...  It was a fault in the initialization of the frame...  And my DreadHull texture has a size of 1024x1024, same with DreadHullSpec...

EgonOlsen

Quote from: "Albareth"Well, I got the code working...  It was a fault in the initialization of the frame...  And my DreadHull texture has a size of 1024x1024, same with DreadHullSpec...
Great that you got it working.. :D
Can you upload the texture somewhere or just send it to me by eMail? I can't think of a single reason for the rescaling other than that the width is NOT 1024, but i would like to see for myself. I can't reproduce this problem and looking at jPCT's texture loading code, i can't find a potential problem in it.

Albareth

Well, the texture error is gone.  I guess I must have mistyped typed the texturefile, for the originals (set at 640x480) are in the same directory.  Thanks for the help.