Hi,
i'am, as a newbie, trying to set up an explicit resolution, which is independet from the desktop- and window resolution, with GL4 and GLWindow without a GLCanvas in Java7. As an example: A) - desktop = 1920 * 1080 - GLWindow = 1024 * 768 - rendered content should be then 640 * 480 scaled to the GLWindow-size (so that the "visible quality" gets lower, but with less ressource-consumption) B) - further i want this also in fullscreen mode. - is it possible (in fullscreen) to get a "real" higher resolution then the current desktop-resolution is? just as an short snippet how i create my GLWindow (i think the answer could be somewhere here): Display display = NewtFactory.createDisplay(null); Screen screen = NewtFactory.createScreen(display, 0); GLCapabilities glCapabilities = initCapabilities(); glWindow = GLWindow.create(screen, glCapabilities); i'll be glad for every hint or some key-words for me to search on with the right terms |
Administrator
|
Hi
MonitorDevice.getSupportedModes() returns the supported modes. GLWindow.getMainMonitor() returns the main monitor. You can use any supported mode in full screen mode or in windowed mode. If your monitor supports 640 * 480, just use it. MonitorModeUtil can be useful to get the highest resolution available. I advise you to look at the source code as the Java documentation might be not really up-to-date.
Julien Gouesse | Personal blog | Website
|
Hi,
- i could not find "MonitorDevice", don't know in which package it should be - also could not find method ".getMainMonitor()" for GLWindow (static and instance) - and could not find "MonitorModeUtil"; instead i found the "ScreenModeUtil" and from this key-word i could "solve" that task -> so thx for the answer :) here my current solution-snippet: Display display = NewtFactory.createDisplay(null); Screen screen = NewtFactory.createScreen(display, 0); GLCapabilities glCapabilities = initCapabilities(); glWindow = GLWindow.create(screen, glCapabilities); // ... glWindow.setVisible(true); ScreenMode originalScreen = screen.getCurrentScreenMode(); int targetfrequency = originalScreen.getMonitorMode().getRefreshRate(); Dimension targetResolution = new Dimension(640, 480); int targetRotation = 0; List<ScreenMode> screenModes = screen.getScreenModes(); screenModes = ScreenModeUtil.filterByRate(screenModes, targetfrequency); screenModes = ScreenModeUtil.filterByRotation(screenModes, targetRotation); screenModes = ScreenModeUtil.filterByResolution(screenModes, targetResolution); screenModes = ScreenModeUtil.getHighestAvailableBpp(screenModes); screen.setCurrentScreenMode((ScreenMode) screenModes.get(0)); Two tricky things: - "screen.getCurrentScreenMode();" works only after "glWindow.setVisible(true);", else it will be NULL - "Dimension" must be from "javax.media.nativewindow.util." and not the common "java.awt.Dimension" Further: This solution changes the complete desktop/screen-resolution -> for fullscreen mode is this "not bad", but may disturb multiscreen systems -> for windowed mode is this a bit "strange", because the whole desktop is resized Can i avoid the desktop-resizement somehow? Or is there an another way to solve this (maybe with that things that i could not find)? |
Administrator
|
Rather use the very latest aggregated build. ScreenModeUtil doesn't exist any more in the latest build. There is no trick. NEWT is a different windowing toolkit, this is not AWT. Therefore, you can't use AWT classes within NEWT except some classes with the AWT/NEWT bridge NewtCanvasAWT. It's possible to get the monitor mode before showing the window, I do it in my game, I followed Sven's advice posted on this forum. In my case, I need the bit depth before showing anything and it works. You can resize the window without modifying the screen resolution. Please look at the online Java documentation of the class GLWindow.
Julien Gouesse | Personal blog | Website
|
ok - i had an "old" version from end of april 2013 ;) - now i'v found them - result is also identical to my previos, but now up to date - so thx again :) That "tricky" things were just a hint for other readers. in my case is it no problem first to show the window - then redefine the mode - and after that is the content shown. Resizing the GLWindow resizes also the contentpane - so it changes the resolution of the content. i would like to resize the window without changing the contentresolution, it should just get stretched or compressed to the new size -> "optimal" visible quality would be with an identical resolution for window (without borders) and content (like GLWindow does) -> "bad" visible quality would be with a higher windowresolution and a relativ lower for content / saving ressources -> with a high contentresolution and a relativ lower windowresolution should it be shown similar to the windowresolution / ressources gets wasted (sry for my "good" english, it's not my native language) |
Administrator
|
Other readers should not expect to be able to use AWT classes as is in NEWT classes as NEWT is not AWT and NEWT is available in environments in which AWT isn't.
You can render your scene into a texture and render this texture in your GLWindow. Your FBO can have a fixed size and when the GLWindow gets resized but goes on using the same texture coordinates and the same vertex coordinates matching with its corners, the content looks like stretched or "compressed". I don't really know why you try to achieve that but maybe there is an easier solution. I would rather force the GLWindow to stay in the primary monitor and use the closest resolution of the one I would like to use. English is not my mother tongue like for many people here.
Julien Gouesse | Personal blog | Website
|
Free forum by Nabble | Edit this page |