Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (426)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (466)
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  
  Texture Deletion Oddity  (Read 1039 times)
0 Members and 1 Guest are viewing this topic.
Offline Mojomonkey

Senior Member




ooh ooh eee eeee


« Posted 2003-04-23 20:48:50 »

I'm wrote a Texture manager class. It contains texture id's as issued by OpenGL, with key's to these Id's set to the filename of the texture itself.

There is a method called deleteAll that deletes all textures being managed.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
public void deleteAll() {
        LoggingSystem.getLoggingSystem().getLogger().log(Level.INFO,
            "Deleting All Textures");
        int id;
        String key;
        for(int i = 0; i < keyList.size(); i++) {
            key = ((TextureData)keyList.get(i)).file;
            id = ((Integer)textureList.get(key)).intValue();
            if(gl.isTexture(id)) {
                gl.deleteTextures(1, id);
            }
        }
       
        textureList.clear();
        keyList.clear();
    }


I'm having trouble with this call, specifically gl.deleteTextures(1, id).

I'm getting the following error:

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0xEF8CD90
Function=[Unknown.]
Library=C:\WINNT\System32\nvoglnt.dll

NOTE: We are unable to locate the function name symbol for the error
     just occurred. Please refer to release documentation for possible
     reason and solutions.


Current Java thread:
     at org.lwjgl.opengl.CoreGL.deleteTextures(Native Method)
     at monkey.texture.TextureManager.deleteAll(TextureManager.java:367)
     at monkey.texture.TextureManager.reload(TextureManager.java:104)
     at monkey.Game.mainLoop(Game.java:92)
     at monkey.Game.start(Game.java:59)
     at monkey.Game.main(Game.java:74)

with a long list of dynamic libraries.

This only seems to happen after I have changed the screen resolution and thus gl.destroy and gl.create have been called. I thought it may be due to me trying to delete a texture that doesn't exist, but I added the

if(gl.isTextured(id))

statement to take care of this. Any ideas?

Thanks,
Mark

Don't send a man to do a monkey's work.
Offline cfmdobbie

Senior Member




Who, me?


« Reply #1 - Posted 2003-04-23 22:28:15 »

By the 1.4 spec, the call in question is:

 void DeleteTextures( sizei n, uint *textures );

As this is a pointer to an array of unsigned integers, LWJGL will require you to pass it the address of an IntBuffer containing the id, even if there's only one id.

Also, it's possible that after deleting the GL context, all loaded textures will have been destroyed.  I have no idea whether this is true though.

The "if(gl.isTexture(id))" check works because that takes the id directly, rather than a pointer to it.

Hellomynameis Charlie Dobbie.
Offline Mojomonkey

Senior Member




ooh ooh eee eeee


« Reply #2 - Posted 2003-04-24 00:53:27 »

Ah thank you! I've been staring at the reference for glDeleteTextures in the blue book forever, and kept glazing right over the pointer. It's amazing how switching API and languages can really humble you when it comes to something you "thought" you knew how to do. Smiley

Thanks again.

Don't send a man to do a monkey's work.
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.

xsi3rr4x (72 views)
2014-04-15 18:08:23

BurntPizza (68 views)
2014-04-15 03:46:01

UprightPath (79 views)
2014-04-14 17:39:50

UprightPath (65 views)
2014-04-14 17:35:47

Porlus (80 views)
2014-04-14 15:48:38

tom_mai78101 (104 views)
2014-04-10 04:04:31

BurntPizza (164 views)
2014-04-08 23:06:04

tom_mai78101 (260 views)
2014-04-05 13:34:39

trollwarrior1 (210 views)
2014-04-04 12:06:45

CJLetsGame (220 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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!