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 :-\