UnderwaterApps / overlap2d

Overlap2D Game development toolkit for UI and Level design
Other
780 stars 224 forks source link

My GPU on my Mac overheats when running Overlap2D #413

Open KevinNorth opened 8 years ago

KevinNorth commented 8 years ago

When I run Overlap2D on my Mac, my GPU quickly reaches nearly 100ºC and stays at that temperature until I close the editor. This happens even when I leave Overlap2D running in the background without opening a project.

Here's a screenshot showing the temperature of my GPU when I'm running Overlap2D:

Notice my fan speeds and the "TCGC PECI GPU" temperature. The CPU is doing fine.

Here are my computer's specs:

General information:

GPU:

Molitor:

My computer is running Java 1.8.0_74 as its JRE.

meonlineonmess commented 7 years ago

i'll try it

bruceloco commented 7 years ago
/** Target framerate when the window is in the foreground. The CPU sleeps as needed. Use 0 to never sleep. **/
public int foregroundFPS;
/** Target framerate when the window is in the background. The CPU sleeps as needed. Use 0 to never sleep, -1 to not render. **/
public int backgroundFPS;
/** Target framerate when the window is hidden or minimized. The CPU sleeps as needed. Use 0 to never sleep, -1 to not render. **/
public int hiddenFPS = -1;
azakhary commented 7 years ago

so background and hidden has to be -1, and foreground 60.. i guess.

meonlineonmess commented 7 years ago

IT WORKS!!!

These are the settings that worked :

"       config.backgroundFPS = -1;
    config.foregroundFPS = 60;
    config.hiddenFPS = -1;
    config.vSync = false;"

No more 80 Degrees on the CPU!!! The FPS counter stays low at about 3 FPS when idle and also when not in focus !!!

meonlineonmess commented 7 years ago

CPU usage is also very low at about 0,2 when idle+ in focus or not in focus.

meonlineonmess commented 7 years ago

Overlap2D now seems to be also way much smoother and stable when working with it.

azakhary commented 7 years ago

can you do a pull request? I'll merge it right away!

meonlineonmess commented 7 years ago

I'll try

bruceloco commented 7 years ago

I get a black screen with backgroundFPS = -1 but this is with ./gradlew run, so I am not sure that java is main and gradle app is 2nd(background) how do we build the .jar file or where is it stored?

meonlineonmess commented 7 years ago

I can't do a pull request and I tried to commit the change for review but it asks me for a username and password. I guess I do not have permissions.

this is the change I did in the Main class method startLoadingEditor():

" if (SystemUtils.IS_OS_MAC_OSX || SystemUtils.IS_OS_MAC) { System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Overlap2D"); JglfwApplicationConfiguration config = new JglfwApplicationConfiguration(); config.width = (int) (width); config.height = (int) (height - height * .04); config.backgroundFPS = -1; config.foregroundFPS = 60; config.hiddenFPS = -1; config.vSync = false; config.title = "Overlap2D - v" + AppConfig.getInstance().version; new JglfwApplication(overlap2D, config); } "

@bruceloco I do not get black screen.

bruceloco commented 7 years ago

@meonlineonmess do you do ./gradlew run to run?

azakhary commented 7 years ago

well, no problem, I can do the change myself. But given it doesnot work for @bruceloco I guess this needs to be figured out first.

meonlineonmess commented 7 years ago

@bruceloco yes I do

meonlineonmess commented 7 years ago

./gradlew build then ./gradlew run

meonlineonmess commented 7 years ago

@azakhary @bruceloco do you know some updated tutorials or updated documentation for loading Overlap2D in libGDX? the code for Overlap2D is outdated.

bruceloco commented 7 years ago

Ok, so, this is somewhat interesting. I know why it does not redraw. So I have the same settings as you run the same commands however I get a black screen if I tab off to another app and tab again, now the menu appears. It is like it starts in the background and does not respond to anything because it assumes it is in the foreground then switch to another window and back and it now assumes foreground position and it starts working.

azakhary commented 7 years ago

@bruceloco I am curious if we can somehow "fake" that going back and forth to make it think it's in foreground on start. Maybe it's possible to stackoverflow that.

@meonlineonmess the docs on website should be latest: http://overlap2d.com/runtimes-documentation/ Scroll down to the tutorials section, and watch first video.

azakhary commented 7 years ago

@meonlineonmess also check out the runtimes wiki: https://github.com/UnderwaterApps/overlap2d-runtime-libgdx/wiki

bruceloco commented 7 years ago

@azakhary where is the overlap2 jar actually built? I can try to run this directly to make sure it is not an issue with my jdk/jvm There is a thread here: https://hub.jmonkeyengine.org/t/glfw-crash-on-macs/34719/16 where it basically says that threads are competing and in my case the java thread takes precedence and sends the jglfw thread into background

meonlineonmess commented 7 years ago

My .jar shows up here ->/Users/ublack/overlap2d/build/libs/overlap2d-0.1.3.jar however I can't run it and I don't know if it is the right jar for sure.

azakhary commented 7 years ago

to build a jar, you need to run "dist" gradle task.

meonlineonmess commented 7 years ago

I built mine using ./gradlew dist and when I start the program I also get black screen for a couple of seconds and then it opens.

bruceloco commented 7 years ago

