irrCg v0.8 (Initial) - CgFX (Texture States, MultiPass etc.)

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Post Reply
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

Hi, I done material file support to IrrCg today. Sample material file for Normal Mapping looks like this:

Code: Select all

<?xml version="1.0"?>

<Program Vertex="../../cg/NormalMapping.cg" Pixel="../../cg/NormalMapping.cg"/>
<EntryPointName Vertex="main_v" Pixel="main_f"/>
<OpenGLProfile Vertex="arbvp1" Pixel="arbfp1"/>
<DirectXProfile Vertex="vs_2_0" Pixel="ps_2_0"/>
<Material Type="EMT_SOLID"/>

<CallBack>
	<ParameterCameraPosition Program="Vertex" Name="eyePosition"/>
	<ParameterWVPMatrix Program="Vertex" Name="WorldViewProj" Transform="MATRIX_IDENTITY"/>
	<Parameter3f Program="Vertex" Name="lightPosition" X="0.0" Y="0.0" Z="120.0"/>

	<Texture Program="Pixel" Name="DecalMap" ID="0"/>
	<Texture Program="Pixel" Name="NormalMap" ID="1"/>
	<Texture Program="Pixel" Name="SpecularMap" ID="2"/>
	<Parameter3f Program="Pixel" Name="LightDiffuse" X="1.0" Y="1.0" Z="1.0"/>
<CallBack/>
I think than this XML structure is friendly for users:) You can add for shaders created from material file Your own standard callback with non-standard functions. Now I improvments documentation for it and I think than all will be release today:)
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

IrrCg v0.7 is over:) Changelog for this version:

Code: Select all

- Add XML Style Material File support with documentation for it
- Replace some Functions:
     * void setWorldViewProjectionMatrix( CGparameter param,IRRCG_TRANSFORM trans,irr::scene::ISceneNode* node ) = void setWorldViewProjectionMatrix( CGparameter param,IRRCG_TRANSFORM trans )
     * void setWorldViewMatrix( CGparameter param,IRRCG_TRANSFORM trans,irr::scene::ISceneNode* node ) = void setWorldViewMatrix( CGparameter param,IRRCG_TRANSFORM trans )
     * void setWorldMatrix( CGparameter param,IRRCG_TRANSFORM trans,irr::scene::ISceneNode* node ) = void setWorldMatrix( CGparameter param,IRRCG_TRANSFORM trans )
     * void setViewMatrix( CGparameter param,IRRCG_TRANSFORM trans,irr::scene::ISceneNode* node ) = void setViewMatrix( CGparameter param,IRRCG_TRANSFORM trans )
     * void setViewProjectionMatrix( CGparameter param,IRRCG_TRANSFORM trans,irr::scene::ISceneNode* node ) = void setViewProjectionMatrix( CGparameter param,IRRCG_TRANSFORM trans )
     * void setProjectionMatrix( CGparameter param,IRRCG_TRANSFORM trans,irr::scene::ISceneNode* node ) = void setProjectionMatrix( CGparameter param,IRRCG_TRANSFORM trans )
- Add Example:
     * 04.MaterialFile
I'm waiting for Yours comments:) For downloads and more infos, first post was updated:)
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Halifax
Posts: 1424
Joined: Sun Apr 29, 2007 10:40 pm
Location: $9D95

Post by Halifax »

Well I have to say that I like you material file. That is definitely cool, and I always wanted to do something like that.
TheQuestion = 2B || !2B
pixeljunky
Posts: 19
Joined: Sun Feb 25, 2007 1:31 pm

Post by pixeljunky »

Great that you keep on developing this code.
Do you know if cg shaders are running on AMD cards ?

Did you already try the shaders from fx composer ?

Here is a link to the prg ...
http://developer.nvidia.com/object/fx_c ... _home.html

I am still a beginner so i am still trying to get it running ...
pixeljunky
Posts: 19
Joined: Sun Feb 25, 2007 1:31 pm

Post by pixeljunky »

Hey Nadro,

What tool do you use for creating cg shaders ?

pixel
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

