Jump to content
  • Advertisement
Sign in to follow this  
magiconexxx

MAJOR bugs in lesson 33?

This topic is 4828 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to run the compressed TGA loading code from lesson 33. I took a basecode for Linux SDL and used the loading code. When i run the program, i constantly get a "too many pixels read" error, and the textures are completely messed up. Using original tga images from the lesson. The strange part is, if i load an uncompressed tga in an array before loading compressed tga's, everything displays correctly... still with too many pixel read errors, however. for ie: LoadTGA(texture[0], "Data/Compressed.tga"); LoadTGA(texture[1], "Data/Compressed.tga"); //does not work //but..... LoadTGA(texture[0], "Data/Uncompressed.tga"); LoadTGA(texture[1], "Data/Compressed.tga"); //this displays correctly, but still get errors Compiling original source code in lesson 33 works fine, until i change the first tga from uncompressed to compressed in the loop. Then things won't load or the program crashes. Can anyone make sense of this, or point me to a location for another tutorial on compressed tga loading? Compiling on Gentoo 2005.0 with KDevelop.

Share this post


Link to post
Share on other sites
Advertisement
there are many buggs in that code.
Lot's of memory leaks and the fact that it totaly ignores the image id part of the tga format.

that maked that code unable to load tga's created with newer image editors like photoshop cs2 or psp9.
Are you shure you didn't fiddle with the images?

but it's odd that it works sometimes and sometimes not.

Share this post


Link to post
Share on other sites
No i haven't done anything to those images. It seems to me that there is some sort of memmory overruns that mess up the other array elements.

I've used SDL's IMG_Load before, but i want to use the OpenGL 2D acceleration. From what i understand, RLE compressed TGA's are faster on the render pipe than normal TGA/BMP. Henceforth why i was trying to use lesson 33 to load compressed TGA's. I'm writing a game that will require alot of 2D bitmaps, so i'll need all the acceleration i can get.

Any suggestions?

Share this post


Link to post
Share on other sites
Actually, the compressed TGAs will perform EXACTLY THE SAME as ANY OTHER KIND of image you load. Why? Because in order to load it, you need to decompress it first. So, compressed or uncompressed, you end up with the same image data in memory. Compressing images will save you disk space, but definitely not give you better performance (in fact, you will get sligtly longer load times with compressed images).

Cheers!

Share this post


Link to post
Share on other sites
That's what i've read before... but then again, you can't trust everything on paper!

So maybe i'll stick to regular TGA files... at the very least i'll get the Alpha channel to play with.

Thanks for that bit of info!

Share this post


Link to post
Share on other sites
>> (in fact, you will get sligtly longer load times with compressed images).

I guess this depends...

If you have a very slow hard disk, or your images compress quite good, or compression is a fast algo you might even get a performance gain ;)

Cheers,
- Wernaeh

Share this post


Link to post
Share on other sites
Quote:
Original post by fyhuang
Actually, the compressed TGAs will perform EXACTLY THE SAME as ANY OTHER KIND of image you load. Why? Because in order to load it, you need to decompress it first. So, compressed or uncompressed, you end up with the same image data in memory. Compressing images will save you disk space, but definitely not give you better performance (in fact, you will get sligtly longer load times with compressed images).

Cheers!


You can load some compressed images directly into the video memory using ARB_texture_compression, but in this case, the TGA's are decompressed before uploading to the graphics card.

Share this post


Link to post
Share on other sites
But even so, you won't see any noticable difference in performance, correct?

If i decide to push 10,000 64x64x32 images to the screen every frame, it won't matter if i use bmp, tga, png, or any other bitmap image... OpenGL does it's own mathematics and storage to the image through MipMaps (P.S are mipmaps needed in a completely ortho 2D environment?) so where it recieves the data from is of no matter, correct?

Share this post


Link to post
Share on other sites
Quote:
Original post by magiconexxx
But even so, you won't see any noticable difference in performance, correct?

If i decide to push 10,000 64x64x32 images to the screen every frame, it won't matter if i use bmp, tga, png, or any other bitmap image... OpenGL does it's own mathematics and storage to the image through MipMaps (P.S are mipmaps needed in a completely ortho 2D environment?) so where it recieves the data from is of no matter, correct?



it won't matter because switching between textures takes time, a lot of time(relatively speaking that is).
And that problem will not be fixed until Nvidia and ATI introduce viritual texturing as carmack noted in his last quakecon keynote speach.
Allso all of them are loaded in memory the same way, totaly uncompressed.

And yes even in a true ortho 2d enviroment mipmapping is needed, it is not the distance from the camera that matters for mipmapping, but the size of the textels vs the size of the pixels.
Or in other words, if you can fit 4 textels in one pixel then it might be time to use a lower mipmap level.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!