Sign in to follow this  
Kisscool15

[ DXUT-D3D9 ] Auto-Resize ?

Recommended Posts

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 :

[code]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) );
}[/code]

Very standard i think

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

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

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

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this