Hi pixeljunky,
Of course Cg is universal shading language, so work properly also AMD / ATI cards (I have Radeon graphic cards). Yes You can create shaderin FX composer or Render Monkey and use generated code in IrrCg, but You need write Your material file also from information from generated fx file by Render Monkey or FX Composer. For shader making I use GEdit on Linux and Notepad on Windows:)
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Steel Style
Posts: 168
Joined: Sun Feb 04, 2007 3:30 pm
Location: France

Post by Steel Style »

IrrCG is cool but using 3 dll for cg is not, however, good work Nadro
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

I find small bug in IrrCg with OnUnsetMaterial:

Code: Select all

void ICgMaterialRenderer::OnUnsetMaterial()
{
    if(VertexProgram)
    CgServices->DisableShader(VertexProfile);
    if(PixelProgram)
    CgServices->DisableShader(PixelProfile);
}
please change it to:

Code: Select all

void ICgMaterialRenderer::OnUnsetMaterial()
{
    if(VertexProgram)
    CgServices->DisableShader(VertexProfile);
    if(PixelProgram)
    CgServices->DisableShader(PixelProfile);

    if (BaseMaterial)
    BaseMaterial->OnUnsetMaterial();
}
I also create Visual C++ 2005 project for IrrCg, You can download it from: http://nadro.net46.net/IrrCg/IrrCg.vcproj
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
frostysnowman
Posts: 83
Joined: Fri Apr 11, 2008 3:06 am
Location: Beaverton, Oregon, US

Post by frostysnowman »

I really love this, thanks Nadro. But what libraries are we supposed to import in our irrCg projects? By importing these ones:

Code: Select all

