Winx3D and DirectX8 (3d) programming ... Log Out | Topics | Search
Moderators | Register | Edit Profile

stereo3d.com webboard » General 3D Discussion » Winx3D and DirectX8 (3d) programming in c++ « Previous Next »

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Jorn Are Hatlelid

Rating: N/A
Votes: 0 (Vote!)

Posted on Sunday, June 22, 2003 - 3:36 pm:   Edit PostDelete PostView Post/Check IPPrint Post

I am currently doing a project involving directx8 (would prefer 9 though as this is the version I got installed on my computer) and Winx3D in C++. I am using the Visual Studio.net environment. So far, after rewriting the Winx3D sdk to be c++ compliant, My app is running "fine" in page flipping mode except the screen just shows garbage. By fine i mean that all code execute with no errors, rendereing seems to take place and pageflipping does occur but the output is no good.

I have been debugging this for a long time and I was wondering if anyone have had any experiences with Directx8 and winx3d under c++. I cant seem to find any source code except from the sample code from winx3d, and I can get no more hints of whats wrong in my code from there.

Any help appreciated, and please feel free to contact me on ICQ 344506 with any suggestions or for discussion.
Top of pagePrevious messageNext messageBottom of page Link to this message

Jorn Are Hatlelid

Rating: N/A
Votes: 0 (Vote!)

Posted on Sunday, June 22, 2003 - 3:37 pm:   Edit PostDelete PostView Post/Check IPPrint Post

Sorry for the typo, my ICQ is 344507

Jorn
Top of pagePrevious messageNext messageBottom of page Link to this message

sdy

Rating: N/A
Votes: 0 (Vote!)

Posted on Sunday, June 22, 2003 - 9:14 pm:   Edit PostDelete PostView Post/Check IPPrint Post

I've been writing C++ for my I-Art glasses without using Win3D driver, or any. Way I do it is using DirectX8, present a scene from one viewpoint. Change the viewpoint to the other eye and present again. By putting my glasses into page flipping mode. works fine. Let me know if you want, I'll put some source code on my web page.
Top of pagePrevious messageNext messageBottom of page Link to this message

David Sykes

Rating: N/A
Votes: 0 (Vote!)

Posted on Sunday, June 22, 2003 - 11:13 pm:   Edit PostDelete PostView Post/Check IPPrint Post

sdy, you have mentioned this before and I asked for further details.

Yes, can you put some source-code on your webpage.
Top of pagePrevious messageNext messageBottom of page Link to this message

Jorn Are Hatlelid

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, June 23, 2003 - 1:05 am:   Edit PostDelete PostView Post/Check IPPrint Post

I have got heaps of source code not using winx3d driver and I know how the technologies work, but my problem is the combination of winx3d directx8 and c++ since the winx3d sdk is originally in c code and I had to alter it slightly to work with my project, compiler and directx8 sdk.

But ofcourse, I'd love to see your code anyway sdy.

Jorn
Top of pagePrevious messageNext messageBottom of page Link to this message

sdy

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, June 23, 2003 - 12:17 pm:   Edit PostDelete PostView Post/Check IPPrint Post

David, really sorry about that. Thinks got very hectic and I must have forgot it. I'll put some source code on my site later today, I'm at work now. Check here later for web page.
Top of pagePrevious messageNext messageBottom of page Link to this message

sdy

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, June 24, 2003 - 12:02 am:   Edit PostDelete PostView Post/Check IPPrint Post

Ok, source code to a program I used as a template is on my web site. Draws a spinning cube in 3D. Cube is textured from a bitmap. Go here: http://sdeyoreo.tripod.com
Along the top on the left, click on 3D Programs. On this page is a couple of programs. Down on the bottom is 3D_Template. unzip it. Done in MicroSoft Visual Studio C++. Let me know what you think.
Top of pagePrevious messageNext messageBottom of page Link to this message

Jorn Are Hatlelid

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, June 24, 2003 - 7:51 am:   Edit PostDelete PostView Post/Check IPPrint Post

I can see from your code, sdy, that you assume that render time is less than screen refresh time and that you use only one backbuffer. Also It seems like you got native drivers (nVidia?) that supports signaling to your stereo gear on Vsync whereas mine does not. This is why I use Winx3d which allowes queuing of multiple backbuffers where you can render on more backbuffers and winx3d handles the flipping for you on prerendered surfaces while you render new ones.

I like your code, it is good and easy to understand. A tip however when you are doing stereo renderin which can make your code smaller and easier to maintain is to have one RenderStereo(int iEye) methode where iEye represent the eye you render -1 for left 0 for center 1 for right and all you have to do is to add this number into your D3DTS_VIEW matrix and multiply it with the depth factor. This saves you a couple of methodes.