same thing on the built jar, must be some sort of setting @meonlineonmess what's your jvm/jdk versions?

meonlineonmess commented 7 years ago

aBlacks-MacBook-Pro:~ ublack$ java -version java version "1.8.0_111" Java(TM) SE Runtime Environment (build 1.8.0_111-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode) aBlacks-MacBook-Pro:~ ublack$

azakhary commented 7 years ago

btw, if we put value 60, on all hidden, background and foreground, wouldn't it be still awesome CPU for all cases with no possible no-render bug? (as a compromise solution)

meonlineonmess commented 7 years ago

@azakhary I'll try

meonlineonmess commented 7 years ago

with 60,60,60 it still doesn't get hot but my FPS counter now shows it is using 68 fps to render the program. The process of Overlap doesn't go below 9% which means it is using resources that it should not use. It drains the battery faster.

bruceloco commented 7 years ago

I got java version "1.8.0_112" Java(TM) SE Runtime Environment (build 1.8.0_112-b16) wonder if that is the problem

bruceloco commented 7 years ago

@meonlineonmess can you try my jar? https://www.dropbox.com/sh/9dza1t1alaxc98x/AAADmV03TMLjYxmOezu5fxNSa?dl=0

meonlineonmess commented 7 years ago

@bruceloco I opened your jar and I get the same behaviour as before: black screen when opening and then after a couple of seconds it shows the content. I also get low fps and low cpu usage whether if the program is minimized, in or not in focus.

meonlineonmess commented 7 years ago

It seems to work ok despite the black screen at which one is supposed to wait a little.

bruceloco commented 7 years ago

i have it opened for a minute and nothing

meonlineonmess commented 7 years ago

@bruceloco I switched between programs and only after that it showed up the content.

bruceloco commented 7 years ago

whats your jdk? so it's not the player and not the source code, so we are up to the compiler now

azakhary commented 7 years ago

Maybe it's the you run it? double clicking, versus right click open or some other way, may make it go to background during the startup sequence, and silently come back, leaving jglfw think that it's still on background. imho it's either osx version difference, or just the way the app is executed.

bruceloco commented 7 years ago

@azakhary @meonlineonmess has the same behaviour as me running on his system with the app I built. I got OSX Sierra, 64bit. I am assuming that his is the same. So I am inclined towards the JDK version. I installed gradle via sdkman, I am using Gradle 3.3 My jdk is 1.8.0_112

bruceloco commented 7 years ago

Ok, if I do: System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Overlap2D"); LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.width = (int) (width); config.height = (int) (height); config.backgroundFPS =-1; config.foregroundFPS = 60; config.vSyncEnabled = false; config.title = "Overlap2D - v" + AppConfig.getInstance().version; new LwjglApplication(overlap2D, config);

for OSX it works, stays a couple seconds black but works But the switching of libraries here, using the LWJGL vs the JGLFW, not sure about the impact here

meonlineonmess commented 7 years ago

I use macOS Sierra 10.12.2 and Oracle JDK

java version "1.8.0_111" Java(TM) SE Runtime Environment (build 1.8.0_111-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

meonlineonmess commented 7 years ago

I wonder if VisEditor suffers from the same issue with the black screen. It also has the high CPU usage too and I saw the source code and it's the same issue there too with LwglApplication... Maybe after adding the settings for VisEditor like in Overlap2D, it will suffer from the same issue with the black screen. This could be a Hint.

bruceloco commented 7 years ago

also, I was just reviewing badlogic's repos and the lwjgl vs jglfw, and the jglfw repo has not been updated in 3 years. also the badlogic libs for both lwjgl and jglfw are also at least 2 years old and all the new stuff comes on lwjgl3. @azakhary any reason why the repo did not move?

bruceloco commented 7 years ago

@meonlineonmess lets keep the issue here based on overlap2D.

bruceloco commented 7 years ago

Also for future reference: VSync is enabled by default on OSX and cannot be disabled easily Someone created the following tool: https://www.tonymacx86.com/threads/beamsyncdropper-tool-to-disable-beamsync-permanently.92201/

meonlineonmess commented 7 years ago

@bruceloco As far as I remember BeamSyncDropper when I used this app it did not work in El Capitan or Sierra because the rendering was changed in these versions.

bruceloco commented 7 years ago

@meonlineonmess yeah, don't see any updates on the project for 2 years.

bruceloco commented 7 years ago

@meonlineonmess have you tried using lwjgl on mac? Since I don't have any project running I cannot see any issues/performance impact

meonlineonmess commented 7 years ago

@bruceloco no I didn't use it before

bruceloco commented 7 years ago

can you try with these settings? System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Overlap2D"); LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.width = (int) (width); config.height = (int) (height); config.backgroundFPS =-1; config.foregroundFPS = 60; config.vSyncEnabled = false; config.title = "Overlap2D - v" + AppConfig.getInstance().version; new LwjglApplication(overlap2D, config);

Thanks

azakhary commented 7 years ago

there was a reason we used Jglfw instead of Lwjgl. if you change it, other things will not work.

bruceloco commented 7 years ago

@azakhary does this include lwjgl3? or the standard lwjgl? you use it on windows, so there might be a mac bug or two which could easily be addressed no?

azakhary commented 7 years ago

standart lwjgl. so yeah, 3 might be good. dunno