[ DXUT-D3D9 ] Auto-Resize ?

Started by
-1 comments, last by Kisscool15 12 years, 6 months ago
Hi,
First time I use DXUT and something VERY weird is happening.
I wanna display a texture on the screen with textured quad vertex using this function :

void blitD3D(LPDIRECT3DDEVICE9 d3ddev,IDirect3DVertexBuffer9* vertexBuffer,IDirect3DTexture9 *texture, RECT *rDest,D3DCOLOR vertexColour, int stage){
TLVERTEX* vertices;

//Lock the vertex buffer
vertexBuffer->Lock(0, 0, (void**)&vertices, NULL);

vertices[0].colour = vertexColour;
vertices[0].x = (float) rDest->left;
vertices[0].y = (float) rDest->top;
vertices[0].z = 0.0f;
vertices[0].rhw = 1.0f;
vertices[0].u = 0.0f;
vertices[0].v = 0.0f;

vertices[1].colour = vertexColour;
vertices[1].x = (float) rDest->right;
vertices[1].y = (float) rDest->top;
vertices[1].z = 0.0f;
vertices[1].rhw = 1.0f;
vertices[1].u = 1.0f;
vertices[1].v = 0.0f;

vertices[2].colour = vertexColour;
vertices[2].x = (float) rDest->right;
vertices[2].y = (float) rDest->bottom;
vertices[2].z = 0.0f;
vertices[2].rhw = 1.0f;
vertices[2].u = 1.0f;
vertices[2].v = 1.0f;

vertices[3].colour = vertexColour;
vertices[3].x = (float) rDest->left;
vertices[3].y = (float) rDest->bottom;
vertices[3].z = 0.0f;
vertices[3].rhw = 1.0f;
vertices[3].u = 0.0f;
vertices[3].v = 1.0f;

//Unlock the vertex buffer
vertexBuffer->Unlock();

//Set texture
d3ddev->SetTexture (stage, texture);


//Draw image
( d3ddev->DrawPrimitive (D3DPT_TRIANGLEFAN, 0, 2) );
}


Very standard i think

Vertex buffer had been initialized in "OnD3D9CreateDevice" function with :
pd3dDevice->CreateVertexBuffer(sizeof(TLVERTEX) * 4, NULL,D3DFVF_TLVERTEX, D3DPOOL_MANAGED, &vertexBuffer, NULL);
pd3dDevice->SetStreamSource(0, vertexBuffer, 0, sizeof(TLVERTEX));


The RECT I used is initialized in "OnD3D9CreateDevice" function:
SetRect(&rct_menu,0,0,800,600);

I call blitD3D in "OnD3D9FrameRender" function like that :
blitD3D(d3ddev,vertexBuffer,tex_menu,&rct_menu,0xFFFFFFFF,0);

The result should be a 800*600 image displayed in the whole window ( like a background ) but no, the image dimensions are about 500*250

So, I'm asking you : Is there any auto-scaling, auto-risizing hid in DXUT ?

Thanks by advance for the answers and sorry for my crappy English. Hope you understood me well =3

This topic is closed to new replies.

Advertisement