Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (767)
Games in Android Showcase (230)
games submitted by our members
Games in WIP (854)
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  
  Jogl textures suddenly gone[solved]  (Read 1738 times)
0 Members and 1 Guest are viewing this topic.
Offline midramble

Junior Newbie

« Posted 2013-03-06 04:06:03 »

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

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  Undecided

Bourbon, Muddy Waters, Cigars, and Java MMORPG programming Cheesy
Offline HeroesGraveDev

JGO Kernel

Medals: 382
Projects: 11
Exp: 4 years

┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻

« Reply #1 - Posted 2013-03-06 06:38:01 »

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

Offline midramble

Junior Newbie

« Reply #2 - Posted 2013-03-06 07:18:03 »

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...  Clueless  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.... Huh

I'll keep updating. Thanks for the feedback HeroesGraveDev

Bourbon, Muddy Waters, Cigars, and Java MMORPG programming Cheesy
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline midramble

Junior Newbie

« Reply #3 - Posted 2013-03-13 02:38:14 »

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  Clueless

Bourbon, Muddy Waters, Cigars, and Java MMORPG programming Cheesy
Pages: [1]
  ignore  |  Print  

EgonOlsen (1328 views)
2018-06-10 19:43:48

EgonOlsen (1205 views)
2018-06-10 19:43:44

EgonOlsen (929 views)
2018-06-10 19:43:20

DesertCoockie (1354 views)
2018-05-13 18:23:11

nelsongames (1110 views)
2018-04-24 18:15:36

nelsongames (1359 views)
2018-04-24 18:14:32

ivj94 (2094 views)
2018-03-24 14:47:39

ivj94 (1251 views)
2018-03-24 14:46:31

ivj94 (2249 views)
2018-03-24 14:43:53

Solater (803 views)
2018-03-17 05:04:08
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 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‑
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!