Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: TV3D 6.2 How to get access to the triangle indexes from C++.  (Read 6138 times)
Robert Y.
Community Member
*
Posts: 57


« on: January 19, 2007, 05:08:23 AM »

Dear TV3D developers,

as it seems impossible to get access to the triangle buffer by using TV 6.2 TVInternalObjects->GetD3DMesh in C++, caused by wrong declarations in the SDK and resulting in compile errors, I wonder if there is another way to get access to that buffer. After all, it is just a pointer that I need.

EDIT: see below for the solution.
Logged
Hypnotron
Customers
Community Member
*****
Posts: 1050


« Reply #1 on: January 19, 2007, 09:17:26 AM »

well, i think you can do what you need in version 6.5.  You can get a reference to the actual D3D mesh, texture, device, etc.
Logged
Robert Y.
Community Member
*
Posts: 57


« Reply #2 on: January 20, 2007, 05:35:00 AM »

Right now, 6.5 is not a serious option for a commercial project:

1. It still is in beta.
2. You can't publish your product.
3. It is hardly documented.
4. It doesn't support DirectX 8.
5. As most users use VB, I don't think 6.5 has been tested enough in plain C(++) to make sure it works with C programming. Like 6.2, which is full of definition problems when used with VC6.
6. As there are lots of known bugs in 6.2 for a long time that aren't fixed, why would I spend money on a sequel that I can't test first. I have to make sure it works before investing in it, as it isn't likely that any bugs in it will be fixed soon. And the licensing program doesn't allow that.

So, does anyone know how to get a pointer to the triangle buffer without the GetD3DMesh function?
Logged
Hypnotron
Customers
Community Member
*****
Posts: 1050


« Reply #3 on: January 20, 2007, 06:15:38 AM »

1. True
2. True.  Not whilst its in beta you cant.
3. True.  Just the 6.5 beta forum which is very active and has large archive of posts which cover just about every aspect of tv3d.
4. True.
5. Most users of 6.5 probably are using vb.net or c#.  But there are indeed C++ users who've been using the beta since it was made first available.  
    b) 6.5 is actually written in c++ and even works with projects built with GCC.  6.2 was written in VB6 which is part of the reason for it having problems with C++.
6. It definetly works and Sylvain has done a good job of fixing bugs we submit in a timely fashion.  He's even been known to give us private builds if its for a serious blocking bug that is preventing us from moving on in our personal projects.  I can personally attest to this on two occassions.  So frankly, if you want to make sure a bug gets fixed, its best to be on the beta team.  

P.S. A little birdy said that the "6.5 "prerelease" is coming soon."   Let's hope soon means 2 months or less Smiley
Logged
Robert Y.
Community Member
*
Posts: 57


« Reply #4 on: January 21, 2007, 07:18:17 AM »

My only realistic options at the moment are:

1. Keep using my own X importer AND the TV3D import and reconstruct the optimized triangle data from them. This takes several minutes for importing a 64K triangle model! As noone will pay for such a slow program, it's no use buying a TV3D 6.2 license.

2. Drop TV3D and invest my time in learning DirectX programming.

3. Getting a little help from one of the developers to get a pointer to a buffer that is already in memory, but can't be accessed because of a small bug in TV3D.

Obviously, I prefer option 3.

 
Quote
So frankly, if you want to make sure a bug gets fixed, its best to be on the beta team.  


That would be nice. I have 20 years of programming experience, started in basic, moved on to assembler, pascal and C(++). But I doubt the TV developers want help, as till now they don't respond to bug reports and hardly answer any of the posts on this forum. I appreciate help from the forum users, but this problem can only be solved by one of the developers.

 So again, can one of the DEVELOPERS help me out?
Logged
mathijs
Community Member
*
Posts: 377


« Reply #5 on: January 21, 2007, 08:06:06 AM »

One thing, 6.5 has perfect c++ support, unlike 6.2 which is visual basic crap 6.5 is a pure c++ dll and thus works great when you use c/c++, besides its faster than the .net/com crap they support for 6.5 too Smiley
Logged
mathijs
Community Member
*
Posts: 377


« Reply #6 on: January 21, 2007, 08:08:30 AM »

Beside, you still haven't shown any source or compiler errors to show what your problem is, you want anyone to help you or are you just hoping someone will at the end just code it for you?
Logged
mathijs
Community Member
*
Posts: 377


« Reply #7 on: January 21, 2007, 08:12:12 AM »

