Change win32 origin?

Started by
1 comment, last by BadEggGames 7 years, 7 months ago

Hi

Win32 has the top left corner as the origin. I want the bottom left corner to be the origin as my raytracer defines the view place by bottom left.

When i render, my sky gradient is upside down for example because of this.

I have tried: SetViewportOrgEx(hdc, 0, height, NULL);

But it does nothing.

Any help would be greatly appreciated.

Thanks

Advertisement

I'm not sure if there are such abilities in the Win32 API.

But for sure you could just revert it yourself by the code with few overhead:

void drawPixel(int x, int y, Vec3 color)
{
    someW32PrintPixel(x, viewportHeight-y, color.rgb);
}

Thanks, but i figured it out.


SetMapMode(hdc, MM_ISOTROPIC);
SetViewportOrgEx(hdc, 0, height, NULL);
SetWindowExtEx(hdc,1, -1,NULL);
SetViewportExtEx(hdc,1, 1,NULL);

Sets the y axis origin to the bottom then flips the y axis.

This topic is closed to new replies.

Advertisement