OpenGL pipeline - need different code ?

I’m developing a game (ya thats rare here ? =D)
anyway, I have windows and linux as native OS’ on my pc
naturally I would like my game to run smooth on linux aswell
so I tried using the OpenGL pipeline “-Dsun.java2d.opengl=True”

what happens is that, while the framerate is extremely good (even better than running my game on windows), the output is corrupted.
The screen flickers very frequently and there are to fonts/text output.

I mean flickering output of game almost always make me think of double buffering issues.

so maybe I need different code for OpenGL ? well that shouldn’t be the case but it might be.

my basic rendering process is like


Graphics2D gg;
BufferStrategy strategy;
...
gg = DisplayMan.getGraphics();
gg.setColor (getBackground ());
gg.fillRect (0, 0, this.getSize().width, this.getSize().height);
gg.setColor (getForeground());
		
renderShit (gg); // rendering of the game obviously
				
gg.dispose();
      		
try
{
      strategy().show();
}
catch(Exception ok){}

kinda like that. Now as said, it works fine without OpenGL, but using it, I get the mentioned problems.

I also like to add that: when using Linux and don’t use OpenGL I get only like 20-30 FPS, using OpenGL I get like 100 FPS but with the problems.
also interesting: If I use OpenGL pipeline on windows, I have the same problems AND only 1 FPS =D

your thoughts ?

Fundamentally, it sounds like the OpenGL pipeline is broken with that set of drivers. They should be identical in every way, except for the performance, which should be noticeably faster on OpenGL.

Cas :slight_smile:

I just tried it out on my notebook

15 FPS, flickering, but I see vertical lines during those short flickerings. looks really… unnatural =D

But I got font here…

But sometimes it only shows the background and not the foreground elements

It flickers anyway but… ^^

I’m not really sure how to fix it. You cannot install OpenGL like DirectX. And well on my Notebook and PC I’m using the “Omega” drivers, which are 3rd party. I love those drivers and I really dont like ATI Catalyst (I got ATI cards on both machines).
And one may think yaa that might be the case, since its a 3rd party driver and stuff but…
since Omega isnt available on Linux, I installed the ATI Linux driver on my Ubuntu system, and I told you its the same thing =P

Java2d’s opengl pipeline is pretty buggy on linux especially on the 1.5 jvm’s. You could use an opengl binding like LWJGL or JOGL instead. the Slick library is particularly good since its api is almost identical to Java2d and runs well on both OS’s, much faster than Java2d.

I already wrote my own methods and shit, you may call it a small framework

so changing to another libary doesn’t seem very attractive, changing code that is working on one system is very annoying.

I might end up finishing the game, which works on windows and then later rewrite it so that there is also a linux version. So I will eventually take a look into Slick or JOGL…

Isn’t Java to work on every OS without code changes ? Isn’t that what makes it stand out ? kinda silly =D

don’t reduce the “write once r…” statement of java to the opengl rendering backend and the third party drivers you have installed.

just use the libs what kapta suggested and you reduce system specific stability issues to a minimum or stay with direct3d on windows and ignore the rest by using sw mode.