Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Shader does not apply to mesh ?????  (Read 1272 times)
cu_khoai_ha
Community Member
*
Posts: 4


« on: March 23, 2010, 04:36:17 PM »

Hi all,

I have a Phong Shader (.FX file) generated with FX Composer.
My code loads shader:
Quote
PhongShader.CreateFromEffectFile("phong.fx");
pMesh->LoadTVM("ball.tvm");
pMesh->SetShader(&PhongShader);

The statements "CreateFromEffectFile" return true, but with or without it the ball has no change. I think the shader didn't applied to the mesh. Can someone explain about this error?

Does anyone has code about apply Phong Shader in TV3D 6.5? I searched but the TV3D Wiki Page was down Sad(((((
Logged
AriusEso
Customers
Community Member
*****
Posts: 940

Esoteric


« Reply #1 on: March 23, 2010, 06:53:54 PM »

Remove the &.

Edit:

Well, also of course.

CTVShader *PhongShader;
Logged

-...-

cu_khoai_ha
Community Member
*
Posts: 4


« Reply #2 on: March 23, 2010, 10:34:22 PM »

Offcourse I have the code "CTVShader PhongShader;" before.
I use C++ not C#, it's compiled ok. "&" is nessesary for pointer!!!!!!
Logged
AriusEso
Customers
Community Member
*****
Posts: 940

Esoteric


« Reply #3 on: March 23, 2010, 11:36:36 PM »

Offcourse I have the code "CTVShader PhongShader;" before.
I use C++ not C#, it's compiled ok. "&" is nessesary for pointer!!!!!!

Code:
CTVShader PhongShader;

Is not the same as:

Code:
CTVShader *PhongShader

I don't use C# either.

Example:

Code:
CTVShader *m_Shader;

//--

m_Shader = m_Scene->CreateShader("bah");
m_Shader->CreateFromEffectFile("shader.fx");

m_Mesh->SetShader(m_Shader);

& is for taking an address.
Logged

-...-

ZaPPZion
Moderator
Community Member
*****
Posts: 555


« Reply #4 on: March 24, 2010, 05:50:38 AM »

Hehe, same discussion i had with someone in my class. If it compiles, it doesn't always mean it's working.

bool DoesGodExist()
{
   return false;
}

compiles just fine, but depends on the outcome you want to hear if it's really working  Roll Eyes
Logged

Check out my website: www.bartkuipers.com
jviper
Community Member
*
Posts: 2130

Discipline in training


« Reply #5 on: March 24, 2010, 03:19:41 PM »

Also could be you are using the wrong semantics if you just look the shader straight from FX Composer and did not convert the semantics from whatever FX Composer uses to what TV3D uses.
Logged

JAbstract.....Don't just imagine, make it happen!
Pages: [1]
  Print  
 
Jump to:  

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