1. It still is in beta. & 2. You can't publish your product.
if you contact darqshadow before licensing you might be able to arrange that you can publish your app.
3. It is hardly documented.
If you indeed have 20 years of programming experience working with 6.2 docs/6.5 information on forums shouldnt be a problem to you.
4. It doesn't support DirectX 8.
Why the f*** do you still need dx8 support?
Logged
AriusMyst
Guest
« Reply #8 on: January 21, 2007, 08:26:30 AM »

I've heard rumours that a 6.3 bug fixing release for 6.2 should be around in a couple days. Thats only rumour though. The fabled 6.3 has been talked about for like 2 years now and never seems to show up. An I doubt it will solve your issue, but you may get lucky. The support for C++ will still be inadequate as they aren't going to rewrite 6.2 when they're busy trying to rush the release of 6.5 to satisfy all the "when is 6.5 coming" threads. I think thats main issue here, they can't realistically divert their attention from 6.5 to fix bugs in 6.2 when 6.5 already solves these kinds of issues.

An I agree with mathijs, 6.5's C++ support is perfectly fine and your projects can even be linked statically if you so wish.
Logged
Robert Y.
Community Member
*
Posts: 57


« Reply #9 on: January 21, 2007, 11:31:56 AM »

Quote
Beside, you still haven't shown any source or compiler errors to show what your problem is, you want anyone to help you or are you just hoping someone will at the end just code it for you?


