• Advertisement
Sign in to follow this  

Change win32 origin?

This topic is 547 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

 

 

Share this post


Link to post
Share on other sites
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);
}

Share this post


Link to post
Share on other sites

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.

Edited by BadEggGames

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement