Jogl textures suddenly gone[solved]

Hi all, I’d like to start off by saying I love this site and that this is my first actual post. ;D

Alright, so here’s the story…

I had a program which created objects and put them in a main list (arraylist). These objects would load an image into a texture data buffer map (map so that they had a string identifier) and when the renderer class display method was called from the fpsanimator it would iterate over the buffer map, using the textureIO.newtexture method (because the context is now current), load it into a loadedtexture map, enable the texture, call the display method of each object in the main list, and then clear the buffer. These display methods would bind the needed textures from the loadedtexture map in my renderer class and execute the drawing functions.

This program would normally render correctly. Though I started obviously having simultaneous modification errors on my buffer map because of my main thread adding textures at the same time the animator thread is causing the renderer display thread to iterate over the buffer.

Instead of creating a synchronized modification method for the map I decided to instead make it an arraylist where the main thread could write textures to the end of the list while the animator thread could peal off the first object in the list to use textureIO so that there were no longer thread collisions. To do this I had to make it an arraylist of object[2] with the 0 value being the string identifier and the 1 value being the texture.

Now the textures aren’t showing up. After a bit of ghetto debugging I know that the string identifiers in the loadedtexturemap are correct and that the texture data of each key/value pair at least has the correct img height/width showing that they at least aren’t null or duplicated. I’m not sure how to println straight pixel array data of textures to make sure that the textures actually have data that should be rendering (btw the textures are RGBA png)

I guess my question is, how (in debugging) can I determine if the texture that I am using has valid data?

Also the only reason I haven’t uploaded the code yet is because it seems like a lot to upload here and I’m a bad bad programmer for not putting good comments to make the code readable. I’ll upload at least the applicable methods once I get my comments in there :-\

1: Use a HashMap.
2: Load all the textures at the start of the game.

Sorry, I should have been a bit more specific. The maps I am using are hashmaps and I can’t load EVERY texture at the beginning because there are a massive amount of textures. I’m having the textures loaded based on needs of the zone that the player is in at that moment.

Update: I just tried rewriting the program with a new class called texture pack that has a String Name field and TextureData Data field and created an arraylist with this object (just in case the object[] arraylist concept was what was causing the problem.) Results are still the same, so I’m thinking something may be bad with the input stream… :clue: Again, it’d be great if I could find a way to look at the actual pixel array of the texture to see if there is anything there… ???

I’ll keep updating. Thanks for the feedback HeroesGraveDev

Hahaha wooow. Whelp this was a case of severe over-thinking haha. I did end up optimizing my rendering pipeline as a result though, which isn’t a bad thing. Turns out that all that happend was when I modified my first loaded png and replaced it, I somehow saved it at non power of 2 size. All’s fine now. Back to pounding out code and sorry for wasting forum space haha :clue: