[SOLVED] Can't execute samples with DirectX renderer

Shion

13-02-2008 18:00:25

Hello,

I want to use PagedGeometry,
but i can't execute the precompiled samples with the DirectX renderer.
OpenGL works fine.

Here is a screenshot of the error message:

(I have installed the newest DirectX9.0c version.)

Also I have tried to compile the samples by myself.
But if I execute the sample1, I become a DirectX Error too.

Output:
Direct3D9: (ERROR) :Stage 0 - Count in D3DTSS_TEXTURETRANSFORMFLAGS must be 0 when programmable pipeline is used

Eine Ausnahme (erste Chance) bei 0x7c812a7b in Example 1 - TreeLoader3D.exe: Microsoft C++-Ausnahme: long an Speicherposition 0x0012dc20..
Direct3D9: (ERROR) :DrawIndexedPrimitive failed.

Eine Ausnahme (erste Chance) bei 0x7c812a7b in Example 1 - TreeLoader3D.exe: Microsoft C++-Ausnahme: Ogre::RenderingAPIException an Speicherposition 0x0012dee4..
Unbehandelte Ausnahme bei 0x7c812a7b in Example 1 - TreeLoader3D.exe: Microsoft C++-Ausnahme: Ogre::RenderingAPIException an Speicherposition 0x0012dee4..
Das Programm "[3884] Example 1 - TreeLoader3D.exe: Systemeigen" wurde mit Code 0 (0x0) beendet.


OgreLog Error:
18:43:05: OGRE EXCEPTION(3:RenderingAPIException): Failed to DrawPrimitive : An undetermined error occurred in D3D9RenderSystem::_render at c:\eigene programme\ogre-win32-v1-4-5\ogrenew\rendersystems\direct3d9\src\ogred3d9rendersystem.cpp (line 2719)

Code, Callstack, etc.


I use the source version of Ogre and have enabled the multithreading in Ogre.
I hope someone can help me.

Ogre: Ogre 1.4.5
IDE: Visual Studio 2005

If you need additional information, feel free to ask me. ^^

JohnJ

14-02-2008 15:55:41

Direct3D9: (ERROR) :Stage 0 - Count in D3DTSS_TEXTURETRANSFORMFLAGS must be 0 when programmable pipeline is used
"jeng" has encountered this error a while back in this thread:
http://www.ogre3d.org/phpBB2addons/view ... hp?p=35197

According to jeng, this is due to the use of a custom view/projection matrix with Ogre being used and isn't really PagedGeometry's fault. Other than that I'm not sure what's causing this problem - PagedGeometry simply uses shaders as it should, and trusts Ogre to handle them correctly.

If this doesn't help solve the problem, post your PagedGeometry configuration code and I will try to reproduce and find the problem.

Shion

14-02-2008 18:29:28

I try to compile your first sample application "Example 1 - TreeLoader3D"
Therefore there are no setCustomViewMatrix or setCustomProjectionMatrix.

Hmmm.. don't know what I can do now : (

Furthermore I can't execute the precompiled samples with the DirectX renderer.
But I have installed the newest DirectX9.0c version yesterday.

JohnJ

14-02-2008 18:49:01

Hmm... that's not good. Are your video card drivers up-to-date? What video card do you have?

Shion

14-02-2008 20:08:52

I have now installed the newest driver for my video card.
Driver: 169.21_forceware_winxp_32bit_international_whql.exe

I have a NVIDEA Geforce 7600GT 256MB.

But the samples don't run.

JohnJ

15-02-2008 20:57:22

Maybe I should update my drivers then and see if that introduces the problem. I have a GeForce 7800 GT OC 256MB and it works fine, obviously.

What operating system are you using? Do all of Ogre's samples work for you under DirectX?

Shion

18-02-2008 18:39:21

OS: Windows XP Prof

Yes, all Ogre samples run under DirectX.
I have compiled the whole ogre engine and all samples again (with the newest DX version).
Furthermore I have compiled PagedGeometry and all samples again too.

But I have the same error.
It seems to be a problem with the internal render function from ogre _render().

Shion

18-02-2008 22:56:40

If I skip the following line, the program runs without a crash.
treeLoader->addTree(myEntity, position, yaw, scale);
In this line occurs the error.

Could it be, that a shader make trouble?
Which shader language do you use?

I ask, beacause I have found this thread in the ogre board:
http://www.ogre3d.org/phpBB2/viewtopic. ... tem+render
This is exactly the same error message.

willthrom

19-02-2008 08:55:11

Try with set DirectX to Release Version.

I had the same problem when I try to run y debug mode.

ATI x1550 PCI-E x1

JohnJ

19-02-2008 15:45:28

If I skip the following line, the program runs without a crash.
treeLoader->addTree(myEntity, position, yaw, scale);
In this line occurs the error.

Unfortunately that doesn't help much because commenting out the line that adds PagedGeometry data to a scene essentially disables PagedGeometry. If you commented out the lines that add ImpostorPage and BatchPage selectively, you'll probably be able to narrow it down to one of these (PagedGeometry itself doesn't use shaders, but the page implementations do).

Could it be, that a shader make trouble?
Which shader language do you use?

I'm pretty sure this is a shader issue, although it's strange that you're having problems - I have a 7800 GT under almost the same OS/Drivers.

PagedGeometry uses CG for shaders. If I could reproduce the problem (unfortunately it looks like I can't), I'd experiment with the shaders and try to find what's causing the issues.

I ask, beacause I have found this thread in the ogre board:
(...)
This is exactly the same error message.

The error is pretty vague (undetermined error drawing primitive), so it could be a different situation. The problem there was due to improper shader parameter declarations, but I double checked and I think PagedGeometry's shaders are ok.

Anyway, I guess I'll keep trying to reproduce the problem. Unfortunately until I do, there's not much I can do to help :(

Shion

22-02-2008 17:14:13

I tried to compile and execute it again.

Ogre SDK 1.4.6
Paged Geometry 1.04
VS05 Express SP1

Because I use the Ogre Source Version (+Dependencies) with enabled multithreading, I thought that this could be the problem.
Therfore I have tried it with the newest Ogre SDK but it is still the same problem : (

It seems to be a problem with some files on my HDD, wich make some trouble.
Some false dll files or something other?
It is very strange..
Nobody else has this problem..

JohnJ

25-02-2008 03:49:08

It seems to be a problem with some files on my HDD, wich make some trouble.
Some false dll files or something other?

Hmm.. that could be it, possibly. Did you make sure you copied the appropriate latest Ogre's DLL files into PagedGeometry's debug/release folders after upgrading to the latest SDK?

OgreSES

26-02-2008 08:29:34

I meet the same error,and I find the problem is in ImpostorPage.cpp in ImpostorTexture::ImpostorTexture(ImpostorPage *group, Entity *entity) method. when I change the code like this :
//t->setTextureUScroll((float)o / IMPOSTOR_YAW_ANGLES);
//t->setTextureVScroll((float)i / IMPOSTOR_PITCH_ANGLES);
t->setTextureUScroll(0);
t->setTextureVScroll(0);
My demo will not crash. I think here the texture coordinate can not be set the value larger than 0. But I don't know how to fix the problem.

Before change the code,the demo crashed with ATI X300 card, but it works well with Geforce 8600 card. after change the code, ATI X300 card can work.

Sorry for my peer english!

Shion

26-02-2008 15:30:59

OgreSES.. I LOVE U SO MUCH ^^

That's it!
It works *yay* :P

thx to all helper ^^

JohnJ

26-02-2008 17:02:53

Glad you got it working (kindof - impostors aren't going to look right because they'll only show one direction). It's strange that the shaders don't work.

Edit: I think I know what's happening. Ogre may be trying to use fixed-function texture scroll with a shader. Theoretically I might be able to fix this by removing the scroll data from the material and only providing it to the shader, but that would be a very hacky way of fixing this. I'll post about this in the Developer Forum and see if this is actually an Ogre bug or not.

OgreSES

28-02-2008 06:45:39

To JohnJ:
I have one question, you said "Ogre may be trying to use fixed-function texture scroll with a shader",but I think impostorpage just create materials use fixed-function pipeline,why do you say "a shader"?Is that Ogre create a shader automate? Thanks for your help!

JohnJ

28-02-2008 15:11:14

ImpostorPage generates a material with "snapshots" of your mesh, and passes it on to StaticBillboardSet. StaticBillboardSet applies a shader to the material so it appears as a camera-facing billboard. Ogre's fixed function BillboardSet class is used in place of StaticBillboardSet in case your computer doesn't support shaders, although in this case PagedGeometry will run much slower (StaticBillboardSet is much faster than BillboardSet).

Anyway, sinbad posted a patch that you can try on Ogre:
Index: RenderSystems/Direct3D9/src/OgreD3D9RenderSystem.cpp
===================================================================
RCS file: /cvsroot/ogre/ogrenew/RenderSystems/Direct3D9/src/OgreD3D9RenderSystem.cpp,v
retrieving revision 1.178.2.11
diff -u -r1.178.2.11 OgreD3D9RenderSystem.cpp
--- RenderSystems/Direct3D9/src/OgreD3D9RenderSystem.cpp 16 Dec 2007 18:01:13 -0000 1.178.2.11
+++ RenderSystems/Direct3D9/src/OgreD3D9RenderSystem.cpp 27 Feb 2008 23:00:00 -0000
@@ -1745,6 +1745,16 @@
// Cache texcoord calc method to register
TexCoordCalcMethod autoTexCoordType = mTexStageDesc[stage].autoTexCoordType;

+ // if a vertex program is bound, we mustn't set texture transforms
+ if (mVertexProgramBound)
+ {
+ hr = __SetTextureStageState( stage, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE );
+ if( FAILED( hr ) )
+ OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR, "Unable to disable texture coordinate transform", "D3D9RenderSystem::_setTextureMatrix" );
+ return;
+ }
+
+
if (autoTexCoordType == TEXCALC_ENVIRONMENT_MAP)
{
if (mCaps.VertexProcessingCaps & D3DVTXPCAPS_TEXGEN_SPHEREMAP)


If you can try this, it might fix the problem.

Shion

28-02-2008 17:41:25

Yes :D
this fixed the problem.
Thx.

JohnJ

28-02-2008 18:59:04

Good to hear. Thanks to your confirmation, this fix will be included the next maintenance release of Ogre (1.4.7) according to sinbad.

Thanks for sticking with it to the end. I'm really glad we eventually managed to find what was causing this problem and got it fixed. It can be especially tricky tracking down a crash with your code on someone else's computer originating in another library :D

shaolin

20-04-2009 09:34:39

Was the fix added to shoggoth (v1.6.2)? I still see this error on Intel 945GM Cards!