GLCanvas - doubling up the pixels..

I am using JOGL with a GLCanvas in an app which is displayed fullscreen 1920x1080, is it possible to set the resolution of the GLCanvas or GL to say half this 960x540 and have the canvas/gl upscale it? The purpose of which is to get a better fps?

I have I asked in the wrong section?

This section is fine. Many people aren’t on this early in the morning. At least in my area, there are a lot of international members so sometimes it takes a while before response

Yes you could do what you suggested if you so wanted.

It could also be beneficial because many people do not have capabilities of such high resolution. I know many people on less then 1400x1050 screens, I myself only have 1 of 5 monitors that can do 1920x1080 or higher.

Many games and even apps are often designed for the lowest common denominator 800x600, 1024x768, 1280x800 resolutions and just scaled or have a few features added for the bigger screens.

Thx, So how is it done with jogl… I cant seem to find anyway of doing it directly with the GCanvas, I suppose I could read the pixels from GL and paint them to a different canvas but that would be a FPS killer

Just use a lower resolution, why would you want to upscale it to a higher resolution? But if that’s something you really wanted, you should render everything to a texture and then render a quad to the actual screen that uses the whole texture. For what you want, this is just a headache.


glPushMatrix();
glScalef(scale, scale, 1.0f);
glPopMatrix();

You may need to put in a glTransformf in there as well to make stuff line up correctly.

glScale wont change the resolution of the canvas itself, it will just make everything bigger, rendering to a texture sounds costly… I guess the best idea is to change the screen resolution ala xrandr, thought there would be a simpler way…

Hi

If display mode changes are supported on your machine(s), change the resolution. Use GraphicsEnvironment, GraphicsDevice and DisplayMode in the java.awt package.

That’s not true. You’re just changing the transformation matrix that already gets applied to every single draw call, and textures are almost always going to be drawn at relatively arbitrary (i.e. not original) sizes, at least in my experience.

If you’re noticing a performance hit from calling glScale once then you’ve got other issues.

One problem of course can be the textures looking like crap because they’re getting scaled, but if you just turn on nearest neighbor scaling it will look exactly like if it’s a a lower resolution

You can’t magically change the resolution of a single window on the screen. If you think you’re doing that, you’re not. You can either go into full screen mode and actually change the resolution of the entire screen via the display mode, or you can simulate it through various means, a glScale call being the simplest method.

JOGL with AWT doesn’t support resolution changes directly since it puts the GLCanvas inside an AWT frame. Just google for AWT fullscreen tutorials and you can use that code to change screen resolution and get fullscreen OpenGL applications up pretty easily.

Late reply sorry, was in Germany…

There’s a few good points to test out… Ill give them all a try…