Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  GLCanvas - doubling up the pixels..  (Read 1445 times)
0 Members and 1 Guest are viewing this topic.
Offline garyd

Junior Newbie





« Posted 2011-06-28 11:09:40 »

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?
Offline garyd

Junior Newbie





« Reply #1 - Posted 2011-06-28 15:02:42 »

I have I asked in the wrong section?
Offline namrog84

JGO Ninja


Medals: 46
Projects: 4


Keep programming!


« Reply #2 - Posted 2011-06-28 15:15:34 »

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.


"Experience is what you get when you did not get what you wanted"
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline garyd

Junior Newbie





« Reply #3 - Posted 2011-06-28 16:14:30 »

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
Offline lhkbob

JGO Knight


Medals: 32



« Reply #4 - Posted 2011-06-28 16:32:22 »

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.

Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #5 - Posted 2011-06-28 19:26:19 »

1  
2  
3  
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.

See my work:
OTC Software
Offline garyd

Junior Newbie





« Reply #6 - Posted 2011-06-29 08:07:37 »

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..
Offline gouessej
« Reply #7 - Posted 2011-06-29 12:20:04 »

Hi

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

Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #8 - Posted 2011-06-29 20:37:18 »

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..
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.

See my work:
OTC Software
Offline lhkbob

JGO Knight


Medals: 32



« Reply #9 - Posted 2011-06-29 22:20:44 »

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.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline garyd

Junior Newbie





« Reply #10 - Posted 2011-07-04 19:30:39 »

Late reply sorry, was in Germany..

There's a few good points to test out.. Ill give them all a try..
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Riven (19 views)
2014-07-29 18:09:19

Riven (13 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (31 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (42 views)
2014-07-24 01:59:36

Riven (42 views)
2014-07-23 21:16:32

Riven (28 views)
2014-07-23 21:07:15

Riven (29 views)
2014-07-23 20:56:16

ctomni231 (60 views)
2014-07-18 06:55:21
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!