Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (636)
Games in Android Showcase (178)
games submitted by our members
Games in WIP (688)
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  
  LWJGLs window closed but javaw.exe still running  (Read 1391 times)
0 Members and 1 Guest are viewing this topic.
Offline Sparky83

Senior Devvie

Medals: 6
Projects: 1

« Posted 2013-03-14 21:01:19 »

Hello! Smiley

I just started learning using shaders with LWJGL and encountered a small problem. The program works fine, that is not the problem. But after exiting through clicking on the closing button of the window the process is still running. After like 10 seconds it stops too. But why does it last that long. It doesn't if I don't do these two lines:

      vertShader = createShader("shaders/rgb.vert",GL20.GL_VERTEX_SHADER);
      fragShader = createShader("shaders/simple.frag",GL20.GL_FRAGMENT_SHADER);

Is this a normal process or is there something I might have forgotten. Is it possible to fix this and why does it occur?
I would be glad if someone had an answer to it. Smiley

createShader is the following method:
private int createShader(String path, int shaderType) {
      int shader = 0;
      FileReader reader = new FileReader();
      String program = reader.readFile(path);
      shader = GL20.glCreateShader(shaderType);
      if(shader == 0)
         return 0;
      GL20.glShaderSource(shader, program);
      if (GL20.glGetShader(shader, GL20.GL_COMPILE_STATUS) == GL11.GL_FALSE)
      throw new RuntimeException("Error creating shader: " + GL20.glGetShaderInfoLog(shader,GL20.GL_INFO_LOG_LENGTH));
      return shader;
Offline deepthought
« Reply #1 - Posted 2013-03-14 21:36:32 »

do you call Display.Destroy()?

Mad Scientist
Offline Sparky83

Senior Devvie

Medals: 6
Projects: 1

« Reply #2 - Posted 2013-03-14 21:42:20 »

Don't think so... wait, I'll take a look. Wink

*going down the stairs to eclipse*
... tap, tap, tap...

No, I really didn't do this! And it seems that exactly this was the problem, because now it works fine. I often forget those things...
Thanks for your help! Smiley *carving your name into medal*

But why exactly does it behave like that? :O
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline deepthought
« Reply #3 - Posted 2013-03-14 21:45:19 »

calling Display.destroy() tells lwjgl to start cleaning up. I guess when you exit without calling Display.destroy it's left to the system to figure out what needs to be cleaned up.

Mad Scientist
Offline StumpyStrust
« Reply #4 - Posted 2013-03-14 22:58:29 »

When using JFrames you will notice that you have to call the show() method. Many programs run in the background without a GUI or without showing a GUI. Think of windows minimized. If you call exit or some other similar function, it does not necessarily mean, "close everything and release resources" It could mean, close GUI. So most programs have a cleanUp method or something that will be called when the app completely ends. That is what Display.distroy() does. You also should handle any auto saving or something before you call that.

Offline Sparky83

Senior Devvie

Medals: 6
Projects: 1

« Reply #5 - Posted 2013-03-14 23:14:53 »

Thanks for your advice. Smiley You helped me a lot! Both of you.
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Dwinin (75 views)
2015-11-07 13:29:08

Rems19 (81 views)
2015-10-31 01:36:56

Rems19 (81 views)
2015-10-31 01:32:37

williamwoles (107 views)
2015-10-23 10:42:59

williamwoles (93 views)
2015-10-23 10:42:45

Jervac_ (112 views)
2015-10-18 23:29:12

DarkCart (137 views)
2015-10-16 00:58:11

KaiHH (118 views)
2015-10-11 14:10:14

KaiHH (159 views)
2015-10-11 13:26:18

BurntPizza (173 views)
2015-10-08 03:11:46
Rendering resources
by Roquen
2015-11-13 14:37:59

Rendering resources
by Roquen
2015-11-13 14:36:58

Math: Resources
by Roquen
2015-10-22 07:46:10

Networking Resources
by Roquen
2015-10-16 07:12:30

Rendering resources
by Roquen
2015-10-15 07:40:48

Math: Inequality properties
by Roquen
2015-10-01 13:30:46

Math: Inequality properties
by Roquen
2015-09-30 16:06:05

HotSpot Options
by Roquen
2015-08-29 11:33:11 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‑
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!