• D3D9和OpenGL加载纹理图片的API是哪个?


    D3D9

    创建一个空纹理,当返回 S_OKppTexture 纹理对象指针不为 NULL 时,则表示该函数调用成功。

    HRESULT D3DXCreateTexture(
      _In_  LPDIRECT3DDEVICE9  pDevice,
      _In_  UINT               Width,
      _In_  UINT               Height,
      _In_  UINT               MipLevels,
      _In_  DWORD              Usage,
      _In_  D3DFORMAT          Format,
      _In_  D3DPOOL            Pool,
      _Out_ LPDIRECT3DTEXTURE9 *ppTexture
    );
    
    HRESULT D3DXCreateTextureFromFileInMemory(
      _In_  LPDIRECT3DDEVICE9  pDevice,
      _In_  LPCVOID            pSrcData,
      _In_  UINT               SrcDataSize,
      _Out_ LPDIRECT3DTEXTURE9 *ppTexture
    );
    
    HRESULT D3DXCreateTextureFromFileInMemoryEx(
      _In_    LPDIRECT3DDEVICE9  pDevice,
      _In_    LPCVOID            pSrcData,
      _In_    UINT               SrcDataSize,
      _In_    UINT               Width,
      _In_    UINT               Height,
      _In_    UINT               MipLevels,
      _In_    DWORD              Usage,
      _In_    D3DFORMAT          Format,
      _In_    D3DPOOL            Pool,
      _In_    DWORD              Filter,
      _In_    DWORD              MipFilter,
      _In_    D3DCOLOR           ColorKey,
      _Inout_ D3DXIMAGE_INFO     *pSrcInfo,
      _Out_   PALETTEENTRY       *pPalette,
      _Out_   LPDIRECT3DTEXTURE9 *ppTexture
    );
    

    D3DXCreateTextureFromFileInMemoryD3DXCreateTextureFromFileInMemoryEx 函数下断(注意看纹理对象指针 ppTexture 是否和上面创建的纹理对象是否一致),一般就可以把内存中的图像保存下来了。上面三个函数参数具体含义,请自行查看 https://docs.microsoft.com/zh-cn/windows/desktop/api/_direct3d9/ 官网。

    OpenGL

    
    void glGetTexImage(
            GLenum target,
     	GLint level,
     	GLenum format,
     	GLenum type,
     	GLvoid * pixels
    );
     
    void glGetnTexImage(
            GLenum target,
     	GLint level,
     	GLenum format,
     	GLenum type,
     	GLsizei bufSize,
     	void *pixels
    );
     
    void glGetTextureImage(	
             GLuint texture,
     	GLint level,
     	GLenum format,
     	GLenum type,
     	GLsizei bufSize,
     	void *pixels
    );
    

    具体参数请自行参考OPENGL API:https://www.khronos.org/registry/OpenGL-Refpages/gl4/

  • 相关阅读:
    永无乡「HNOI2012」
    ruby基础知识之 class&module
    Linux命令集锦
    Ruby知识总结-一般变量+操作符+if+数组和哈希
    VMware通过VMnet8共享本地网络
    VMware Workstation 不可恢复错误 (vcpu-0)
    WIN10安装时msxml4.0提示2502、2503解决办法
    C# 委托知识总结
    request.servervariables参数
    判断MS SQLSERVER临时表是否存在
  • 原文地址:https://www.cnblogs.com/cheungxiongwei/p/10036932.html
Copyright © 2020-2023  润新知