irrCg v0.8 (Initial) - CgFX (Texture States, MultiPass etc.)
IrrCg doesn't support *.fx files. Yes, You can use it as is, but You have to define in shader callback some parameters: matViewProjection, ModelColor, ModelColor2 and entry points: vs_main, ps_main. You can do it via IrrCg material file.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Thanks, I got these Link errors:
and I included the files necessary, i'm using IrrCg 0.7 which i think is compiled with 1.4.1, right?
Code: Select all
1>LIBCMT.lib(invarg.obj) : error LNK2005: __initp_misc_invarg already defined in LIBCMTD.lib(invarg.obj)
1>LIBCMT.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in LIBCMTD.lib(invarg.obj)
1>LIBCMT.lib(invarg.obj) : error LNK2005: __set_invalid_parameter_handler already defined in LIBCMTD.lib(invarg.obj)
1>LIBCMT.lib(invarg.obj) : error LNK2005: __get_invalid_parameter_handler already defined in LIBCMTD.lib(invarg.obj)
1>LIBCMT.lib(invarg.obj) : error LNK2005: "void __cdecl _invoke_watson(unsigned short const *,unsigned short const *,unsigned short const *,unsigned int,unsigned int)" (?_invoke_watson@@YAXPBG00II@Z) already defined in LIBCMTD.lib(invarg.obj)
1>LIBCMT.lib(invarg.obj) : error LNK2005: __invalid_parameter already defined in LIBCMTD.lib(invarg.obj)
1>LIBCMT.lib(invarg.obj) : error LNK2005: "void __cdecl _invalid_parameter(unsigned short const *,unsigned short const *,unsigned short const *,unsigned int,unsigned int)" (?_invalid_parameter@@YAXPBG00II@Z) already defined in LIBCMTD.lib(invarg.obj)
1>LIBCMT.lib(invarg.obj) : error LNK2005: ___pInvalidArgHandler already defined in LIBCMTD.lib(invarg.obj)
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Havok2.obj : warning LNK4217: locally defined symbol _printf imported in function "void __cdecl __HavokErrorReport(char const *,void *)" (?__HavokErrorReport@@YAXPBDPAX@Z)
1>IrrCg.lib(IrrCg.obj) : error LNK2019: unresolved external symbol _cgGLLoadProgram referenced in function "public: virtual void __thiscall IrrCg::ICgGLServices::LoadProgram(struct _CGprogram *,bool)" (?LoadProgram@ICgGLServices@IrrCg@@UAEXPAU_CGprogram@@_N@Z)
1>IrrCg.lib(IrrCg.obj) : error LNK2019: unresolved external symbol _cgGLBindProgram referenced in function "public: virtual void __thiscall IrrCg::ICgGLServices::EnableShader(struct _CGprogram *,enum CGprofile)" (?EnableShader@ICgGLServices@IrrCg@@UAEXPAU_CGprogram@@W4CGprofile@@@Z)
1>IrrCg.lib(IrrCg.obj) : error LNK2019: unresolved external symbol _cgGLEnableProfile referenced in function "public: virtual void __thiscall IrrCg::ICgGLServices::EnableShader(struct _CGprogram *,enum CGprofile)" (?EnableShader@ICgGLServices@IrrCg@@UAEXPAU_CGprogram@@W4CGprofile@@@Z)
1>IrrCg.lib(IrrCg.obj) : error LNK2019: unresolved external symbol _cgGLDisableProfile referenced in function "public: virtual void __thiscall IrrCg::ICgGLServices::DisableShader(enum CGprofile)" (?DisableShader@ICgGLServices@IrrCg@@UAEXW4CGprofile@@@Z)
1>IrrCg.lib(IrrCg.obj) : error LNK2019: unresolved external symbol _cgGLEnableTextureParameter referenced in function "public: virtual void __thiscall IrrCg::ICgGLServices::EnableTexture(struct _CGparameter *,class irr::video::ITexture *)" (?EnableTexture@ICgGLServices@IrrCg@@UAEXPAU_CGparameter@@PAVITexture@video@irr@@@Z)
1>IrrCg.lib(IrrCg.obj) : error LNK2019: unresolved external symbol _cgGLSetTextureParameter referenced in function "public: virtual void __thiscall IrrCg::ICgGLServices::EnableTexture(struct _CGparameter *,class irr::video::ITexture *)" (?EnableTexture@ICgGLServices@IrrCg@@UAEXPAU_CGparameter@@PAVITexture@video@irr@@@Z)
1>IrrCg.lib(IrrCg.obj) : error LNK2019: unresolved external symbol _cgGLDisableTextureParameter referenced in function "public: virtual void __thiscall IrrCg::ICgGLServices::DisableTexture(struct _CGparameter *)" (?DisableTexture@ICgGLServices@IrrCg@@UAEXPAU_CGparameter@@@Z)
1>IrrCg.lib(IrrCg.obj) : error LNK2019: unresolved external symbol _cgGLSetMatrixParameterfc referenced in function "public: virtual void __thiscall IrrCg::ICgGLServices::setWorldViewProjectionMatrix(struct _CGparameter *,enum IrrCg::IRRCG_TRANSFORM)" (?setWorldViewProjectionMatrix@ICgGLServices@IrrCg@@UAEXPAU_CGparameter@@W4IRRCG_TRANSFORM@2@@Z)
1>C:\Users\Ophiel\Documents\Visual Studio 2008\Projects\The 7 Stones\Debug\The 7 Stones.exe : fatal error LNK1120: 8 unresolved externals
1>Build log was saved at "file://c:\Users\Ophiel\Documents\Visual Studio 2008\Projects\The 7 Stones\The 7 Stones\Debug\BuildLog.htm"
1>The 7 Stones - 17 error(s), 12 warning(s)
#include <Cg/Cg.h>
#include <IrrCg.h>
#pragma comment(lib,"IrrCg.lib")
#pragma comment(lib,"cg.lib")
#pragma comment(lib,"cgD3D9.lib")
You have to also linking cgGL.lib, because it IrrCg is compile with OpenGL support (in v0.8 I will add option to disable / enable OpenGL support similar for Direct3D9). You have got probably wrong Multi Threaded flag selected - LIBCMTD.lib errors.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Well, i'm using the Debug DLL and i'm already excluding the libs, now i got these link errors:
Code: Select all
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Havok2.obj : warning LNK4217: locally defined symbol _printf imported in function "void __cdecl __HavokErrorReport(char const *,void *)" (?__HavokErrorReport@@YAXPBDPAX@Z)
1>libcpmtd.lib(cout.obj) : error LNK2019: unresolved external symbol __CrtDbgReportW referenced in function "public: char const & __thiscall std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> >::operator*(void)const " (??D?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEABDXZ)
1>libcpmtd.lib(stdthrow.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __malloc_dbg referenced in function "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??2@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z)
1>libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __free_dbg referenced in function "void __cdecl operator delete(void *,struct std::_DebugHeapTag_t const &,char *,int)" (??3@YAXPAXABU_DebugHeapTag_t@std@@PADH@Z)
1>libcpmtd.lib(_tolower.obj) : error LNK2019: unresolved external symbol __calloc_dbg referenced in function __Getctype
1>C:\Users\Ophiel\Documents\Visual Studio 2008\Projects\The 7 Stones\Debug\The 7 Stones.exe : fatal error LNK1120: 4 unresolved externals
There aren't IrrCg errors. With IrrCg all is ok, compiler log doesn't show problems with Irrlicht and IrrCg. Errors are cause by wrong Multi Threaded options in Your project (Static/Dynamic DLL). You can try use static Multi Threaded runtime. Other problem is cause by Havoc engine linking.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Ok, i got it to compile with everything how ever something strange happens, The app tries to run but then it gets an access violation. it points to this line:
I hope you know what is wrong.......
Code: Select all
strlen.asm:
mov eax,dword ptr [ecx] ; read 4 bytes
My code to load the material:
GPU = new IrrCg::ICgProgrammingServices(this->Device);
if(GPU)
{
GUI->addMessageBox(L"Shaders are working",L"Yay for shaders!",true,EMBF_OK);
}
}
s32 Color = GPU->addCgShaderMaterialFromMaterialFile("Shaders//Red.xml",MCB);
if(!HavokInit.Initialize_Havok())
{
return 1;
}
this->LoadLevel();
this->LoadPlayerMesh();
if(Color)
{
Player_Mesh_Node->setMaterialType((E_MATERIAL_TYPE)Color);
}
My material code:
<?xml version = "1.0"?>
<Program Vertex = "Effect1.fx" Pixel="Effect.fx"/>
<EntryPointName Vertex = "vs_main" Pixel = "ps_man"/>
<DirectXProfile Vertex = "vs_2_0" Pixel= "ps_2_0"/>
<Callback>
<ParameterWVMatrix Program="Vertex" Name = "matViewProjection" Transform = "MATRIX_IDENTITY"/>
<Parameter4f Program="Vertex" Name = "ModelColor" X = "1.0" Y = "0.0" Z = "0.0" W = "1.0"/>
<CallBack/>
For the shader programs from Your previous post this material file is wrong. This is improved material:
You have to check parameters <Program> and <EntryPointName>
Code: Select all
<?xml version = "1.0"?>
<Program Vertex = "Effect.fx" Pixel="Effect.fx"/>
<EntryPointName Vertex = "vs_main" Pixel = "ps_main"/>
<DirectXProfile Vertex = "vs_2_0" Pixel= "ps_2_0"/>
<Callback>
<ParameterWVMatrix Program="Vertex" Name = "matViewProjection" Transform = "MATRIX_IDENTITY"/>
<Parameter4f Program="Pixel" Name = "ModelColor" X = "1.0" Y = "0.0" Z = "0.0" W = "1.0"/>
<Parameter4f Program="Pixel" Name = "ModelColor2" X = "1.0" Y = "1.0" Z = "0.0" W = "1.0"/>
<CallBack/>
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
I just tried to use pure DirectX with Irrlicht to load the shader and it worked, problem is that if i use Scene manager->draw all, it'll render all the meshes with that shader. another problem is since i'm using DirectX matrices it locks the mesh to the camera, so basically, with the FPS camera, you'll have your mesh follow the camera if you just rend that one mesh. Well, at least I got FX files into Irrlicht.
I don't know what is wrong, but on 100% this is cause by Your programming error. You have to check Your program code, maybe it has some issue eg. wrong path in material file etc.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
The effect is in the same folder as the xml, so i don't know. Unless i have to make 3 matrices in my shader file as i had to do that in another file i used that i got to work with DirectX like this:
that's the 3 matrices DX needs to set up the file good. I think for FX files you need three different matrices for it to work good, so i don't know, but it's something that i got FX files to "work" in Irrlicht......better then nothing I guess. Hey, do you have MSN? or AIM?
Code: Select all
float4x4 View : View;
float4x4 Projection : Projection;
float4x4 World : World;
Ok, i managed to load the material into another project and it didn't give me any problems about that but for some reason, the Pixel Shader Color isn't being set.
for some reason, the .xml file isn't being loaded.... I put it in a folder with the effect from Render monkey.....and nothing....Damn it.....
[/code]
for some reason, the .xml file isn't being loaded.... I put it in a folder with the effect from Render monkey.....and nothing....Damn it.....
[/code]
No I don't have MSN/AIM. If material file isn't loaded You have got wrong path for it in Your code. Try build Your demo with IrrCg material file example, You will be see where You have got error.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Yes, it works properly with Irrlicht 1.4.1, but lib in archive was compiled with Irrlicht 1.4, so You need rebuild IrrCg with Irrlicht 1.4.1
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes