Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Problem with texture

This thread is locked; no one can reply to it. rss feed Print
Problem with texture
Scooter
Member #16,799
January 2018

Hi guys:
I finally got a rotating cube to work! So, not just happy with that
I decided to try my hand at textures. I really got into something this
time, but after many hours, I finally got it to work this morning!
I ended up with a couple of problems that I can't figure out:
#1 - the colors on my texture do not match my BMP file. I tried to
use glEnable and glDisable at the correct locations in the program
but I can't get the colors correct.
#2 - the image in the texture is not centered.

If someone has the time I would like for you to take a look and see what
the problem is. I have it rotated on the z axis so you can see what I mean.
It was written on a Linux machine so it might be all messed up when viewed
on a Windows machine. Thanks for your time!!!!

Attached please find the source and a copy of mario.bmp

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Scooter
Member #16,799
January 2018

Edgar:
Thanks for replying to my problem! I have been working off and on
today to try to fix this. Suspecting my file loader was the problem,
I half way started a program to generate a 2D rectangle and put this
file on it as a texture. I ended up with exactly the same problem.
That proves without a doubt that my file loader is the problem. I will
check out these headers tomorrow and see what I can find out. Thanks
again and I hope all is well with you!

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Scooter
Member #16,799
January 2018

Hi Edgar:
I got involved in something this morning using BMP files
and solved my problem. It turns out my BMP file loader works
fine like it is as far as the colors are concerned. The problem
turned out to be the way I converted the file. I used GIMP Image
Editor to convert the JPG file to a BMP file. I knew ahead of time
it needed to be a 24 bit file. The problem was when I told it to
convert the file. Under Compatibility Options I should have check
the box for "Do not write color space information". After I did
this my program works fine. Colors on the cube match perfectly with
the original file. Thought I would pass this info on to help others
that may have run into the same problem.

Go to: