Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (407)
games submitted by our members
Games in WIP (293)
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 402 times)
0 Members and 1 Guest are viewing this topic.
Offline Sparky83

Senior Member


Medals: 6
Projects: 1



« Posted 2013-03-14 22: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 22: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 22: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!
Play the free demo of Revenge of the Titans!
Offline deepthought
« Reply #3 - Posted 2013-03-14 22: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 23: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-15 00:14:53 »

Thanks for your advice. Smiley You helped me a lot! Both of you.
Pages: [1]
  ignore  |  Print  
 
 

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (94 views)
2013-05-17 21:29:12

alaslipknot (102 views)
2013-05-16 21:24:48

gouessej (132 views)
2013-05-16 00:53:38

gouessej (127 views)
2013-05-16 00:17:58

theagentd (138 views)
2013-05-15 15:01:13

theagentd (126 views)
2013-05-15 15:00:54

StreetDoggy (167 views)
2013-05-14 15:56:26

kutucuk (189 views)
2013-05-12 17:10:36

kutucuk (192 views)
2013-05-12 15:36:09

UnluckyDevil (199 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.113 seconds with 20 queries.