public void Draw2dQuad(int textureid, float dx, float dy, float dw, float dh) { Mat4.Identity_(mvMatrix); Mat4.Translate(mvMatrix, mvMatrix, Vec3.FromValues(dx, dy, 0)); Mat4.Scale(mvMatrix, mvMatrix, Vec3.FromValues(dw, dh, 0)); Mat4.Scale(mvMatrix, mvMatrix, Vec3.FromValues(one / 2, one / 2, 0)); Mat4.Translate(mvMatrix, mvMatrix, Vec3.FromValues(one, one, 0)); SetMatrixUniforms(); if (cubeModel == null) { cubeModel = p.CreateModel(QuadModelData.GetQuadModelData()); } p.BindTexture2d(textureid); p.DrawModel(cubeModel); }
void DrawScene(float dt) { p.GlViewport(0, 0, viewportWidth, viewportHeight); p.GlClearColorBufferAndDepthBuffer(); p.GlDisableDepthTest(); p.GlDisableCullFace(); { //Mat4.Perspective(pMatrix, 45, one * viewportWidth / viewportHeight, one / 100, one * 1000); //Mat4.Identity_(mvMatrix); //Mat4.Translate(mvMatrix, mvMatrix, Vec3.FromValues(0, 0, z)); } { Mat4.Identity_(pMatrix); Mat4.Ortho(pMatrix, 0, p.GetCanvasWidth(), p.GetCanvasHeight(), 0, 0, 10); } screen.Render(dt); }