rotate Image on openGL

Hi,

I am loading a model on opengl.
when I save the model to a tiff file, I can see it as a mirror pic of the X axis .

How can I change it so I can see it as it loads on OpenGL?

Thanks

I’m not sure what exactly you are trying to do, but please be aware that in OpenGL®, the origin is at the bottom left with the Y axis going up, while most image file formats have the origin at the top left with the Y axis going down, so a simple frame buffer image dump will look upside down. Is this what you meant by mirrored around the X axis?

yes , so I see my model execly as it is but reversed.
How can I fixed it ?

so I can see my model in the irfan View as I see it in the openGL?
when I open irfan View my model is seen like a mirror toward down…

If you are using some library for exporting the framebuffer image, tell the library to store the image in reverse order.

If that is for some reason not possible, you will have to iterate over half of the image scanlines and swap scanline y with scanline height-y-1

Ok , I will look for it.

can you help me here? :

https://www.opengl.org/discussion_boards/showthread.php/183890-calculate-zBuffer-accept-wrong-values?p=1258610#post1258610

Thanks!

I am using this func by Assimp::Importer Importer
How can I change the scaling?

bool Mesh::LoadMesh(const std::string& Filename)
{
Clear();

bool Ret = false;
Assimp::Importer Importer;

const aiScene* pScene = Importer.ReadFile(Filename.c_str(), aiProcess_Triangulate | aiProcess_GenSmoothNormals | aiProcess_FlipUVs);

if (pScene) {
    Ret = InitFromScene(pScene, Filename);
}
else {
    printf("Error parsing '%s': '%s'

", Filename.c_str(), Importer.GetErrorString());
}

return Ret;

}

maybe I should use this commands: glTranslatef, glRotatef?

WRONG end of the rendering pipeline.

What I suggested is flipping the exported image, not the entire scene.

Btw: The only input transformation that would do the job would be glScalef( 1.0, -1.0, 1.0 )

I tried this and nothing change.I still see the model rotated to the X axis…

What did you try?

Somewhere in your code, there must be a function like this:


void export_image( ... )
{
    ......
    glReadPixels( .... );
    .....
    write_to_tiff_file_somehow( .... );
}

What you have to do here is to flip the image upside down before exporting:


    .....
    for( y=0; y<height/2; ++y )
    {
        swap_scanlines( image, y, y-height-1 );
    }
    .....