SFML community forums
Help => Graphics => Topic started by: Bakura on August 25, 2007, 06:43:07 pm
-
Hi !
Before I loaded my images textures with Corona and in order to render the texture correctly, I had to flip them about the X axis (or Y axis, don't remember).
Now I load them with sfImage :
sfImage Image;
if (!Image.LoadFromFile (m_sMaterial.nomTexture))
return EXIT_FAILURE;
glGenTextures (1, &m_uiTexture);
glBindTexture (GL_TEXTURE_2D, m_uiTexture);
glTexParameteri (GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, Image.GetWidth(), Image.GetHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, Image.GetPixelsPtr());
The texture can be seen, but it's not well drawn, like those I loaded with corona without the flip. So, is there any flip functions in order to draw that ? Or it can be another problem ?
-
So far, it has always worked fine. Are you sure your texture coordinates are ok ?
-
Hi (Sorry for my english :s ),
Look
gluOrtho2D( 0, 1024, 768, 0);
If you're function is :
gluOrtho2D( 0, 1024, 0, 768);
The image is flip on the Y axis.
This :
gluOrtho2D( 1024, 0, 768, 0);
The image is flip on the X axis.
It's just a idea :roll: .
-
So far, it has always worked fine. Are you sure your texture coordinates are ok ?
I just checked with Corona and a flip, and it works, so the problem is with SFML I think. Furthermore the ASE file was generated with Blender, so I don't think :/.
-
But why do you also need a flip with Corona, if your code is ok ?
-
I don't know :/.
-
Because your code is wrong ? :roll:
-
same problem here, but i solve that.
data in corona,freeimage.lib (img->getPixels() or FreeImage_GetBits) are placed from bottom to top. not top to bottom.
use:
FreeImage_FlipVertical(FIBITMAP *dib);. (in freeimage)
or
FlipImage(Image* source, CA_Y); (in corona)
thats not foul of sfml.
sry, for english.
-
Oh ! I think I remember the problem :|. Sorry Laurent, I think it's my fault.
In fact, in order to avoid "flip" the image, I just remember that when I was using Corona, I flip the image with Paint, so I didn't need to do that in the program. But now, with SFML... The texture is still flip with Paint (I have some models I always use for my tests :p) :p.
I'll try to "unflip" the image :).
-
Ok ;)