#pragma comment (lib,"irrlicht.lib")
#pragma comment (lib,"cg.lib") 
#pragma comment (lib,"IrrCg.lib")
#pragma comment (lib,"cgD3D9.lib")
#pragma comment (lib,"cgGL.lib")
I get these linker errors:
IrrCg.lib(IrrCg.obj) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) already defined in msvcprtd.lib(MSVCP90D.dll)
IrrCg.lib(IrrCg.obj) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP90D.dll)
libcpmt.lib(cout.obj) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP90D.dll)
libcpmt.lib(cout.obj) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) already defined in msvcprtd.lib(MSVCP90D.dll)
libcpmt.lib(string.obj) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP90D.dll)
libcpmt.lib(string.obj) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) already defined in msvcprtd.lib(MSVCP90D.dll)
libcpmt.lib(locale0.obj) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP90D.dll)
libcpmt.lib(locale0.obj) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) already defined in msvcprtd.lib(MSVCP90D.dll)
libcpmt.lib(locale0.obj) : error LNK2005: "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::operator=(char const *)" (??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@PBD@Z) already defined in msvcprtd.lib(MSVCP90D.dll)
LIBCMT.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMT.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall std::exception::exception(void)" (??0exception@std@@QAE@XZ) already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMT.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall std::exception::exception(char const * const &)" (??0exception@std@@QAE@ABQBD@Z) already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMT.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall std::exception::exception(class std::exception const &)" (??0exception@std@@QAE@ABV01@@Z) already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMT.lib(stdexcpt.obj) : error LNK2005: "public: virtual __thiscall std::exception::~exception(void)" (??1exception@std@@UAE@XZ) already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMT.lib(stdexcpt.obj) : error LNK2005: "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ) already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMT.lib(setlocal.obj) : error LNK2005: __configthreadlocale already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: __initterm_e already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: __exit already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: __cexit already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMT.lib(tidtable.obj) : error LNK2005: __encode_pointer already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMT.lib(tidtable.obj) : error LNK2005: __decode_pointer already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMT.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMT.lib(_trnsctrl_.obj) : error LNK2005: ___CxxFrameHandler3 already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMT.lib(typinfo.obj) : error LNK2005: "public: void __thiscall type_info::_type_info_dtor_internal_method(void)" (?_type_info_dtor_internal_method@type_info@@QAEXXZ) already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMT.lib(typinfo.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in MSVCRTD.lib(ti_inst.obj)
LIBCMT.lib(typinfo.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in MSVCRTD.lib(ti_inst.obj)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in MSVCRTD.lib(cinitexe.obj)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in MSVCRTD.lib(cinitexe.obj)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in MSVCRTD.lib(cinitexe.obj)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in MSVCRTD.lib(cinitexe.obj)
LIBCMT.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMT.lib(mlock.obj) : error LNK2005: __unlock already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMT.lib(mlock.obj) : error LNK2005: __lock already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMT.lib(atox.obj) : error LNK2005: _atoi already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMT.lib(crt0.obj) : error LNK2005: _mainCRTStartup already defined in MSVCRTD.lib(crtexe.obj)
LIBCMT.lib(errmode.obj) : error LNK2005: ___set_app_type already defined in MSVCRTD.lib(MSVCR90D.dll)
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
C:\Documents and Settings\edena\My Documents\Visual Studio 2008\IrrCg_v0_7\examples\01.BasicLighting\01.BasicLighting\Debug\01.BasicLighting.exe : fatal error LNK1169: one or more multiply defined symbols found
(I'm using Visual C++ 2008, CG 2.0 May 2008 Edition, Irrlicht 1.41)
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

Hi,
You're linking properly libraries, You have this error because You have got enabled option Multi-Threaded DLL Runtime Library (disable it and all should linking fine). But for compatible work IrrCg with Irrlicht 1.4.1 You have to rebuild IrrCg with Irrlicht 1.4.1 includes (I build it with Irrlicht 1.4, so for 1.4.1 You have to rebuild IrrCg) For rebuilding it You can use this VS2005 project: http://nadro.net46.net/IrrCg/IrrCg.vcproj With rebuilded IrrCg all will be works properly:)
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
grayman
Posts: 69
Joined: Thu May 12, 2005 10:48 am
Location: colombia

Post by grayman »

Dude im trying to compile this

Code: Select all

#include <iostream>

// Irrlicht and Cg Headers
#include "irrlicht.h"
#include <Cg/cg.h>

// IrrCg
#include "IrrCg.h"

// Irrlicht namespaces
using namespace irr;

using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

// Chernobyl Game Engine namespaces
using namespace IrrCg;

// Other namespaces
using namespace std;

IrrlichtDevice* Device = 0;
IVideoDriver* Driver = 0;
ISceneManager* SceneManager = 0;
stringw window = "";

class NormalMapCallBack : public ICgShaderConstantSetCallBack
{
public:
    CGparameter	WorldViewProjection;
    CGparameter	EyePosition;
    CGparameter	LightPosition;

    CGparameter	LightDiffuse;
    CGparameter	DecalMap;
    CGparameter	NormalMap;
    CGparameter	SpecularMap;

	virtual void OnSetConstants(ICgServices* services,CGprogram Vertex,CGprogram Pixel,SMaterial Material)
	{
        // Vertex Shader
        EyePosition = cgGetNamedParameter(Vertex, "eyePosition");
        vector3df CameraPosition = Device->getSceneManager()->getActiveCamera()->getAbsolutePosition();
        services->setParameter3f(EyePosition, CameraPosition.X, CameraPosition.Y, CameraPosition.Z);

        WorldViewProjection = cgGetNamedParameter(Vertex, "WorldViewProj");
        core::matrix4 worldViewProj;
		worldViewProj = Driver->getTransform(video::ETS_PROJECTION);
		worldViewProj *= Driver->getTransform(video::ETS_VIEW);
		worldViewProj *= Driver->getTransform(video::ETS_WORLD);
		services->setMatrix(WorldViewProjection,MATRIX_IDENTITY,worldViewProj);

		LightPosition = cgGetNamedParameter(Vertex, "lightPosition");
        services->setParameter3f(LightPosition, 0.0f, 0.0f, 120.0f);

        // Pixel Shader
        DecalMap = cgGetNamedParameter(Pixel, "DecalMap");
        services->EnableTexture( DecalMap,Material.getTexture(0));

        NormalMap = cgGetNamedParameter(Pixel, "NormalMap");
        services->EnableTexture( NormalMap,Material.getTexture(1));

        SpecularMap = cgGetNamedParameter(Pixel, "SpecularMap");
        services->EnableTexture( SpecularMap,Material.getTexture(2) );

        LightDiffuse = cgGetNamedParameter(Pixel, "LightDiffuse");
        services->setParameter3f(LightDiffuse, 1.0f, 1.0f, 1.0f);
	}
};

int main()
{
    printf("\n *** IrrCg Normal Mapping Example by Patryk Nadrowski ***\n\n");

    char i;

    // Select Irrlicht Driver
    video::E_DRIVER_TYPE DriverType;
	printf("\n Please select the driver you want for this demo:\n\n"\
		"  (a) Direct3D 9.0c\n  (b) OpenGL 1.5\n"\
		"  (otherKey) exit\n\n");

	std::cin >> i;

	switch(i)
	{
		case 'a':
            DriverType = EDT_DIRECT3D9;
            window = " Direct3D9 PS: [ps_2_0] ";
            break;

		case 'b':
            DriverType = EDT_OPENGL;
            window = " OpenGL PS: [arbfp1] ";
            break;

		default: return 1;
	}

	Device = createDevice(DriverType,dimension2d<s32>(800 , 600),32,false,false,false,0);
	Driver = Device->getVideoDriver();
	SceneManager = Device->getSceneManager();

    // Create Cg Programming Service
    ICgProgrammingServices* GPU = new ICgProgrammingServices(Device);

    // Create Cg Shader Material
    NormalMapCallBack* NMCB = new NormalMapCallBack();
    s32 CgNormalMapMaterialType = GPU->addCgShaderMaterialFromFiles(CG_SOURCE,"../../cg/NormalMapping.cg","main_v","arbvp1","vs_2_0","../../cg/NormalMapping.cg","main_f","arbfp1","ps_2_0",NMCB,EMT_SOLID);

    // Create Node
    IAnimatedMesh* mesh = SceneManager->getMesh("../../media/DOOM3/imp.ms3d");

    ((ISkinnedMesh*)mesh)->convertMeshToTangents();

	IAnimatedMeshSceneNode* node = SceneManager->addAnimatedMeshSceneNode(mesh);
	node->setPosition(core::vector3df(0,0,0));
	node->setRotation(core::vector3df(0,0,0));
	node->setScale(core::vector3df(1,1,1));
	node->setAutomaticCulling(EAC_FRUSTUM_BOX);
	node->setMaterialFlag(video::EMF_LIGHTING, false);
	// Apply Cg Shader Material to Node
	node->setMaterialType((video::E_MATERIAL_TYPE)CgNormalMapMaterialType);

    node->getMaterial(0).TextureLayer[0].Texture = Driver->getTexture("../../media/DOOM3/imp_d.tga");
    node->getMaterial(0).TextureLayer[1].Texture = Driver->getTexture("../../media/DOOM3/imp_local.tga");
    node->getMaterial(0).TextureLayer[2].Texture = Driver->getTexture("../../media/DOOM3/imp_s.tga");

    // Create Camera
	scene::ICameraSceneNode* cam = SceneManager->addCameraSceneNodeFPS(0,100.0f,100.0f);
	cam->setPosition(core::vector3df(120,0,0));
	cam->setTarget(core::vector3df(0,0,0));

    // Hide Mouse Cursor
    Device->getCursorControl()->setVisible(false);

    // Last FPS
    int lastFPS = -1;

	while(Device->run())
    if (Device->isWindowActive())
	{
	    // Begin Scene
		Driver->beginScene(true, true, video::SColor(255,0,0,0));

        // Draw All
        SceneManager->drawAll();

        // End Scene
		Driver->endScene();

		int fps = Driver->getFPS();
		int poly = Driver->getPrimitiveCountDrawn();

		if (lastFPS != fps)
		{
		    core::stringw str = "";
            str = L"Irrlicht Cg - NormalMapping with Specular for";
            str += window;
            str += L" FPS: ";
            str += fps;
            str += L" Poly: ";
            str += poly;

            Device->setWindowCaption(str.c_str());
            lastFPS = fps;
		}
	}
	delete GPU;
	Device->drop();
	return 0;
}

and i get this:

1>------ Operación Generar iniciada: proyecto: 3textmaps, configuración: Release Win32 ------
1>Vinculando...
1>main.obj : error LNK2001: símbolo externo "public: int __thiscall IrrCg::ICgProgrammingServices::addCgShaderMaterialFromFiles(enum CGenum,char const *,char const *,char const *,char const *,char const *,char const *,char const *,char const *,class IrrCg::ICgShaderConstantSetCallBack *,enum irr::video::E_MATERIAL_TYPE,char const * *)" (?addCgShaderMaterialFromFiles@ICgProgrammingServices@IrrCg@@QAEHW4CGenum@@PBD1111111PAVICgShaderConstantSetCallBack@2@W4E_MATERIAL_TYPE@video@irr@@PAPBD@Z) sin resolver
1>main.obj : error LNK2001: símbolo externo "public: __thiscall IrrCg::ICgProgrammingServices::~ICgProgrammingServices(void)" (??1ICgProgrammingServices@IrrCg@@QAE@XZ) sin resolver
1>main.obj : error LNK2001: símbolo externo "public: __thiscall IrrCg::ICgProgrammingServices::ICgProgrammingServices(class irr::IrrlichtDevice *)" (??0ICgProgrammingServices@IrrCg@@QAE@PAVIrrlichtDevice@irr@@@Z) sin resolver
1>main.obj : error LNK2001: símbolo externo "__declspec(dllimport) class irr::IrrlichtDevice * __cdecl irr::createDevice(enum irr::video::E_DRIVER_TYPE,class irr::core::dimension2d<int> const &,unsigned int,bool,bool,bool,class irr::IEventReceiver *)" (__imp_?createDevice@irr@@YAPAVIrrlichtDevice@1@W4E_DRIVER_TYPE@video@1@ABV?$dimension2d@H@core@1@I_N22PAVIEventReceiver@1@@Z) sin resolver
1>main.obj : error LNK2001: símbolo externo _cgGetNamedParameter sin resolver
1>J:\home\vladimir\NetBeansProjects\3textmaps\Release\3textmaps.exe : fatal error LNK1120: 5 externos sin resolver
1>El registro de compilación se guardó en el "file://j:\home\vladimir\NetBeansProjects\3textmaps\3textmaps\Release\BuildLog.htm"
1>3textmaps - 6 errores, 0 advertencias
========== Generar: 0 correctos, 1 incorrectos, 0 actualizados, 0 omitidos ==========



Any hint?, im on xp32, vsc++9xpress but i would like to compile it on ubuntu x64, netbeans.... :roll:
System

AMD X2 4200
nvidia 7600gs 256mb
2GB ram DDR2
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

You have to linking in project IrrCg library (IrrCg.lib). On Ubuntu x64 You can also compile IrrCg via makefile included in IrrCg archive.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

I'm tempted to use Cg for all my future shader work. The main issue I have is that if I make a D3D shader I can debug it via PIX, including single-stepping through the HLSL. What tools are available for Cg debugging?
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

sio2 wrote:I'm tempted to use Cg for all my future shader work. The main issue I have is that if I make a D3D shader I can debug it via PIX, including single-stepping through the HLSL. What tools are available for Cg debugging?
Currently only NVIDIA Shader Debugger (plugin for FX Composer 2.5), but it isn't free (30 days trial).
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Gman3344
Posts: 23
Joined: Tue Jul 22, 2008 9:03 pm

Post by Gman3344 »

Ok, i'm not sure I totally understand this but you said that if i were to load an .fx file it would work? because the code from render monkey is different then Cg. for example

Code: Select all


Vertex Shader:

float4x4 matViewProjection;

struct VS_INPUT 
{
   float4 Position : POSITION0;
   
};

struct VS_OUTPUT 
{
   float4 Position : POSITION0;
   
};

VS_OUTPUT vs_main( VS_INPUT Input )
{
   VS_OUTPUT Output;

   Output.Position = mul( Input.Position, matViewProjection );
   
   return( Output );
   
}

Pixel Shader:
float4 ModelColor;
float4 ModelColor2;
float4 ps_main() : COLOR0
{   
 
   return( ModelColor+ModelColor2 );
   
}

Now can i just load it as is and it will work? cause i'm a bit confused right now.
Post Reply