ztellman / penumbra

not under active development - idiomatic opengl bindings for clojure
354 stars 43 forks source link

Can't change display mode #18

Closed serge-rgb closed 12 years ago

serge-rgb commented 14 years ago

Hi, I have the triangle example from the wiki running on a recent checkout of penumbra. With clojure-1.2.0-master-snapshot, clojure-contrib-1.2.0-snapshot and lwjgl-2.4.2

My problem is that the window size is 3200x1200 (my resolution) and there is no way to resize it. If I call app/display-mode! within the init function there is no change (and no errors).

I am using two monitors. Maybe that's the cause of the problem since the definition of display-mode! uses the resolution of the available display modes. (I don't understand the code, my clojure-fu is weak). However, if I disable one of the monitors it still doesn't work.

Thanks!

serge-rgb commented 14 years ago

I've done a little more research and I've found out that the available display modes are all 3200x1200 or 1920x1200. I tried setting the display mode manually using lwjgl:

(let [mode (DisplayMode. 1024 768)]
    (println "Attempting mode: " mode)
    (app/display-mode! mode))

I get an exception. "java.lang.NullPointerException: mode must be non-null" after my program printed this: "Attempting mode: #<DisplayMode 1024 x 768 x 0 @0Hz>"

Does this mean that I can only use the available display modes? If that is the case then I only have 2 resolutions available.

ztellman commented 14 years ago

Can you run (app/display-modes) and tell me the output?

serge-rgb commented 14 years ago

Here it is:

({:resolution [3200 1200], :bpp 24, :fullscreen true, :mode #})
ztellman commented 14 years ago

Hmm. That does seem to suggest that you only have one available display mode, and it's the full two screens. I've never seen that before. Can you tell me more about your system (OS, video card, etc.)?

serge-rgb commented 14 years ago

I'm running Ubuntu 10.04 x86_64. My videocard is a GeForce 8800 GTS How many display modes is it normal to have? As far as I know the getAvailableDisplayModes method only returns the resolutions for which the system has fullscreen capability. Reading window.clj I saw that Display/getAvailableDisplayModes is the only method used to obtain display modes, so that would mean that if someone wanted to set their window to an arbitrary resolution it wouldn't be possible. Am I right? Also, my window is not resizable. Is that normal?

serge-rgb commented 14 years ago

I had some success. Ubuntu uses an NVidia tool (nvidia-settings) to handle the configuration of X. It uses an option of the "Screen" section called "metamodes" to set the resolution and placement of the displays. There was only one metamode, at 3200x1200. I added a couple more settings from the NVidia app. Now my "Screen" section looks like this:


Section "Screen"

# Removed Option "metamodes" "DFP-0: nvidia-auto-select +1920+0, DFP-1: nvidia-auto-select +0+0"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "TwinView" "1"
    Option         "TwinViewXineramaInfoOrder" "DFP-1"
    Option         "metamodes" "DFP-0: NULL, DFP-1: nvidia-auto-select +0+0; DFP-0: nvidia-auto-select +1920+0, DFP-1: nvidia-auto-select +0+0; DFP-0: NULL, DFP-1: 1024x768 +0+0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

and the output of (app/display-modes) looks like this:


({:resolution [1024 768], :bpp 24, :fullscreen true, :mode #} {:resolution [3200 1200], :bpp 24, :fullscreen true, :mode #} {:resolution [3200 1200], :bpp 24, :fullscreen true, :mode #} {:resolution [1920 1200], :bpp 24, :fullscreen true, :mode #})

and I can create a 1024x768 window.

I think my setup is pretty common, so maybe this could be in a FAQ?

Thanks for your time!

aking commented 14 years ago

Thank you for the metamodes solution! This issue with only a single available mode when using nVidia Twinview under Linux has stopped me from using Penumbra under linux for months. I added a 800x600 metamode and now I can run the example apps at that resolution and not the forced Twinview resolution of 3020x1050. A mention in the FAQ would be helpful (or in the lwjgl notes)

serge-rgb commented 14 years ago

Yes.. I think this is more of a lwjgl problem than a Penumbra problem. Glad I could help! =)