Jump to content
  • Advertisement
Sign in to follow this  
MuonChoi

OpenGL problem in texturing image

This topic is 5407 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 suppose to make a checker image with 15x15, I know that in openGL the image must be in power of 2. I'm using mipmaping to generate a checker board. how do you get around this problem?

Share this post


Link to post
Share on other sites
Advertisement
You could have the texture be a power of two but not use the entire thing on your quad. Just put your 240*240 image into a 256*256 texture and use texcoords in the range [0,.9375] instead of [0,1].

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
that's a good idea, but i have to be the one to wonder about resources. is this method the best way to do it? does anyone else have any other suggestions?

Share this post


Link to post
Share on other sites
If you don't mind it only working on some cards you could use the extension for non-power-of-two textures. Or you could wait for OpenGL 2.0 to come out, which drops that requirement (the user's card would have to be 2.0-compatible for that). You could also pre-scale the texture to 16*16 and just display it on a screen area of 15*15 pixels. I think that my previous suggestion would provide the best compatibility/quality, though.

If you want just a checker pattern you could use simple untextured quads, but it would probably use more GPU power. With texture compression a checkerboard might be extra-efficient (I'm not sure how texture compression works internally). That's a choice between power and memory, but very small quantities of either.

Share this post


Link to post
Share on other sites
your solution it only work for one image texturing, but if I'm using a mipmap, then when I shrink the image to lower level, it display incorrect. so is there any other suggestion.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!