我正在寻找一种在鼠标点读取像素颜色的方法.在OpenGL中,它是在绘制场景(或部分场景)后调用函数"glReadPixels"完成的.我想在后台制作一个简单的颜色拾取程序,用于识别3D空间中的形状/线条.
那么,在SharpDX(DirectX10/DirectX11)中是否有相同的方法/功能/建议?
每次尝试通过MS Paint保存图片时,默认格式为.png,但我想要.jpeg,从MS Paint保存图片时如何将.jpeg设置为默认格式?我经常保存图片,我不想每次都更改格式。
我有一个 MS Word 文档包含一些文本和标题,我想提取标题,我安装了 Python for win32,但我不知道使用哪种方法,似乎 python for windows 的帮助文档没有列出功能的词对象。以下面的代码为例
import win32com.client as win32
word = win32.Dispatch("Word.Application")
word.Visible = 0
word.Documents.Open("MyDocument")
doc = word.ActiveDocument
Run Code Online (Sandbox Code Playgroud)
我怎么知道word对象的所有功能?我在帮助文档中没有找到任何有用的东西。
我在Windows 8上使用DirectX 9.0,当我打开DirectX控制面板时,我发现一些选项被禁用,我作为管理员运行,所以这不是特权问题.为什么会这样?我无法打开调试版本运行时,因为它已被禁用.见下图.我使用的SDK是2010年6月

创建光栅化器时,我像这样设置光栅化器描述:
rasterDesc.AntialiasedLineEnable = false;
rasterDesc.CullMode = D3D11_CULL_BACK;
rasterDesc.DepthBias = 0;
rasterDesc.DepthBiasClamp = 0.0f;
rasterDesc.DepthClipEnable = true;
rasterDesc.FillMode = D3D11_FILL_SOLID;
rasterDesc.FrontCounterClockwise = true;
rasterDesc.MultisampleEnable = false;
rasterDesc.ScissorEnable = false;
rasterDesc.SlopeScaledDepthBias = 0.0f;
Run Code Online (Sandbox Code Playgroud)
这工作正常。但是当我更改FrontCounterClockwise为false. 什么都没有渲染(我想一切都被剔除了)。我是否误解了目的FrontCounterClockwise?因为我在期待,它会将顺时针面作为正面而不是逆时针面。我究竟做错了什么?
编辑:这是完整的初始化代码:
bool irrFireDX11::INITIALIZE(int screenWidth, int screenHeight, bool vsync)
{
HRESULT result;
IDXGIFactory* factory;
IDXGIAdapter* adapter;
IDXGIOutput* adapterOutput;
unsigned int numModes, i, numerator, denominator, stringLength;
DXGI_MODE_DESC* displayModeList;
DXGI_ADAPTER_DESC adapterDesc;
int error;
DXGI_SWAP_CHAIN_DESC swapChainDesc;
ID3D11Texture2D* backBufferPtr;
D3D11_TEXTURE2D_DESC depthBufferDesc;
D3D11_DEPTH_STENCIL_DESC depthStencilDesc;
D3D11_DEPTH_STENCIL_VIEW_DESC depthStencilViewDesc;
D3D11_RASTERIZER_DESC …Run Code Online (Sandbox Code Playgroud) 例如yyyy-mm-dd,我想以这种格式获取日期2014-04-11。但似乎没有办法在 Sybase (ASE 12.5) 中使用convert函数来做到这一点。
目前,我得到 112 的日期并添加-数字之间。有什么好办法吗?
使用Direct2D,我可以使用ID2D1RenderTarget :: DrawText来绘制文本,但是如何在绘制之前获取文本范围?请注意,我希望在Windows 8 RT下执行此操作.
谢谢
当我打开DirectX控制面板并打开Direct3D 9选项卡并设置“使用Direct3D 9的调试版本”并单击“确定”或“应用”时,没有错误。如果再次打开控制面板,它将返回到“使用Direct3D 9的零售版”。尝试调试应用程序时,没有从Direct3D获得任何输出。
几个月前我上一次这样做时,一切正常,并且得到了调试输出。
以管理员身份运行控制面板似乎没有什么不同,这里提到的注册表项http://www.gamedev.net/topic/514529-cant-use-debug-version-of-direct3d/设置为一个。
我还能尝试什么?
我想写一个ContentManager为游戏加载和维护不同类型资产的类(与XNA的ContentManager相比).我的头文件如下所示:
class ContentManager
{
public:
ContentManager(Direct3D& d3d, const std::string& rootDirectory = "Resource");
~ContentManager();
template<typename T>
const T& Load(const std::string& assetName);
private:
Direct3D& d3d_;
std::string rootDirectory_;
std::map<std::string, Texture> textures_;
};
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,我有一个每种资产类型的地图(目前只针对纹理)和一个泛型Load<T>()方法,我会为我想要存储的每种资产类型显式实例化.Load<Texture>()从磁盘读取图像文件(如果它尚未在地图中),创建一个新的Texture,将其插入到地图中并返回它.
我的Texture班级基本上创建和封装了原始IDirect3DTexture9遵循RAII成语(析构函数调用Release()的texture_):
class Texture
{
public:
Texture();
Texture(Direct3D& d3d, unsigned int width, unsigned int height,
const std::vector<unsigned char>& stream);
~Texture();
IDirect3DTexture9* GetD3DTexture() const { return texture_; }
private:
IDirect3DTexture9* texture_;
}; …Run Code Online (Sandbox Code Playgroud)