adamdruppe / arsd

This is a collection of modules that I've released over the years. Most of them stand alone, or have just one or two dependencies in here, so you don't have to download this whole repo.
http://arsd-official.dpldocs.info/arsd.html
530 stars 128 forks source link

Normalize Window corrdinates #171

Open Aphexus opened 5 years ago

Aphexus commented 5 years ago

Was trying to get some graphics going and was confused by things being off...

Seems your code doesn't set the openGL window to be that of the viewport by default.

This code fixes it. glViewport(0, 0, cast(int)window.Width, cast(int)window.Height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, window.Width, -window.Height, 0, -1, 1); glScalef(1.0f, -1.0f, 1.0f);

adamdruppe commented 5 years ago

Are you using the gamehelpers.d create2dWindow function?

simpledisplay by itself doesn't create any matrix, but it does call glViewport after window resizes.