Jorn
-Still looking for someone using Winx3D in C++
Top of pagePrevious messageNext messageBottom of page Link to this message

David Sykes

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, June 24, 2003 - 6:06 pm:   Edit PostDelete PostView Post/Check IPPrint Post

Thanks Steven.
Initially Tripod said it could not find any of your webpages !
Because of the vast amount of Internet junk, I always disable Java scripting.
When enabled, Tripod found the pages.

Will let you know how I get on.

David
Top of pagePrevious messageNext messageBottom of page Link to this message

David Sykes

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, June 24, 2003 - 6:26 pm:   Edit PostDelete PostView Post/Check IPPrint Post

I don't like transferring Visual Studio Projects between computers !
Here is what we get trying to compile DX Classes:-


Compiling...
cuboid.cpp
game.cpp
main.cpp
Linking...
cuboid.obj : error LNK2001: unresolved external symbol _D3DXCreateTextureFromFileA@12
game.obj : error LNK2001: unresolved external symbol __imp__timeGetTime@0
game.obj : error LNK2001: unresolved external symbol _Direct3DCreate8@4
game.obj : error LNK2001: unresolved external symbol _D3DXMatrixMultiply@12
game.obj : error LNK2001: unresolved external symbol _D3DXMatrixRotationZ@8
game.obj : error LNK2001: unresolved external symbol _D3DXMatrixRotationY@8
game.obj : error LNK2001: unresolved external symbol _D3DXMatrixRotationX@8
game.obj : error LNK2001: unresolved external symbol _D3DXMatrixPerspectiveFovLH@20
game.obj : error LNK2001: unresolved external symbol _D3DXMatrixLookAtLH@16
Release/DX Classes.exe : fatal error LNK1120: 9 unresolved externals

d3dx8.lib, d3dx.lib and d3d8.lib are all in my project default library settings.

Will come back to this later.

David
Top of pagePrevious messageNext messageBottom of page Link to this message

Jorn Are Hatlelid

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, June 25, 2003 - 12:17 am:   Edit PostDelete PostView Post/Check IPPrint Post

I had no problem compiling and running sdy's project although I am using visual studio.net and it converted it to a .net project.

David: do you have directx8 sdk installed? -it won't compile with directx9 sdk although it will run with directx9 runtime.

Jorn
Top of pagePrevious messageNext messageBottom of page Link to this message

David Sykes

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, June 25, 2003 - 12:29 am:   Edit PostDelete PostView Post/Check IPPrint Post

Yes, I have directx8 sdk.

Will try to sort it out.

David
Top of pagePrevious messageNext messageBottom of page Link to this message

David Sykes

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, June 25, 2003 - 1:06 am:   Edit PostDelete PostView Post/Check IPPrint Post

I assume you have compiled the Debug version.
There is no problem with that.
To compile the Release version, you will have to add four additional include files (compare with Debug settings).

Then it is OK.

David
Top of pagePrevious messageNext messageBottom of page Link to this message

sdy

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, June 25, 2003 - 2:11 pm:   Edit PostDelete PostView Post/Check IPPrint Post

imp__timeGetTime@0 : you need winmm.lib also.
The D3's.lib look right.
Top of pagePrevious messageNext messageBottom of page Link to this message

David Sykes

Rating: N/A
Votes: 0 (Vote!)

Posted on Thursday, June 26, 2003 - 8:53 pm:   Edit PostDelete PostView Post/Check IPPrint Post

Well, this works fine on my system.
As I understand it, your 'cameras' are 15 units apart and 100 units from the viewport.
The left and right views are rendered into the backbuffers and the Direct3D function 'Present' used to flip them. (Not much Internet info on 'Present' and my MSDN is rather old).

Q1. Any particular reason why the camera x-positions are 0 and 15 rather that -7.5 and +7.5 ?

The Winx3D SDK documentation says :-

"Replace the DirectDraw Flip() function with the appropriate WINx3D queue and display functions. The Flip() function is designed to change the start address once. However, for page-flipped stereoscopy, the start address must change every time a vertical sync occurs on the video card. This is the primary purpose of WINx3D - to keep the image that is displayed on the video card synchronized with the VR gear. The DirectDraw Flip() function is inadequate for this."

Q2. I am obviously missing something, how come you do not have this problem ?

David
Top of pagePrevious messageNext messageBottom of page Link to this message

Jorn Are Hatlelid

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, June 27, 2003 - 8:56 am:   Edit PostDelete PostView Post/Check IPPrint Post

The reason sdy doesen't have this problem is he (most, most likely) uses nVidia drivers which doesent require Winx3D, but has built in support for stereoscopy.

