Skip to main content
gamedev.net
🔒 Locked

1024*768 !!!

Started by citronrock Sep 12, 2005 at 3:00 PM 10 replies 1.2k views
Original Post
citronrock
citronrock
Hi everybody ! I want to display my picture ( 1024*768 pix ) in a 1024*768 mod ...... i don't kow why but my program is working well with small picture , and in a lower size ( for example : 640*480 ) . i think my loader is bad, because it need a picture like that : width=2^... and height=2^... someone know this problem ?? thx a lot !!!
deavik
deavik
Hi citronrock!

What loader are you using? Only OpenGL textures have to be 2n in width and height, and that too, not if you are using mipmaps. But if 640x480 is working, that isn't the problem. Does your application work? I mean, do you get a blank screen or does it crash? If it crashes, it's most probably memory overflow. Please post back ...
citronrock
citronrock

Hi ! thanks .

So , i'm using a tga loader, the man who made that one say that you have to do picture 2^ ... my application is working , i'v got a just a blank screen.
Maybe i need to change the loader .

I don't use mimaps because i don't know if a need to use and how it's working.. do i have to use mimap ..?



_the_phantom_
_the_phantom_
Quote:
Original post by deavik
What loader are you using? Only OpenGL textures have to be 2n in width and height, and that too, not if you are using mipmaps.


No, wrong.
Even mipmaps have to be a power-of-two. the glu function used by most people to build their mipmaps internally resizes the inital image to a power-of-two in size before it submits the data to OpenGL.
citronrock
citronrock
yes, ok ...so my pb is not finished yet ...
there is no way to do what i want, because in directX, it's very easy to do that but i don't want to use directX , come on there is a way !!!! plz
deavik
deavik
Quote:
Original post by phantom
the glu function used by most people to build their mipmaps internally resizes the inital image to a power-of-two in size before it submits the data to OpenGL.
Yes but that is what citronrock would be using I expect [smile].

Maybe you should post the tga loader for everyone to see, citronrock. That could be where the problem is.

EDIT: Thanks for correcting the part about the mipmaps, phantom.
Kalidor
Kalidor
If your TGA loader can only load images with a power of two dimension, don't use that loader. That is a serious flaw.

I recommend getting the TGA spec from Wotsit.org and writing your own loader. It really isn't that hard; you just need to follow the spec. If you don't want to do that then use some image loading library like Corona or DevIL. I have no experience with either of them though so I can't make a specific recommendation.

EDIT: I don't think that's actually your problem since you say it works with images that are 640x480, which is definitely not power of two dimensions. It would still probably be better to go with Corona or DevIL in the long run anyway.

EDIT2: There's FreeImage as well for you to check out.
Nychold
Nychold
Quote:
Original post by Anonymous Poster
how can i make my own mipmap function ??


In all honesty, it's more trouble than it's worth, but the principle is to compress an image from 2^n x 2^n to 2^(n-1) by 2^(n-1). The only way I know of doing that, without the aid of graphics libraries, is to take the surround pixels (3 at fewest, 8 at most), average them together, and output your new pixel. Then, skip over the next pixel in the scan line, and repeat until a quarter the pixels have been processed.

Oh and skip every other scan line too.
citronrock
citronrock
okok , good. So next pb !! i want to destroy a part of my image (.bmp ) , for example i want : when i click on the bitmap ( 52, 152 ) i want a little area next to my click vanished .... i don't kow what i have to do...maybe a matrix which contains bitmap pixel...and refresh , i don't know... however it's possible , worms is real no ? mmmm


deavik
deavik
Quote:
Original post by citronrock
okok , good. So next pb !!
Ohhh, pb is problem - really had me foxed for some time!

You should just capture the coordinates of the click (your input API should do that fairly easily). Then with the coords as reference, draw a quad with GL_QUADS that covers the region you want. Fill with (0, 0, 0) for black so that it looks like a chunk is missing.

Happy coding!

citronrock
citronrock
i'm gonna try this, i think is a good way , i'll tell you tomorow how it's working . Maybe, i'm not gonna use the mouse, but nothing will change .
thx see yous

Topic Locked

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

Sign in to reply to this topic.