Skip to main content
GameDev.net gamedev.net
🔒 Locked

[java] Initializing java3D

Started by PorkBag Sep 7, 2005 at 1:16 AM 2 replies 1k views
Original Post
PorkBag
PorkBag
Java3D won't start, I get a "wglCreateContext failed: Invalid Pixel format" error. I'm guessing that this is because the bitdepth of the GraphicsConfiguration object is 24, which for whatever reason my system can't handle. From what I understand getConfigurations() is supposed to return all possible configurations, but they all have the same bitdepth of 24. This is the code:

		GraphicsConfiguration Config2=SimpleUniverse.getPreferredConfiguration ();
		GraphicsEnvironment gf = GraphicsEnvironment.getLocalGraphicsEnvironment();
		GraphicsDevice Device=gf.getDefaultScreenDevice();
		GraphicsConfiguration []Configs=Device.getConfigurations ();
		
		System.out.println (Configs.length);
		//print out configurations
		for (int X=0; X<Configs.length; X++)
		{
			ColorModel Temp=Configs[X].getColorModel ();
			System.out.println ("Bit Depth: " + Temp.getPixelSize() + "  Channels: " + Temp.getNumComponents());
		}
		
		Canvas3D Screen = new Canvas3D (Config2);
		Universe = new SimpleUniverse (Screen);
		
		setLayout (new BorderLayout ());
		add (Screen, BorderLayout.CENTER);

There isn't a setBitdepth() function that I can find, so I don't know how to create a Config with a different bitdepth, or is that not the problem in the first place? thanks,
misterX
misterX

i tested the code above (modifying some tiny details) and it worked fine here. I'm using the openGL version of J3D and also have a bitdepth of 24 for every configuration, however it works fine.
Maybe your drivers aren't up to date, is it possible?
...else, i've no clue.
PorkBag
PorkBag
Looks like it works if I get rid of the opengl version and install the directx version instead. I just installed all the latest drivers (before that I got even ickier errors) and I don't get why it wouldn't work for opengl, but whatever. One question though, is code made with the java's directx SDK still going to be system independent and whatnot?
OrangyTang
OrangyTang
Quote:
Original post by PorkBag
One question though, is code made with the java's directx SDK still going to be system independent and whatnot?

Yes and no.

API-wise, you use a single interface so your code is the same. However there are differences based on which version the user actually installs. There may be feature differences (such as the DX version not supporting thick lines, which the GL version does) or performance quirks (what runs fast on your machine with one version does not nessisarity run fast on someone elses with a different version).

IMHO, if you use something slightly lower level like LWJGL you get identical behaviour across all platforms (and more flexibility and performance as an added bonus).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.