Have you made anything work with the winx3d david? I have my app up running and it all seems well in terms of code being ran, but it still just displays garbage. -page flipped garbage that is. I really need some help on getting it working.

Jorn
Top of pagePrevious messageNext messageBottom of page Link to this message

sdy

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, June 27, 2003 - 12:04 pm:   Edit PostDelete PostView Post/Check IPPrint Post

I kinda of a newbie, but I'm pretty sure I'm not using nVidia chip in my video card. I have an ATI All-In-Wonder 128 with a Rage video chip. I far from a professional programmer, just a hacker, but keep the conversation going,it;s interesting. I've been teaching DirectX to myself for about a year now.
Top of pagePrevious messageNext messageBottom of page Link to this message

Peter Wimmer

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, June 27, 2003 - 5:19 pm:   Edit PostDelete PostView Post/Check IPPrint Post

DirectX provides a option so that a buffer is present only when a vsync occurs. If you use this option, software pageflipping works with almost any card - as long as cpu load is low. If cpu load is high, the app failes to create the next buffer in time and misses one v-sync -> left and right image are swapped. Solution: You can control your glasses using a homebuilt controller on the parallel port.

I used this technique to view stereo videos on my Matrox G400 and it worked well.
Top of pagePrevious messageNext messageBottom of page Link to this message

David Sykes

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, June 27, 2003 - 9:08 pm:   Edit PostDelete PostView Post/Check IPPrint Post

> Have you made anything work with the winx3d david?

Afraid not, I just have a 'theoretical interest'.
It is meant to be simple, but the Winx3D documentation is beyond my current capabilities.

I actually use the programmes produced by Masuji SUTO and Peter Wimmer. Far simpler :-) .

David
Top of pagePrevious messageNext messageBottom of page Link to this message

Jorn Are Hatlelid

Rating: N/A
Votes: 0 (Vote!)

Posted on Sunday, June 29, 2003 - 5:01 pm:   Edit PostDelete PostView Post/Check IPPrint Post

David: I've also been using Masuji Sutos sofware and I find it excellent, but I've checked out Peter's homepage and I can't find any 3D stereo software that he has done published there. (Yes, I know a bit German) What software are you reffering to, and is there any source code available anywhere??

Jorn
Top of pagePrevious messageNext messageBottom of page Link to this message

Peter Wimmer

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, June 30, 2003 - 1:13 pm:   Edit PostDelete PostView Post/Check IPPrint Post

Stereoscopic Player can be found at http://mitglied.lycos.de/stereo3d/, not at my private German homepage.
Top of pagePrevious messageNext messageBottom of page Link to this message

sdy

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, July 01, 2003 - 2:52 am:   Edit PostDelete PostView Post/Check IPPrint Post

Ahh, I thought it was the other way around: I got a Vsync every time I presented a buffer. So, do I get a Vsync every refresh cycle and if a buffer is ready, it's presented? So faster refresh rates needs faster rendering to the back buffers?
Top of pagePrevious messageNext messageBottom of page Link to this message

Jorn Are Hatlelid

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, July 02, 2003 - 4:09 am:   Edit PostDelete PostView Post/Check IPPrint Post

Yup, that would be right as long as you're only using one buffer with your solution sdy. That is why I use Winx3D (which I finally have made work), which allowes multiple backbuffers to be queued and flipped multiple times by a seperate thread while rendering is in progress. -This is good when you have a bit more than a box to render ;) and your graphix card & cpu can't keep up with your refresh rate.

-But as another bloke posted: There goes Win3D! -What happened?? If you go to their site it says they've been aquired by another company, which one it does not say although nuvision3d seems like a possible answer. - just guessing though. My belief is that the software will still be around but from a different wendor. (I really hope so)

Jorn
Top of pagePrevious messageNext messageBottom of page Link to this message

sdy

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, July 02, 2003 - 11:34 am:   Edit PostDelete PostView Post/Check IPPrint Post

I have those exact refresh rate problems. Sometimes I miss a sync and the L/R eyes flip. I'll have to look again at Win3D SDK. Could you post your source code somewhere? Seems multiple back buffers and seperate threads can be done with Win3D, though probably end up re-writing what Win3D does, huh?
Top of pagePrevious messageNext messageBottom of page Link to this message

Anonymous

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, July 02, 2003 - 3:58 pm:   Edit PostDelete PostView Post/Check IPPrint Post

It is really not a good idea to try and render at a rate matching the refresh rate. Very few applications can render constantly at 120 Hz, especially with other applications running.

