如何弄湿DerectX 9中的左上角坐标?

编程入门 行业动态 更新时间:2024-10-24 16:29:00
本文介绍了如何弄湿DerectX 9中的左上角坐标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

你好!! 我需要在DirectX 9中绘制一些东西。 我有兴趣以坐标的方式工作将被调整为像素,而(0,0)将是 TopLeft 角。以下是我的工作:

Hello!! I need to draw something in DirectX 9. I am interested to work in a way that the coordinates will be adjusted to pixels, while (0,0) will be the TopLeft corner. Here is what I do:

RECT clientRect; ::GetClientRect(m_hWIN, &clientRect); D3DXMATRIX matOrtho2D, matIdentity; D3DXMatrixOrthoOffCenterLH(&matOrtho2D, 0, clientRect.right, 0, clientRect.bottom, 0.0f, 1.0f); D3DXMatrixIdentity(&matIdentity); g_pDirect3D_Device->SetTransform(D3DTS_PROJECTION, &matOrtho2D); g_pDirect3D_Device->SetTransform(D3DTS_WORLD, &matIdentity); g_pDirect3D_Device->SetTransform(D3DTS_VIEW, &matIdentity);

这个工作正常,除了(0,0) )是 BottomLeft 一角。如何更改它? 谢谢!

This works fine, except the (0,0) is the BottomLeft corner. How can I change it? Thanks!

推荐答案

DirectX使用图像左侧的底部作为其原点,如这里 [ ^ ]。 DirectX uses the bottome left of the image as its origin, as described here[^].

这应添加到代码: This should be added to the code: D3DXMatrixTranslation(&matTranslate, 0, (float)clientRect.bottom, 0.0f); D3DXMatrixRotationX(&matFlip, D3DXToRadian(180)); D3DXMATRIX matCoordTransform = matFlip * matTranslate; g_pDirect3D_Device->SetTransform(D3DTS_WORLD, &matCoordTransform);

更多推荐

如何弄湿DerectX 9中的左上角坐标?

本文发布于:2023-11-09 06:05:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1571584.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:左上角   坐标   弄湿   DerectX

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!