Jump to content
  • Advertisement
Sign in to follow this  
MorrisK

Mirroring an JPEG-image

This topic is 4947 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! I want to try to mirror an image, but it didn't work. I used the command glReadPixels to import the picture in the buffer and now I have to mirror it. I tried this with the command glScalef(1,-1,1); but it didn't work. I have to refer to the image buffer, right? But how does it work? Code: JSAMPLE * image_buffer=new JSAMPLE[582*500*3]; glPixelStorei(GL_PACK_ALIGNMENT,1); glReadPixels(0,0,582,500,GL_RGB,GL_UNSIGNED_BYTE,image_buffer); glScalef(1,-1,1); write_JPEG_file ("test.jpg",100,image_buffer,582,500); delete image_buffer; Thanks and a happy new year!

Share this post


Link to post
Share on other sites
Advertisement
Mirror the image buffer before write your jpeg file...?!?

something like this


//FlipX
for(y=0; y<height; y++){
for(x=0; x<width/2; x++){
SwapPixels(x,y, width-x-1,y);
}
}

//FlipY
for(x=0; x<width; x++){
for(y=0; y<height/2; y++){
SwapPixels(x,y, x,height-y-1);
}
}


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!