Jump to content
  • Advertisement
Sign in to follow this  

[ DXUT-D3D9 ] Auto-Resize ?

This topic is 2544 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

//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:

I call blitD3D in "OnD3D9FrameRender" function like that :

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!