简体   繁体   English

Image.getGraphics()导致崩溃

[英]Image.getGraphics() causing crash

Whenever I use the method getGraphics() from org.newdawn.slick.Image in fullscreen mode, it causes a crash. 每当我在全屏模式下使用org.newdawn.slick.Image中的getGraphics()方法时,都会导致崩溃。 It works perfectly fine in windowed mode, and I've tried doing stuff like Graphics g = new Image(100,100).getGraphics() , this also causes the crash. 它在窗口模式下可以正常工作,并且我尝试过执行Graphics g = new Image(100,100).getGraphics() ,这也会导致崩溃。

I am using Slick2D 我正在使用Slick2D

This is the output I get: 这是我得到的输出:

Tue May 07 14:58:08 CEST 2013 INFO:Slick Build #264
Tue May 07 14:58:09 CEST 2013 INFO:LWJGL Version: 2.9.0
Tue May 07 14:58:09 CEST 2013 INFO:OriginalDisplayMode: 1366 x 768 x 32 @59Hz
Tue May 07 14:58:09 CEST 2013 INFO:TargetDisplayMode: 640 x 480 x 32 @59Hz
Tue May 07 14:58:10 CEST 2013 INFO:Starting display 640x480
Tue May 07 14:58:10 CEST 2013 INFO:Use Java PNG Loader = true
Tue May 07 14:58:10 CEST 2013 INFO:Controllers not available
Tue May 07 14:58:10 CEST 2013 INFO:Offscreen Buffers FBO=true PBUFFER=true PBUFFERRT=false
Tue May 07 14:58:10 CEST 2013 DEBUG:Creating FBO 320x240
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x50576337, pid=2120, tid=2300
#
# JRE version: 7.0_17-b02
# Java VM: Java HotSpot(TM) Client VM (23.7-b01 mixed mode, sharing windows-x86 )
# Problematic frame:
# C  [ig4icd32.dll+0x406337]  ShGetUniformLocation+0x2581e7
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Users\Dadibom\workspace\Game\hs_err_pid2120.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#    

I've tried different images, different resolutions, different framerates, etc. but nothing works when in fullscreen. 我尝试了不同的图像,不同的分辨率,不同的帧率等,但是在全屏模式下却没有任何效果。

I've tried updating my drivers but with no luck! 我尝试更新驱动程序,但是没有运气!

I think the problem is just your GPU is being overloaded when you try to save the screen as an image. 我认为问题在于,当您尝试将屏幕另存为图像时,GPU正在过载。

A bit of digging around online suggests you might be working with a computer that uses an lightweight (and low power consuming) integrated GPU for most tasks and is supposed to switch over to a dedicated GPU for things like gaming. 在线上进行一些挖掘表明您可能正在使用一台使用轻量级(且功耗低)集成GPU来执行大多数任务的计算机,并且应该将其切换到专用GPU来进行游戏。 The problem then is that your Slick2D game is not triggering the switch from the integrated GPU over to the dedicated GPU. 问题是您的Slick2D游戏不会触发从集成GPU切换到专用GPU的操作。

You can read a bit more in this thread for another Java game: 您可以在此线程中阅读其他Java游戏的更多内容:
http://forum.wurmonline.com/index.php?/topic/71698-2fps-and-crashing/?p=708815 http://forum.wurmonline.com/index.php?/topic/71698-2fps-and-crashing/?p=708815

The solution suggested is to tell Nvidia to use the dedicated GPU for your Java application. 建议的解决方案是告诉Nvidia将专用GPU用于Java应用程序。

On the forum thread above, Brash_Endevors points you to a nice video walkthrough of this: 在上面的论坛主题中,Brash_Endevors会为您提供一个不错的视频演练:
http://www.frequency.com/video/how-to-whitelist-game-with-nvidias/24814032 http://www.frequency.com/video/how-to-whitelist-game-with-nvidias/24814032

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM