|
|
Up |
|
|
  |
Author: Dime BarDime Bar Date: Sep 5, 2008 03:30
Hi,
I have creating a 800x600 window which I want to display an 800x600
image on it using D3DXCreateTextureFromFileEx.
How do I set the view and perspective so that I get a 1:1 ratio ?
Thanks for all your time and help
Dime
--
// My vector:
struct CUSTOMVERTEX t_vert[] = {
{1.0f,-1.0f,0.0f,0xffffffff,1, 1,},
{-1.0f,-1.0f,0.0f,0xffffffff,0, 1, },
{1.0f,1.0f,0.0f,0xffffffff,1, 0,},
{-1.0f,1.0f,0.0f,0xffffffff,0,0,},
};
// set the view
|
| Show full article (1.27Kb) |
|
| | 6 Comments |
|
  |
Author: Anton RothAnton Roth Date: Sep 5, 2008 10:09
What you want to do is set the World to Viewspectrum matrix to an identity
matrix, as your vertices are already where they should be. This is the code
i used, but i had it in an effect file:
OnFrameRender:
HRESULT hr;
// If the settings dialog is being sh
{
g_SettingsDlg.OnRender( fElapsedTime );
//return;
}
// Clear the render target and the zbuffer
V( pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
D3DCOLOR_ARGB(255, 255, 255, 255), 1.0f, 0) );
// Render the scene
if( SUCCEEDED( pd3dDevice->BeginScene() ) )
{
|
| Show full article (4.63Kb) |
|
| | no comments |
|
  |
Author: Dime BarDime Bar Date: Sep 5, 2008 10:22
Hi Anton,
I do not know much about effect files :(
Could you shead more light on what the code would look like with out an
effects file ? or is that not posible ?
Thanks,
Anton Roth wrote:
> What you want to do is set the World to Viewspectrum matrix to an
> identity matrix, as your vertices are already where they should be. This
> is the code i used, but i had it in an...
|
| Show full article (4.87Kb) |
| no comments |
|
  |
Author: Anton RothAnton Roth Date: Sep 5, 2008 10:57
"Dime Bar" dimebar.f2s.com> schrieb im Newsbeitrag
news:YpadnX9Sq4ae9lzVnZ2dnUVZ8sPinZ2d@pipex.net...
> Hi Anton,
>
> I do not know much about effect files :(
>
> Could you shead more light on what the code would look like with out an
> effects file ? or is that not posible ?
>
> Thanks,
>
>
>
k, go for identity matrices then, but DirectX9 and future is pretty much
about effect files.
your code would be something like
--------------------------------
D3DXMATRIXA16 myMatrix;
|
| Show full article (0.85Kb) |
| no comments |
|
  |
Date: Sep 5, 2008 15:05
[Please do not mail me a copy of your followup]
Dime Bar dimebar.f2s.com> spake the secret code
<9LSdnZ3Q1OPEl1zVRVnyvwA@pipex.net> thusly:
>I have creating a 800x600 window which I want to display an 800x600
>image on it using D3DXCreateTextureFromFileEx.
>
>How do I set the view and perspective so that I get a 1:1 ratio ?
If you want to splat an 800x600 texture onto an identically sized
window, then the easiest thing is to use XYZRHW coordinates (i.e. screen
space) on the geometry. If you set all the matrices to identity, then
you're not really using the vertex processing capability anyway, so you
might as well just skip all that.
Also, you probably want to use an orthographic projection if you're
doing this, instead of a perspective projection.
|
| |
| no comments |
|
  |
Author: Dime BarDime Bar Date: Sep 8, 2008 08:20
Hi Richard,
I think you are right - do you know of any good example codes i can look
at for orthographic in directx ?
Thanks
Richard [Microsoft Direct3D MVP] wrote:
> [Please do not mail me a copy of your followup]
>
> Dime Bar dimebar.f2s.com> spake the secret code
> <9LSdnZ3Q1OPEl1zVRVnyvwA@pipex.net> thusly:
>
>> I...
|
| Show full article (0.97Kb) |
| no comments |
|
  |
|
|
  |
Date: Sep 8, 2008 10:39
[Please do not mail me a copy of your followup]
Dime Bar dimebar.f2s.com> spake the secret code
pipex.net> thusly:
>I think you are right - do you know of any good example codes i can look
>at for orthographic in directx ?
You just use the convenience function in D3DX to create the matrix.
The fundamental difference between orthographic and perspective
projections is that an orthographic projection doesn't apply
foreshortening to objects that are farther away.
|
| |
| no comments |
|
|