I am trying to code a resize function. I have found that the Scale parameters in GRRLIB_DrawImg seem to work in increments of whole numbers (ie. 100%, 200%, 300%) but they don't allow for partial increments inbetween. They also don't seem to draw anything if the scale is less than 100%.
So my theory. Create an empty texture and then map the original texture to the empty one using the necessary scale. However, before I embark on that project I want to learn the basics of creating and empty texture and filling it. So I have written some code that should create a 255 by 255 texture which has a gradient (top left corner is black, top right is blue, bottom left is red and bottom right is purple).
Here is my code snippet:
int x, y;
u32 c;
GRRLIB_texImg MyTex;
MyTex = GRRLIB_CreateEmptyTexture(255,255);
for(y=0;y<255;y++)
{
for(x=0;x<255;x++)
{
c = 0;
c = c + y*0x1000000; // Set R
c = c + x*0x100; // Set B
c = c + 0xFF; // Set A
GRRLIB_SetPixelTotexImg(x,y,MyTex,c);
}
}
GRRLIB_FlushTex(MyTex);
However when I run this code it creates a square with the correct colors - somewhat - but the image has black stripes through it and the beginning of the line seems to shift.
I tried using 1->255 instead of 0 to 254 and even 0->255 but none of it makes any significant difference.
Can anyone point me in the direction of my error?
Edited 2 time(s). Last edit at 03/16/2010 03:59AM by LordAshes.