So ich bin es mal wieder. Hatte Zeit mich mal diesem Problem zu widmen.

Ich habe das jetzt mal nur mit einem Kanal (View) ausprobiert. Doch nun habe ich das Problem, dass die Welt der Engine nicht in meinem "g_pd3dDevice" ist. In diesem Objekt müsste ein komplett gerenderter Frame inklusive BeginScene und EndScene sein.

Im WDL steht: -------------------------------

function main()
{
MAX_PARTICLES = 10000;
if (curlevel==1){ level_load(welt);}
else{ level_load(welt);}
initDome();
wait(2);
}

render_sky = initSPI();
render_entities = closeSPI();

------------------------------

In der dll steht: -----------

VOID SetupMatrices()
{
// For our world matrix, we will just leave it as the identity
D3DXMATRIXA16 matWorld;
D3DXMatrixRotationY( &matWorld, timeGetTime()/1000.0f );
g_pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );

// Set up our view matrix. A view matrix can be defined given an eye point,
// a point to lookat, and a direction for which way is up. Here, we set the
// eye five units back along the z-axis and up three units, look at the
// origin, and define "up" to be in the y-direction.
D3DXVECTOR3 vEyePt( 0.0f, 0.0f,-3.0f );
D3DXVECTOR3 vLookatPt( 0.0f, 0.0f, 0.0f );
D3DXVECTOR3 vUpVec( 0.0f, 1.0f, 0.0f );
D3DXMATRIXA16 matView;
D3DXMatrixLookAtLH( &matView, &vEyePt, &vLookatPt, &vUpVec );
g_pd3dDevice->SetTransform( D3DTS_VIEW, &matView );

// For the projection matrix, we set up a perspective transform (which
// transforms geometry from 3D view space to 2D viewport space, with
// a perspective divide making objects smaller in the distance). To build
// a perpsective transform, we need the field of view (1/4 pi is common),
// the aspect ratio, and the near and far clipping planes (which define at
// what distances geometry should be no longer be rendered).
D3DXMATRIXA16 matProj;
D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/4, 1.0f, 1.0f, 100.0f );
g_pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );
}

DLLFUNC void initDOME(void)
{

g_pd3dDevice = (LPDIRECT3DDEVICE9)draw_begin();
if (!g_pd3dDevice) return;

// Turn on the zbuffer
g_pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE );

// Turn on ambient lighting
g_pd3dDevice->SetRenderState( D3DRS_AMBIENT, 0xffffffff );

// We need the projection matrix to exist in a nice form before creating the
// dome object, so we call SetupMatrices() here.
SetupMatrices();

if( !gDome )
{
gDome = new SPIDX9Dome( g_pd3dDevice, 512, 512, 21, SPI_1_CHANNEL );
}
}

DLLFUNC void initSPI(void){
SetupMatrices();
gDome->SPIBegin();
gDome->SPIPreRender(SPI_1C_FRONT);
}

DLLFUNC void closeSPI(void){

gDome->SPIPostRender();
gDome->SPIEnd();
gDome->SPIFlush( SPI_1_CHANNEL, SPI_RENDER_NORMAL );
}

-------------

Die dll funktioniert, da ist kein Bug drin, wird auch alles aufgerufen und es existieren keine null-Objekte.

3D Gamesstudio startet auch anstandslos und ich erhalte einen blauen Bildschirm, wie in der Beispielapplikation der API. Das einzige was fehlt, ist die 3D Welt der Engine. Gibt es da nicht eine Code der die Renderfunktion aufruft bzw. abbildet.

SetupMatrices ist sehr wichtig, denn sie ist für die Berechnung der Verzerrung zuständig.

Schönen Gruß und frohe Weihnachten

Marcel