Thread: directX problem

  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    62

    Question directX problem

    I have a quite simple DirectX program. It uses the data of .x files to load a mesh. It worked fine on XP.

    I bought Vista and tried running this program on it. I succeeded, but I found a weird problem.
    The program rendered a cube, but Vista somehow uses the same file to render a rectangular prism.

    I have controlled twice, that I haven't changed the program's code or the .x file. On Vista the program is also much slower, although the computer, that Vista runs on, is more powerful than the computer XP runs on.

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by fighter92 View Post
    On Vista the program is also much slower, although the computer, that Vista runs on, is more powerful than the computer XP runs on.
    Welcome to Vista!
    Btw, I don't know if it's quite possible to say w/o some code and perhaps the file if someone wants to do some tests.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Banned
    Join Date
    Nov 2007
    Posts
    678
    Quote Originally Posted by fighter92 View Post
    I bought Vista and tried running this program on it. I succeeded, but I found a weird problem.
    The program rendered a cube, but Vista somehow uses the same file to render a rectangular prism.
    What do you mean by this? How can it use a different file itself?
    Besides, there may be file permission problems. I am also struggling with that.

  4. #4
    Registered User
    Join Date
    Aug 2006
    Posts
    62
    No, it doesn't use a different file.
    It uses the same file and the result is different.

    Besides, those permission problems really are annoying. I had to run one program with administrator rights to make it save things correctly. Copying and deleting problems are nasty too, but once you understand them, they're simple. Vista supports such junk.

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Thanks to UAC. But you can disable it. No more permission problems, then.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Registered User
    Join Date
    Aug 2006
    Posts
    62

    Unhappy

    I took a screenshot of the programs in different computers:
    Picture
    They aren't exactly in the same angle, it was difficult to screenshot them in the same angle, because they rotated, but you can see the difference easily anyway.


    Disabling UAC doesn't solve all the permission problems.

  7. #7
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Most of the time in Vista you have to run programs in administrator mode. It is not enough to be logged on as admin. You must right click and select run in admin mode or the program may not work correctly. This is especially true with Direct3D/OGL apps and games.

    Recent patches may have fixed this but I don't know. I uninstalled Vista and went back to XP long ago.

  8. #8
    Registered User
    Join Date
    Aug 2006
    Posts
    62

    Question

    Running in admin mode really helps with many things, but unfortunately it didn't help with my program.

    I tested the program and it seems to me, that it isn't the problem with Vista and XP, it's a problem with different computers. I have dual operating systems on one computer and the program works the same on both systems.

    Could it be some kind of differences with video card or something like that? Actually I wouldn't like to believe it, because it's a big difference.

  9. #9
    Registered User
    Join Date
    Aug 2006
    Posts
    62
    I think I know what the problem is.

    One of my computers has got a wide screen. So it stretches out everything and gives such result. I don't actually know it for sure, I haven't had a chance to test it, because I don't know how to change the wide-screen view into normal. I have read about it in the internet and it is so damn specific in every computer, probably depends on video card. I have a laptop and its video card isn't common, it's ATI Radeon Xpress 1200, if anyone knows anything about it.

    Does anyone know, how to support a wide-screen monitor in my program, so it wouldn't stretch the view? I've heard it's possible.

  10. #10
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    The only thing I can give advice on is that the monitor will stretch if you use a non-widescreen resolution. So use a widescreen resolution and adapt your DX code to take that into account.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  11. #11
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Does anyone know, how to support a wide-screen monitor in my program, so it wouldn't stretch the view? I've heard it's possible.
    Your projection matrix should be using width / height as the aspect ratio.

    D3DXMatrixPerspectiveFovLH
    Builds a left-handed perspective projection matrix based on a field of view.

    D3DXMATRIX * D3DXMatrixPerspectiveFovLH(
    D3DXMATRIX *pOut,
    FLOAT fovy,
    FLOAT Aspect,
    FLOAT zn,
    FLOAT zf
    );
    Parameters
    pOut
    [in, out] Pointer to the D3DXMATRIX structure that is the result of the operation.
    fovy
    [in] Field of view in the y direction, in radians.
    Aspect
    [in] Aspect ratio, defined as view space width divided by height.
    zn
    [in] Z-value of the near view-plane.
    zf
    [in] Z-value of the far view-plane.
    Return Values
    Pointer to a D3DXMATRIX structure that is a left-handed perspective projection matrix.

    Remarks
    The return value for this function is the same value returned in the pOut parameter. In this way, the D3DXMatrixPerspectiveFovLH function can be used as a parameter for another function.

    This function computes the returned matrix as shown:

    xScale 0 0 0
    0 yScale 0 0
    0 0 zf/(zf-zn) 1
    0 0 -zn*zf/(zf-zn) 0
    where:
    yScale = cot(fovY/2)

    xScale = yScale / aspect ratio

    Requirements
    Header: Declared in D3DX10Math.h.

    ...
    Don't mind the D3DX10 garbage. This is also in DirectX9 so if you link with d3dx9.lib and use the d3dx9.h header you will be just fine. Using a bit of high school trig you can compute your final horizontal field of view using the numbers you send to this function.

  12. #12
    Registered User
    Join Date
    Aug 2006
    Posts
    62
    Thanks, Bubba!
    It solved all my problems.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. searching problem
    By DaMenge in forum C Programming
    Replies: 9
    Last Post: 09-12-2005, 01:04 AM
  2. Bin packing problem....
    By 81N4RY_DR460N in forum C++ Programming
    Replies: 0
    Last Post: 08-01-2005, 05:20 AM
  3. Words and lines count problem
    By emo in forum C Programming
    Replies: 1
    Last Post: 07-12-2005, 03:36 PM
  4. DirectX DirectInput problem
    By Muphin in forum C++ Programming
    Replies: 1
    Last Post: 07-10-2005, 04:35 PM
  5. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 08:37 AM