Yes I did, but didn't get a reponse. I don't want anyone to write my code, but I would like one of the developers to fix a bug in their own code OR provide me with a shortcut to the triangle buffer (I suspect it will be one or two lines of code to get a pointer to triangle buffer (after all, it already has been allocated and TV3D uses it internally). The D3DGetMesh function doesn't work in C++. I even don't want it fixed, but a small line of code that retrieves the triangle buffer in 6.2 to circumvent this problem would be greatly appreciated.

http://www.truevision3d.com/phpBB2/viewtopic.php?t=14527

After about ten answers by several users on '6.5 is better' that is no news to me anymore, but if you read my previous posts you can see that it is not an option at the moment.

So if someone with knowledge of the internal workings of TV3D reads this, PLEASE HELP.
Logged
AriusMyst
Guest
« Reply #10 on: January 21, 2007, 11:42:01 AM »

How about this then?

Instead of posting on a public forum then getting antzy about the advice of people trying to help you :roll:. Talk to the developers directly, the devs don't make it hard for you to do this:

1: PM on this forum.
2: Email.
3: Support Tickets.
4: IRC.
Logged
Hypnotron
Customers
Community Member
*****
Posts: 1050


« Reply #11 on: January 21, 2007, 01:29:06 PM »

Well I know i'm being selfish, but Id rather Sylvain spend his time on 6.5 than working on the dead end code base that is 6.2.  

From an economic point of view, I don't think it makes alot of sense for the devs to spend time on 6.2 chasing bugs that only matter to a few unlicensed individuals.   (ouch!) People who buy a 6.2 license will most likely switch their code to use the beta.  People who don't buy 6.2 and complain about bugs aren't likely to ever buy the product anyway.  I mean sure those who actually complete their projects and want to sell it will, but we all know what an incredibly low percentage of people that amounts too.  And for those 6.2 users who fall into this category, it works well enough for most of them since the vast majority aren't using C++.  

So if a mythical 6.3 verson exists and just needs to be packaged up and uploaded, fine... but I'm against the dev's spending any more time fixing bugs that essentially only help one developer in a hundred... and who likely havent even paid.   Anyway, not that my "vote" matters.  Guess Im tired of the primadonas running around saying "if you dont do x,y and z then i'm gonna take my marbles and go home."    I wonder where people get this false sense of entitlement?  

On the 6.5 side, the developers have been extremely accomodating and have strived to implement all of the things we've asked for.  And to me thats good since we're the paying customers who have a vested interest in the future technology and I selfislhly want the devs to spend all their time on the new rather than the old.
Logged
Robert Y.
Community Member
*
Posts: 57


« Reply #12 on: January 21, 2007, 09:16:46 PM »

Again, I really appreciate all efforts and advice, but it comes down to this:

At the moment there is only one COMMERCIAL version of TV available, version 6.2.
TV 6.2 is buggy and the program I've written with it is awfully slow because there is a bug in the TV definitions in C++, and I have to program around it in a very awkward manor. So, it prevents me releasing my program, as I suspect my customers won't accept a texturemapping tool with a model loading time of several minutes (as I have to import the triangle data myself now and compare it with all points in memory).

The 'alternative' is to buy a license, WITHOUT knowing if my program will work with that version, but KNOWING that 6.2 doesn't work AND that 6.5 has no documentation AND I can't release my program with that yet.

Again, I don't wan't to have 6.2 fixed, but only want to know how the GetD3DModel function works, so I can find a workaround myself. That's why I ask a DEVELOPER to answer my question. A simple one-line cut and paste from the TV3D source would probably clear things up and would take a developer only a few minutes. From there I could continue with and finish my project. Other programmers would benefit from this information too.

It is very frustrating to have an almost finished project which suffers from a small bug, and results in a sub-standard program quality.

And a question for all 'helpful' users above: is it strange that I only want to invest money in a product that is actually useful? No access to the triangle buffer means there is no chance you can make a texture mapping or modelling tool, so this is a BIG defect when writing commercial modelling software (as most scientific software is written in C++). I'm not a script kiddie who is trying to write his first game, but work in medical imaging processing and am looking for a quick and easy way to visualize medical data without having to learn several versions of the DirectX SDK. And what a nice and professional attitude to assume that the TV3D users won't publish anything useful with it.
Logged
Hypnotron
Customers
Community Member
*****
Posts: 1050


« Reply #13 on: January 22, 2007, 07:15:09 AM »

Quote from: "Robert Y."
No access to the triangle buffer means there is no chance you can make a texture mapping or modelling tool, so this is a BIG defect when writing commercial modelling software (as most scientific software is written in C++). I'm not a script kiddie who is trying to write his first game, but work in medical imaging processing and am looking for a quick and easy way to visualize medical data without having to learn several versions of the DirectX SDK. And what a nice and professional attitude to assume that the TV3D users won't publish anything useful with it.


It's not a defect just because it can't do what you want it to do.  Every piece of software has limitations that are by design for one reason or another.  

And nobody (including me) is saying nothing useful can be done with tv3d.  I know of someone who's written a very cool vehicle accident scene reconstruction & simulation tool that is not a game but is useful and successful.
Logged
SylvainTV
Administrator
Community Member
*****
Posts: 4971


WWW
« Reply #14 on: January 22, 2007, 07:24:48 AM »

Hello, unfortunately the automatic wrapper generated by Visual Studio 6 has some problems especailly with InternalObjects. Remember that this c++ wrapper calls a VB dll so the mesh object is actually a DirectX object from the VB dll. Therefore it's not possible to use some internal objects in VC++.

In TV6.5 there is no more stupid wrapper like that since everything in in C++ already, and you have access to the c++ native class directly. And it's not buggy Wink

Anyway, I had added a function called "Internal_GetMesh", I don't remember exactly if it was before or after the official TV6.2 release. Check with depends.exe on tvutil62.dll to see if you see Internal_GetMesh, if you don't, send me a mail and I will send you the latest version.

The Prototype of this function is :
__declspec(dllexport) HRESULT __stdcall Internal_GetMesh(int meshid, LPD3DXMESH* returnedmesh);

So try to load the TVUTIL62 library (with LoadLibrary), then use GetProcAddress to get the Internal_GetMesh function address.
Then try to use the Internal_GetMesh, and it should get you the DX8.1 LPD3DXMESH object (be sure to use the good version of the DirectX SDK)

Let me know if it worked.
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
Robert Y.
Community Member
*
Posts: 57


« Reply #15 on: January 22, 2007, 12:06:51 PM »

Dear Sylvain,

thanks so much! After some adjustments it finally works!
For other C(++) programmers, here is how it's done:

First, change your tv3dcpp.h to the one that is posted here:
http://www.truevision3d.com/phpBB2/viewtopic.php?t=5379
(this prevents the 'ambiguous' compiler errors)

Second, use the following code to access the index buffer:

Code:
typedef HRESULT (WINAPI *GETMESH)(int, LPD3DXMESH *);

HMODULE hmod;
HRESULT hr;
GETMESH fnGetmesh;
LPD3DXMESH d3dmesh;
unsigned char *Databuf;
unsigned short *Indexbuf; // This buffer will be filled with the indexes
unsigned long IndexbufSize;

if (hmod=LoadLibrary("tvutil62.dll"))
{
if (fnGetmesh=(GETMESH)GetProcAddress(hmod,"Internal_GetMesh"))
{
hr=fnGetmesh(pGlobals->GetMesh("MyModel"),&d3dmesh);
IndexBufSize=d3dmesh->GetNumFaces() * 3 * sizeof(unsigned short);
d3dmesh->LockIndexBuffer(D3DLOCK_READONLY,&Databuf);
Indexbuf=(unsigned short *)malloc(IndexBufSize);
memcpy(Indexbuf,Databuf,IndexbufSize);
d3dmesh->UnlockIndexBuffer();
}
FreeLibrary(hmod);
}


Hope this helps other C++ programmers.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks