1

Allegro 5 を使用して 2D レンダリングを処理し、Ogre を 3D レンダリングに使用するプログラムを作成しようとしましたが、初期化に問題があり、ウィンドウの hInstance であった問題のほとんどを解決しましたが、現在の問題は、Ogre::D3D9RenderWindow::setDevice()Ogre の型のみをID3Device9取得し、それが Ogre API リファレンスに従ってによって設定され、 をal_get_d3d9_device()返すものではないことLPDIRECT3DDEVICE9です。LPDIRECT3DDEVICE9を に変換する方法を理解しようとする助けが必要ID3Device9です。

これが私がこれまでに持っているコードです:

#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{

ALLEGRO_DISPLAY *al_display = NULL;

if(!al_init())
{
    fprintf(stderr, "Cannot initialize allegro");
    return -1;
}

al_display = al_create_display(640, 480);

if(!al_display)
{
    fprintf(stderr,"Cannot initialize the display");
    return -1;
}

HWND hWnd = al_get_win_window_handle(al_display);

HINSTANCE hInst = (HINSTANCE)GetWindowLong( hWnd, GWL_HINSTANCE);

Ogre::D3D9RenderWindow ogre_window(hInst);

ogre_window.setDevice(al_get_d3d_device(al_display)); // Function only takes an Ogre::D3D9Device

return 0;
}
4

2 に答える 2

1

OpenGL を使えば可能です。例は Allegro に付属しています

D3Dについてはわかりません。

于 2013-03-01T06:21:19.480 に答える