Java and GPU's

When Java draws an image does it store the image on the GPU so when the image is redrawn it requires minimal processing or does it move the image file back and forth between the CPU and the GPU? Just curious really.

Also what is the best resolution to produce full screen games in? Obviously there’s a cross over between high res and speed but do all screens support all resolutions? Is there a standard res that works on everything? even on steam? I only ask because the last game I did was 640 x 480 and I definitely had issues on some PC’s.

Another odd thing I found was that text appeared in slightly the wrong place when running on Linux machines - it was as if the xy position was for the top left of the text on windows but the bottom left when running on Linux. This caused my image boxes and associated text to look crappy on Linux. I ended up using an image for the text instead of drawString. Thoughts?

It depends on what you’re talking about. Java2D? JOGL? libGDX? Something else?

I see ‘drawString’ so Java2D. It depends really, as Java2D could use its software renderer so it’s done on the CPU, or it could use its hardware renderer so it’s done on the GPU.

I wouldn’t say there is 1 best resolution, but rather the native resolution of the screen is the best.

That’s strange, I’ve never seen that before and a Google search didn’t yield any results. Maybe a code sample?

Just the standard drawImage method.

[quote=“ra4king,post:3,topic:53757”]
But different computers & monitors have different resolutions. My 24" monitor has 1920x1080 while my Linux laptop is 1366x768 while my old netbook is 1024x600. If the game adapts to different res then obviously the game difficulty changes. I was kind of hoping that someone could just say “you just need res NxN and it will work perfectly everywhere”. At least that’s what I was hoping.

[quote=“ra4king,post:3,topic:53757”]
The code is quite simple stuff


	public final Font Charfont = new Font("Impact", Font.BOLD, 30);
        ...
	og.setFont( Charfont );
	og.drawRect( x,y+10,120,40 );
	og.drawString("Set up", x+26, y + 40 );

On the PC the text appears perfectly centred in the rectangle, on Linux it’s off to the side. Thinking about it, it may be the fonts that are wrong - but I would of thought if you specify a particular font then you’d get that font.

If you really want 1 resolution for all computers, 800x600 or 1024x800 should work essentially everywhere.

You’re correct, it’s the font: Impact is a Microsoft font so that may be your issue.

Great.
Many thanks for the info.
I’ll try it out.

Use FontMetrics to position text.