• Advertisement

Archived

This topic is now archived and is closed to further replies.

Scaling Textures

This topic is 5361 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

Hi all, I''m loading and preparing textures using code culled from Nehe''s tutorials (lesson 6) and it works fine (thanks Nehe!). What I want to know is this... Once I load a bitmap I would like to scale it and reduce its size, say form 256x256 to 128x128... how do I do that? Thanks

Share this post


Link to post
Share on other sites
Advertisement
If you make the texture with glTexImage2D you can specify 1 as your mipmap level and it should do everything for you.

http://msdn.microsoft.com/library/en-us/opengl/glfunc03_16jo.asp?frame=true

Share this post


Link to post
Share on other sites
Hmmm... specifying one as the level of detail turns the texture into pure white.

Besides I''m not sure that''s what I''d want to do.... essentially I want to reduce the amount of video memory used to store a texture by reducing the texture size, but without changing the actual bitmap file.

Share this post


Link to post
Share on other sites
The solution is to make your own, homebrew re-scaler...

For a simple 256x256 to 128x128, it would look something like this


for(y=0;y<256;y++)
for(x=0;x<256;x++)
dst[x + (y*surface_pitch)] = src[(x*2) + ((y*2)*surface_pitch)];


Scaling images down can get pretty complicated.. Weighted interpolation, more accurate scaling techniques, and different dimentioned images...

Anyways, that''s a good starting ground.

-=|Mr.Oreo|=-
Code Monkey, Serpent Engine

Share this post


Link to post
Share on other sites

  • Advertisement