Skip to main content
GameDev.net gamedev.net
🔒 Locked

compression

Started by Harrism Jan 28, 2006 at 7:04 PM 6 replies 800+ views
Original Post
Harrism
Harrism
Say you wanted to use your own compression. Reasons don't matter. Would it be possible to use the decompressed bitmap contents directly from memory as a texture rather than decompressing it, saving it to a filename and loading it from there? say x = 'entire contents of bitmap'; instead of auxDIBImageLoad(filename); I'm just asking if it's possible. If it's already in memory it'll be faster to load, rather than copying it back to the hard disc then having it resubmitted back to memory.
DaBono
DaBono
Yes, that's possible. You would have to decompress the image to a format OpenGL understands. Then you could (for example) use the glTexImage2D-function to upload the texture from main memory to video memory.
Harrism
Harrism
Thankyou
Harrism
Harrism
It'd end up being a bitmap, I would think GL would understand this, altho if it was being moved from memory to video memory as you put it, I'm not sure if I'd have to translate it myself first. OpenGL could be so much better at handling this.

Would gluBuild2DMipmaps be another possible subroutine? since glTexImage2D can only load to a dimention to the power of 2.
Harrism
Harrism
Don't worry I think I understand it after reading the documentation on gluBuild2DMipmaps. I think I understand how it works. Ta.
AAAP
AAAP
for the record, you can upload textures with non-power of 2 sizes, but they are handled very slowwwwwwwwwly. I really noticed this when I was trying to port secret maryo chronicles from sdl to pure openGL. most of their graphics werent sized optimally and I was all like WHY THE HELL IS IT RUNING SO SLOWWW lol.
|aaap.penopticon.com| My website, including game projects. Collaboration/comments are welcome, please visit :)
AlgorithmX2
AlgorithmX2
Quote:
Original post by AAAP
for the record, you can upload textures with non-power of 2 sizes, but they are handled very slowwwwwwwwwly. I really noticed this when I was trying to port secret maryo chronicles from sdl to pure openGL. most of their graphics werent sized optimally and I was all like WHY THE HELL IS IT RUNING SO SLOWWW lol.


This is not true for all cards, most older cards will simply fail the function and hope you do something about it, you'll usually end up with a white blank texture. on some newer cards you get extreamly slow proformance, and on the newest cards, that support NON_POWER_OF_TWO extention, you get full proformance.

I seek knowledge and to help others whom seek it
StPapyna
StPapyna
NON_POWER_OF_TWO is an core feature in GL 2.0, on NVIDIA 6XXX and newer hardware support this. But still strongly support use pow of 2 texture.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.