You really want a solution that separates the buffers that are displayed from the buffers that are being rendered into. The WINx3D interface does this. So does the nVidia SDK. The nVidia SDK is available from nVidia - be sure to contact 3DStereoDev@nvidia.com.
Top of pagePrevious messageNext messageBottom of page Link to this message

Jorn Are Hatlelid

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, July 02, 2003 - 5:40 pm:   Edit PostDelete PostView Post/Check IPPrint Post

My source code with winx3d is just a small part of a bigger project, but I have written a small document which states the most important changes from the drawtest8.c sample given from winx3d (if you were lucky enough to download that before they went down) to make it work with c++ and direct3d. I am working on a generic class for winx3d applications similar to the d3dapp in the directx samples but this is not finished enough for posting yet.

I am currently putting up my project and the docs previously mentioned on a new site which will be located at http://3dvirtualcontrols.hatlelid.net or short http://3dvc.hatlelid.net

add /winx3danddirect3d.htm for the document mentioned. If this all sounds like a mess it's because it's half past three in the morning and I really need to go to bed. The document should be accessible as soon as the dns servers are updated, and the site as soon as I get around to make it.

Anonymous: sdy and I doesen't have nvidia cards and therefore no use in using the nvidia sdk.

G'd nite

Jorn
Top of pagePrevious messageNext messageBottom of page Link to this message

Jorn Are Hatlelid

Rating: N/A
Votes: 0 (Vote!)

Posted on Thursday, July 03, 2003 - 5:28 pm:   Edit PostDelete PostView Post/Check IPPrint Post

Just checked, and the site mentioned in the above post is up running with some source code and descriptions for for how to code Winx3D in C++ and Direct3D. Let me know if you find it useful.

Jorn
Top of pagePrevious messageNext messageBottom of page Link to this message

David Sykes

Rating: N/A
Votes: 0 (Vote!)

Posted on Thursday, July 03, 2003 - 7:30 pm:   Edit PostDelete PostView Post/Check IPPrint Post

Thanks Jorn, that is very useful.
It is now probably the only site on the Net that tells you how to use Winx3D.
I hope the new owners are delighted :-) .

> Note that when compiling in C++ the IDirect3D8 object uses direct referencing.

I guess I had better find out what that means.

David
Top of pagePrevious messageNext messageBottom of page Link to this message

Jørn Are Hatlelid

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, July 04, 2003 - 3:11 am:   Edit PostDelete PostView Post/Check IPPrint Post

I am glad you appreciate my doc david :)
What I mean by direct referencing (which is a funny thing) is that when the Winx3D sdk is compiled as .c code, which it is using a c compiler or within the 'extern "C" {' clause given in the winx3 headers, the IDirect3D8 object looks different to the programmer. I have given an example of this in the doc.

Instead of calling
pD3D8->lpVtbl->Release(pD3D8);
which is the IDirect3D8 object using the lpVtbl member to call the Release member with a parameter which is the pointer to the same IDirect3D8 object, you have to do the calling directly:
pD3D8->Release();

You will discover this as you compile your project and get compilation errors. -simply remove the 'lpVtbl->' part and the first argument (there may be more) in the called method.

Hope this helped

Jorn
Top of pagePrevious messageNext messageBottom of page Link to this message

David Sykes

Rating: N/A
Votes: 0 (Vote!)

Posted on Saturday, July 12, 2003 - 5:32 pm:   Edit PostDelete PostView Post/Check IPPrint Post

It did, thanks.

I think, however, I had better start to study the NVidia Stereo SDK (even though I will leave it to those more able to implement it in their excellent programmes) .

The suspect intentions of the new owners of Win3D WILL be defeated :-) .

David
Top of pagePrevious messageNext messageBottom of page Link to this message

Anonymous

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, April 05, 2004 - 11:22 am:   Edit PostDelete PostView Post/Check IPPrint Post

I'ld like to write some simple 3D game involvind directx8 and Winx3d
but I can't find Winx3d SDK
and some manual

if you send me a winx3d SDK or SDK Manual I am really appreciative of your support.

my email is jjhmman@empal.com
Top of pagePrevious messageNext messageBottom of page Link to this message

M.H.

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, April 05, 2004 - 3:01 pm:   Edit PostDelete PostView Post/Check IPPrint Post

Anonymsou: You can use nVidia StereoBLK instead of Winx3D ... But if you want to write a game it have no sense becouse for a good balanced scene geometery the nVidia stereo wrpapers can add stereoscopy without additional work on your side. If you want to write serisou stereoscopic application forget DirectX and use OpenGL ...

Add Your Message Here
Post:
Bold text Italics Underline Create a hyperlink Insert a clipart image

Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action:

Topics | Last Day | Last Week | Tree View | Search | User List | Help/Instructions | Program Credits Administration