Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (808)
Games in Android Showcase (239)
games submitted by our members
Games in WIP (872)
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 3214 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  

mercenarius (9 views)
2020-06-04 19:26:01

mercenarius (13 views)
2020-06-04 19:13:43

Riven (853 views)
2019-09-04 15:33:17

hadezbladez (5839 views)
2018-11-16 13:46:03

hadezbladez (2648 views)
2018-11-16 13:41:33

hadezbladez (6264 views)
2018-11-16 13:35:35

hadezbladez (1506 views)
2018-11-16 13:32:03

EgonOlsen (4742 views)
2018-06-10 19:43:48

EgonOlsen (5801 views)
2018-06-10 19:43:44

EgonOlsen (3292 views)
2018-06-10 19:43:20
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08 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!