Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
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 823 times)
0 Members and 1 Guest are viewing this topic.
Offline Sparky83

Senior Member


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:


1  
2  
      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

EDIT:
createShader is the following method:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
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);
      GL20.glCompileShader(shader);
       
      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()?

jocks rule the highschools. GEEKS RULE THE WORLD MWAHAHAHA!!
captain failure test game
Offline Sparky83

Senior Member


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...
...
oh!
... 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.

jocks rule the highschools. GEEKS RULE THE WORLD MWAHAHAHA!!
captain failure test game
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 Member


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.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

TehJavaDev (17 views)
2014-08-28 18:26:30

CopyableCougar4 (26 views)
2014-08-22 19:31:30

atombrot (39 views)
2014-08-19 09:29:53

Tekkerue (36 views)
2014-08-16 06:45:27

Tekkerue (33 views)
2014-08-16 06:22:17

Tekkerue (22 views)
2014-08-16 06:20:21

Tekkerue (33 views)
2014-08-16 06:12:11

Rayexar (67 views)
2014-08-11 02:49:23

BurntPizza (45 views)
2014-08-09 21:09:32

BurntPizza (36 views)
2014-08-08 02:01:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org 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‑gaming.org
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!