Jump to content

Gabriel

Members
  • Posts

    96
  • Joined

  • Last visited

Posts posted by Gabriel

  1. I'm not sure I can use the command LoadTexture with png or tga! I think the only DDS I do not return an error with this API.

     

     

    I also i try "mips map option", but always black

     

    Which can test the file and tell me if he can see the image completely black?

     

    thank you

     

    Gabriel

  2. Hello,

    I have a bitmap that I want to display with the transparancy. I use "Paint.net" when I backup my file Screen.dds (DXT5) my image to the screen is black! I try with "and paintshop plugin nvidia" then "MakeDDS" and it is alway the same thing!

     

    Mais le plus vexant "doors1.dds" fonctionne tres bien. sauf si je l'edite ou le converti avec "MakeDDS.exe"

     

    Some can give me a little color in my code;-)?

     

    TTexture m_ScreenMask=LoadTexture ("abstract::Screen.dds");
    ..
    
    {
    UpdateFramework();
    RenderFramework();
    SetBlend(1);
    DrawImage( m_ScreenMask,0,0,1280,1024);
    SetBlend(0);
    Flip(0);
    }
    

  3. Hello

     

    I have a big problem!

    In my scene there are six objects who walk all alone. The movements of the object have been created with key animations in 3DMax.

     

    My problem is the visibility of the object they disappeared according to their position if the camera is fixed or if the camera moves and the character stay at same position.

     

    The effect is reversed depending of axis is negative or positive !!

     

    I tried "EntityViewRange" , but it makes no difference

     

    Please help me this is very urgent.

     

     

    Thank you in advance

     

     

    Undo edits

    Gabriel

  4. Hello Josh

     

    the only laptop at home is a mac. and my wife is sick I stay glued to my desktop PC in my office along.

    I thought that this could be a solution, I could continue my developement on my emulator.

     

    PS: BlitzBasic works perfectly on the emulator VMWare fusion!

     

    If you ever have an idea, my wife will be eternally grateful to you;-)

     

    Gabriel

  5. Hello,

    I try to run an application leadwerks on vmware fusion virtual machine, but it does not work the same probleme with editor: (

    someone has an idea?

     

    below the log file

     

    Warning: Failed to load material "abstract::dust.mat": Path not found.
    Leadwerks Engine 2.5
    Initializing Renderer...
    OpenGL Version: 2.1 Mesa 7.5.1
    GLSL Version: 1.20
    Render device: Gallium 0.3 on SVGA3D; build: RELEASE; 
    Vendor: VMware, Inc.
    DrawBuffers2 supported: 0
    16 texture units supported.
    GPU instancing supported: 0
    Shader model 4.0 supported: 0
    Conditional render supported: 0
    Loading shader "zip::c:/course/montanahorseleo/resources/shaders.pak//query.vert", ""...
    Invoking script "C:/course/MontanaHorseLeo/Scripts/start/collisions.lua"...
    Invoking script "C:/course/MontanaHorseLeo/Scripts/start/fliphook.lua"...
    Invoking script "C:/course/MontanaHorseLeo/Scripts/start/globals.lua"...
    Loading model "c:/course/montanahorseleo/resources/models/splin/voiture/voiture.gmf"...
    Loading mesh "c:/course/montanahorseleo/resources/models/splin/voiture/voiture.gmf"...
    Loading material "c:/course/montanahorseleo/resources/models/splin/voiture/voitureuv01.mat"...
    Loading texture "c:/course/montanahorseleo/resources/models/splin/voiture/voitureuv01.dds"...
    Loading shader "zip::c:/course/montanahorseleo/resources/shaders.pak//mesh/mesh_skin_diffuse.vert", "zip::c:/course/montanahorseleo/resources/shaders.pak//mesh/mesh_diffuse.frag"...
    Error: Failed to compile fragment shader object.
    Error: Array index out of bounds (index=1 size=1)
    
    
    Source:
    #version 120
    #define LW_MAX_PASS_SIZE 1
    #define LW_DIFFUSE texture0
    
    #extension GL_ARB_draw_buffers : enable
    
    uniform vec3 cameraposition;
    uniform vec2 buffersize;
    uniform vec2 camerarange;
    
    float greyscale( in vec3 color ) {
    return color.x * 0.3 + color.y * 0.59 + color.z * 0.11;
    }
    
    float DepthToZPosition(in float depth) {
    return camerarange.x / (camerarange.y - depth * (camerarange.y - camerarange.x)) * camerarange.y;
    }
    
    float ZPositionToDepth(in float z) {
    return (camerarange.x / (z / camerarange.y) - camerarange.y) / -(camerarange.y - camerarange.x);
    }
    
    
    #ifdef LW_DETAIL
    uniform sampler2D LW_DETAIL;
    #endif
    
    #ifdef LW_DIFFUSE
    uniform sampler2D LW_DIFFUSE;
    #endif
    
    #ifdef LW_DIFFUSE2
    uniform sampler2D LW_DIFFUSE2;
    #endif
    
    #ifdef LW_SPECULARMAP
    uniform sampler2D LW_SPECULARMAP;
    #endif
    
    #ifdef LW_BUMPMAP
    uniform sampler2D LW_BUMPMAP;
    #endif
    
    #ifdef LW_BUMPMAP2
    uniform sampler2D LW_BUMPMAP2;
    #endif
    
    #ifdef LW_BLOOM
    uniform sampler2D LW_BLOOM;
    #endif
    
    #ifdef LW_CUBEMAP
    uniform samplerCube LW_CUBEMAP;
    varying vec3 cubemapdir;
    varying vec3 cubemapnormal;
    #endif
    
    #ifdef LW_GIMAP
    uniform sampler2D LW_GIMAP;
    #endif
    
    #ifdef LW_PARALLAXMAP
    uniform sampler2D LW_PARALLAXMAP;
    varying vec3 eyevec;
    #endif
    
    #ifdef LE_REFRACTION
    uniform sampler2D LE_REFRACTION;
    uniform sampler2D LE_DEPTHBUFFER;
    uniform float refractionstrength = 0.01;
    #endif
    
    #ifdef LW_POMMAP
    vec3 vLightTS=vec3(0.577,0.577,0.577);
    varying vec3 eyevec;
    float depthP = 0.01;
    float nMinSamples = 20;
    float nMaxSamples = 50;	
    #endif
    
    #ifdef LW_MESHLAYER
    varying float vegetationfade;
    #endif
    
    #ifdef LW_ALPHABLEND
    uniform sampler2D LW_ALPHABLEND_INCOMINGCOLOR;
    uniform sampler2D LW_ALPHABLEND_INCOMINGNORMAL;
    #endif
    
    varying vec3 vertexposition;
    varying vec3 T,B,N;
    varying vec2 texcoord0;
    varying vec2 texcoord1;
    varying vec4 modelvertex;
    varying vec4 fragcolor;
    
    float fOcclusionShadow = 1.0;
    
    uniform sampler2D texture14;
    uniform float terrainsize;
    uniform vec3 terrainscale;
    uniform float bumpscale;
    uniform float specular;
    uniform float gloss;
    
    //Terrain color map
    uniform sampler2D texture12;
    
    void main(void) {
    
    vec4 diffuse = fragcolor;
    vec3 normal;
    float shininess = 0.0;
    vec2 texcoord=texcoord0;// only use this because of parallax mapping
    float selfillumination = 0.0;	
    
    vec2 terraincoord;
    float terrainresolution;
    
    #ifdef LW_VERTEXGI
    	diffuse = vec4(1);
    #endif
    
    #ifdef LW_PARALLAXMAP
    	texcoord += (diffuse.w * 0.04 - 0.036) * normalize(eyevec).xy;
    	//texcoord += (texture2D(LW_DIFFUSE,texcoord).w * 0.04 - 0.036) * normalize(eyevec).xy;
    #endif
    
    #ifdef LW_POMMAP
    	// for POM, the heightmap is in the alpha of the diffuse so save ur diffuse with DXT5 I chose this because the alpha of DXT5 is higher precision
    // from Microsoft's and Ati's implementation thank them for the source 
    // Compute the ray direction for intersecting the height field profile with 
    // current view ray. See the above paper for derivation of this computation. (Ati's comment)
    
    // Compute initial parallax displacement direction: (Ati's comment)
    vec2 vparallaxdirection = normalize(eyevec).xy;
    
    // The length of this vector determines the furthest amount of displacement: (Ati's comment)
    float flength         = length( eyevec );
    float fparallaxlength = sqrt( flength * flength - eyevec.z * eyevec.z ) / eyevec.z; 
    
    // Compute the actual reverse parallax displacement vector: (Ati's comment)
    vec2 vParallaxOffsetTS = vparallaxdirection * fparallaxlength;
    
    // Need to scale the amount of displacement to account for different height ranges
    // in height maps. This is controlled by an artist-editable parameter: (Ati's comment)
    vParallaxOffsetTS *= depthP; 
    
    int nNumSamples;
    nNumSamples = int((mix( nMinSamples, nMaxSamples, 1-dot( vparallaxdirection, N.xy ) )));	//In reference shader: int nNumSamples = (int)(lerp( nMinSamples, nMaxSamples, dot( eyeDirWS, N ) ));
    float fStepSize = 1.0 / float(nNumSamples);	
    float fCurrHeight = 0.0;
    float fPrevHeight = 1.0;
    float fNextHeight = 0.0;
    int    nStepIndex = 0;
    vec2 vTexOffsetPerStep = fStepSize * vParallaxOffsetTS;
    vec2 vTexCurrentOffset = texcoord.xy;
    float  fCurrentBound     = 1.0;
    float  fParallaxAmount   = 0.0;
    
    vec2 pt1 = vec2(0,0);
    vec2 pt2 = vec2(0,0);	    
    
    while ( nStepIndex < nNumSamples ) 
    {
    vTexCurrentOffset -= vTexOffsetPerStep;
    
    // Sample height map which in this case is stored in the alpha channel of the normal map: (Ati's comment)
    fCurrHeight = texture2D( LW_DIFFUSE, vTexCurrentOffset).a; 
    
    fCurrentBound -= fStepSize;
    
    if ( fCurrHeight > fCurrentBound ) 
    {   
       pt1 = vec2( fCurrentBound, fCurrHeight );
       pt2 = vec2( fCurrentBound + fStepSize, fPrevHeight );
    
       nStepIndex = nNumSamples + 1;	//Exit loop
       fPrevHeight = fCurrHeight;
    }
    else
    {
       nStepIndex++;
       fPrevHeight = fCurrHeight;
    }
    } 
    float fDelta2 = pt2.x - pt2.y;
    float fDelta1 = pt1.x - pt1.y;
    
    float fDenominator = fDelta2 - fDelta1;
    
    // SM 3.0 requires a check for divide by zero, since that operation will generate
    // an 'Inf' number instead of 0, as previous models (conveniently) did: (Ati's comment)
    if ( fDenominator == 0.0 )
    {
    fParallaxAmount = 0.0;
    }
    else
    {
    fParallaxAmount = (pt1.x * fDelta2 - pt2.x * fDelta1 ) / fDenominator;
    }
    vec2 vParallaxOffset = vParallaxOffsetTS * (1 - fParallaxAmount );
    texcoord = texcoord - vParallaxOffset;        
    
    vLightTS = T * vLightTS.x + B * vLightTS.y + N * vLightTS.z;
    vec2 vLightRayTS = vLightTS.xy * depthP;
    // Compute the soft blurry shadows taking into account self-occlusion for
    // features of the height field:
    float sh0 = texture2D( LW_DIFFUSE, texcoord).a;
    //float sh7 = (texture2D( LW_DIFFUSE, texcoord + vLightRayTS * 0.55).a - sh0 - 0.55 ) * 6;
    //float sh6 = (texture2D( LW_DIFFUSE, texcoord + vLightRayTS * 0.44).a - sh0 - 0.44 ) * 8;
    //float sh5 = (texture2D( LW_DIFFUSE, texcoord + vLightRayTS * 0.33).a - sh0 - 0.33 ) * 10;
    //float sh4 = (texture2D( LW_DIFFUSE, texcoord + vLightRayTS * 0.22).a - sh0 - 0.22 ) * 12;
    // Compute the actual shadow strength:
    //fOcclusionShadow = 1 - max( max( max(  sh7, sh6 ), sh5 ), sh4 );
    // The previous computation overbrightens the image, let's adjust for that:
    //fOcclusionShadow = fOcclusionShadow* .1+.45;
    
    //diffuse *= fOcclusionShadow;
    
    
    #endif
    
    #ifdef LW_DIFFUSE2
    	vec4 diffuse2 = texture2D(LW_DIFFUSE2,texcoord);
    	diffuse = vec4(1);
    #endif	
    
    #ifdef LW_DIFFUSE
    	diffuse *= texture2D(LW_DIFFUSE,texcoord);//*fOcclusionShadow;
    #endif
    
    #ifdef LW_ALPHATEST
    	if (diffuse.w<0.5) {
    		discard;
    	}
    #endif
    
    
    normal = N;
    
    #ifdef LW_BUMPMAP
    
    	#ifdef LW_TERRAINNORMALS
    		//Use terrain normals
    		terraincoord=vec2(vertexposition.x,-vertexposition.z) / terrainsize + 0.5;
    		terrainresolution = terrainsize / terrainscale.x;
    		terraincoord += 0.5 / terrainresolution;
    		vec3 worldNormal = ((texture2D(texture14,terraincoord).xyz - 0.5) * 2.0).xyz;
    		normal = normalize(gl_NormalMatrix*worldNormal);
    	#else
    		vec4 bumpcolor = texture2D(LW_BUMPMAP,texcoord);
    		normal = bumpcolor.xyz * 2.0 - 1.0;
    	#endif
    
    	#ifdef LW_DETAIL
    		normal += texture2D(LW_DETAIL,texcoord * 4.0).xyz * 2.0 - 1.0;
    	#endif
    	normal.z /= bumpscale;
    	normal = T * normal.x + B * normal.y + N * normal.z;
    	normal = normalize(normal);
    	#ifdef LW_SPECULAR
    		shininess = bumpcolor.a*specular;//*fOcclusionShadow
    	#endif
    	#ifdef LW_SPECULARMAP
    		shininess = texture2D(LW_SPECULARMAP,texcoord).x*specular;//*fOcclusionShadow
    	#endif
    
    #else
    	normal=normalize(normal);
    #endif
    
    #ifdef LW_BUMPMAP2
    	vec3 normal2;
    	float shininess2;
    
    	vec4 bumpcolor2 = texture2D(LW_BUMPMAP2,texcoord);
    	normal2 = bumpcolor2.xyz * 2.0 - 1.0;
    
    	normal2.z /= bumpscale;
    	normal2 = T * normal2.x + B * normal2.y + N * normal2.z;
    	normal2 = normalize(normal2);
    	#ifdef LW_SPECULAR
    		shininess2 = bumpcolor2.a*specular;
    	#endif
    
    #endif	
    
    #ifdef LW_TERRAINNORMALS
    	#ifndef LW_BUMPMAP
    		//Use terrain normals
    		terraincoord=vec2(vertexposition.x,-vertexposition.z) / terrainsize + 0.5;
    		terrainresolution = terrainsize / terrainscale.x;
    		terraincoord.x -= 0.5 / terrainresolution;
    		//vec4 normsample=((texture2D(texture14,terraincoord).xyz - 0.5) * 2.0).xyz;
    		vec3 worldNormal = ((texture2D(texture14,terraincoord).xyz - 0.5) * 2.0).xyz;
    		normal = normalize(gl_NormalMatrix*worldNormal);
    		//shininess = normsample.w;
    	#endif
    #endif
    
    #ifdef LW_TERRAINCOLOR
    	//Use terrain color
    	terraincoord=vec2(vertexposition.x,-vertexposition.z) / terrainsize + 0.5;
    	terrainresolution = terrainsize / terrainscale.x;
    	terraincoord.x -= 0.5 / terrainresolution;
    	//terraincoord.y += 0.5 / terrainresolution;
    	vec4 terraincolor = texture2D(texture12,terraincoord);
    	diffuse = vec4( greyscale(diffuse.xyz) * 2.0 * terraincolor.xyz,diffuse.w);
    
    	#ifdef LW_MESHLAYER
    		float temp_w=diffuse.w;
    		diffuse = diffuse * (1.0-vegetationfade) + terraincolor * vegetationfade;
    		diffuse.w=temp_w;
    	#endif
    
    	shininess = terraincolor.w;
    #endif
    
    #ifdef LE_REFRACTION
    	diffuse.a=0.25;
    	vec4 refractionvector = vec4( gl_FragCoord.x/buffersize.x, gl_FragCoord.y/buffersize.y, gl_FragCoord.z, 1.0 );
    	vec4 refractionvector2 = refractionvector + refractionstrength * vec4(normal,0.0);		
    	if (gl_FragCoord.z<DepthToZPosition(texture2DProj(LE_DEPTHBUFFER,refractionvector2).x)) {
    		refractionvector=refractionvector2;
    	}
    	vec4 transparency = texture2DProj(LE_REFRACTION,refractionvector);
    	diffuse = transparency * diffuse;
    #endif
    
    #ifdef LW_BUMPMAP2
    	shininess = fragcolor.r * shininess + (1.0-fragcolor.r) * shininess2;
    	normal = fragcolor.r * normal + (1.0-fragcolor.r) * normal2;
    #endif
    
    vec3 adjustednormal = normal*0.5+0.5;
    float adjustedgloss = gloss;
    
    shininess=clamp(shininess,0.0,1.0)*0.5;
    
    
    
    #ifdef LW_DIFFUSE2
    	diffuse = fragcolor.r * diffuse + (1.0-fragcolor.r) * diffuse2;
    #endif	
    
       #ifdef LW_CUBEMAP
    	vec3 cubecoord = reflect( normalize( modelvertex.xyz - cameraposition ), normal * gl_NormalMatrix );
    	diffuse = vec4( textureCube(LW_CUBEMAP,cubecoord).xyz, diffuse.w);
       #endif
    
    //Diffuse
    gl_FragData[0] = diffuse;	
    
    //Normal
    #ifdef LW_FULLBRIGHT
    	gl_FragData[1] = vec4(1.0,1.0,1.0,diffuse.w);
    #else
    	gl_FragData[1] = vec4(adjustednormal,diffuse.w);
    #endif
    
    //Bloom
    #ifdef LW_BLOOM
    	vec4 bloomcolor = texture2D(LW_BLOOM,texcoord) * fragcolor;
    	gl_FragData[3] = bloomcolor;
    	gl_FragData[3].w = 0;
    #else
    	#ifdef LW_GIMAP
    		vec4 gicolor = texture2D(LW_GIMAP,vec2(texcoord1.x,1.0-texcoord1.y));
    
    		//We're going to clamp the results to prevent overbrightening when the lightmap environment doesn't match the dynamic lighting
    		//float gilum = gicolor.r * 0.3 + gicolor.g * 0.59 + gicolor.b * 0.11;
    		//float giscale = clamp(gilum,0,0.1) / gilum;
    		//gicolor.x *= giscale;
    		//gicolor.y *= giscale;
    		//gicolor.z *= giscale;
    		gicolor *= diffuse;
    		gicolor.w = 1.0;
    		gl_FragData[3] = gicolor;
    	#else
    		#ifdef LW_VERTEXGI
    			gl_FragData[3] = fragcolor * diffuse;
    			gl_FragData[3].w = 1.0;
    		#else
    			gl_FragData[3] = vec4(0);
    		#endif
    	#endif
    #endif
    
    //Modify depth output for shadows
    #ifdef LW_POMMAP
    	float z = DepthToZPosition(gl_FragCoord.z);
    	z = z -diffuse.a * fparallaxlength * depthP;
    	gl_FragDepth = ZPositionToDepth( z );
    #endif
    
    gl_FragData[2]=vec4(shininess,gloss,0.0,diffuse.w);
    
    /*
    float c;
    float temp;
    temp=adjustednormal.x*100.0;
    c=int(temp);
    temp=adjustednormal.y*100.0;
    c+=int(temp)/100.0;
    temp=adjustednormal.z*100.0;
    c+=int(temp)/100.0/100.0;
    gl_FragData[1].x = c;
    */
    }
    
    
    stack traceback:
    [C]: in function 'LoadScene'
    [string "C:\course\MontanaHorseLeo\start.lua"]:29: in main chunk
    
    

  6. Buy the cheap handbags sale with best quality from our shop now.When favored by a high-profile celebrity, a bag is suddenly more appealing.If you want to do wholesale

     

    XXXXXXXXXXXXXXXXXXXXXXXXXX business, our company is your best choice with the lowest factory wholesale price and free shipping service,welcome

     

    to do wholesale XXXXXXXXXXXXXXXXXXXXX business!No need to go for fake XXXXXXXXXXXXXXXXXXXXXX burberry scarf sale now as

     

    we are selling this genuine XXXXXXXXXXXXXXXXXXXXXX at a fraction of the retail price.In which case, the bag has a serious

     

    chance at being sold quickly and could easily get competitive bids if put up for auction.Therefore, it not only can provide you the protection from the chilly wind, but is also

     

    an elegant accessory and makes you look more charming and stylish.

     

    @kakanmi " go sell your **** somewhere else, what this guy is leech. If you need to squat this forum to sell your **** pffff is that it not worth a studded."

     

    @josh "the wiki page and in the same state!"

  7. Well.. i didnt test exactly that software yet, but i had some experience with Quest 3d. I think, its horrbile - to represent code as some visual components. It is kinda simple and funny from the very begining, but as project grows - it transfers nto nightmare.

     

    Thats only mine opinion and only about "visual programming" :)

    I'll check TiViPE

     

    why make simple , if complicated it works too ;-)

  8. Hello,

     

     

    I have crash with the Night and Day script with in C++

    When I incorporate in the editor, no propbleme it works and I save my file SBX.

    Then I make a LoadScene it works, but after a RenderFrameWork I get an error "access violation":/

     

    Any idea?

     

    thank you

     

    Gabriel

     

     

     

    
       m_pEngine = new LEO::Engine("Montana",ScreenWidth , ScreenHeight);
       m_pFrameWork = new LEO::Framework();
    
       BP L = GetLuaState();
       SetGlobalObject( "fw",(TEntity)m_pFrameWork);
       BP lua = GetLuaState();
       lua_pushobject( lua, (TEntity)m_pFrameWork);
       lua_setglobal( lua, "fw" );
       lua_pop( lua, 1 );
    
       m_scene = LE::LoadScene(FileName.c_str());
    
       SetHDR(1);
       SetSSAO(1);
       SetBloom(1);
       SetAntialias(1);
       SetShadowQuality(1);
       SetTextureQuality(1);
       OcclusionCulling(1);
    
       while(!KeyHit(KEY_ESCAPE))
       {
    
    m_pFrameWork->Update();
    m_pFrameWork->Render(); <-- crash when calling Render
    Flip(0);
       }
    

  9. Hi Roland,

     

    I totally agree with you Roland.

     

    And I love the C++, but also a black espresso without sugar ^^

     

    @ Gabriel I think that's the point. He's saying C++ doesn't need garbage collecting because it creates less garbage. It's simply a shot at other languages saying C++ is better.

     

    @Rick,

    I confirm, Roland it right;-)

    C++ is great

  10. Hi Roland

     

    There is no GC in C + +, there are automatic destructor, which is not the same thing.

     

    you are sure that Bjarne has said that?

     

    I would say this, if a program needs a GC is that it has a very big problem.

     

    Gabriel

  11. How to share the framework with LeadWerks and Lua script called with the function luaT_LoadFile ().

     

    For example:

    in my lua script "toto.lua"

    Notify ("Hello world")
    

     

    and in my C code:

    ...
    int  Istatus = luaL_loadfile  ((lua_State*) m_entity, "toto.lua");
    Istatus = lua_pcall  ((lua_State*) m_entity, 0, 0, 0);
    ...
    

     

    because when I do that, I have a not very nice this message:

    Unhandled exception at in 0x080b068f MontanaHorse.exe: 0xC0000005: Access violation when reading location 0x08010014.

     

    This problem occurs only when I call a function in lua!.

     

    if my lua script contains this:

    b=9999999 
    v=0
    for i = 0,b do
    v=v+1
    end
    

    then it works perfectly!

     

     

    Gabriel

  12. after debugging step by step in lua, that's the solution I without changing the source code of lua or LeadWerks.

     

    void Execute(const char*script)
    {
    static bool Dunny=false;
    int iStatus;
    
    if (!Dunny)
    {
    	Dunny=true;
    	iStatus = luaL_loadstring( (lua_State*)m_entity, "" ); // call only first time !!!
    }
    
    iStatus = luaL_loadfile( (lua_State*)m_entity, script );
    if (iStatus)
    {         
    	char szTmp[255];
    	sprintf(szTmp,"Error @LoadFile: %s",lua_tostring((lua_State*)m_entity, -1));
    	MessageBox(NULL, szTmp,"error in MontanaHorse.exe",MB_OK);
    	return ;     
    }      
    
    iStatus = lua_pcall( (lua_State*)m_entity, 0, 0, 0); //this might be to initialise the lua script     
    
    if( iStatus )     
    {         
    	char szTmp[255];
    	sprintf(szTmp,"Error @pcall: %s",lua_tostring((lua_State*)m_entity, -1));
    	MessageBox(NULL, szTmp,"error in MontanaHorse.exe",MB_OK);
    	return ;     
    }
    }
    

     

    I agree with you it's not very conventional, but it works.

    I will not get lost in debates where the bug;-)

     

    what I saw with the debug, after the first call to the luaL_loadfile stack is empty and only after the second call of luaT_loadfile the stack has a function.

     

    Here it works and I'm happy.

     

    Gabriel

  13. So I finally figured this thing out. I used the code I found here: http://cc.byexamples.com/2008/11/19/lua-stack-dump-for-c/ to debug the Lua stack at various points in the application. This is my final main loop:

     

       Script* s = new Script(reinterpret_cast<lua_State*> (GetLuaState()),
               "Scripts/Game/game.lua");
       while (!AppTerminate()) {
           UpdateFramework();
           s->Run(); // calls luaL_dofile
           RenderFramework();
           glPixelStoref(0x806E, 0);
           glPixelStoref(GL_PACK_ROW_LENGTH, 0);
           glPixelStoref(GL_UNPACK_ROW_LENGTH, 0);
           CEGUI::System::getSingleton().renderGUI();
           Flip();
       }
       delete s;
    

     

    It turns out only the first call to to s->Run() failed, and all others were fine. Appearantly simply calling CreateFramework() does not complete the initialization. Upon calling RenderFramework() the engine loads more resources and all subsequent calls to s->Run() work fine. Perhaps the Lua state is not initialized up until the first call to RenderFramework()? Anyhow, it is working perfectly fine now.

     

    Thanks for the help!

     

     

    Hi

     

    now : Run is not a methode of Script why is removed in my version 2.5 ?

     

    Thank

  14. Well, yes he have converted (Byte *) and this is what I have a problem. If an engine pass structure address that I have to treat it is better for me to use the correct structure. otherwise I could have anything like information.

     

    example: for LuaJit

    Byte * ptr = (lua_State *) ptr 25; IS lu_byte hookmask;

    by cons to Lua:

    Byte * ptr = (lua_State *) ptr 25; IS lu_byte baseCcalls;

     

    because-as in "luaJit" a field of type byte is inserted in this structure.

     

    I also need if the structure is alligned to 1 byte or 4 bytes ...

    otherwise I am absolutely sure of side effects as viollation access or blue screen.

     

    C or C++ is not a interpreter and the compiler has a tendency to do make what the programmer told to do ;-) with without reflection like politicians lol

  15. my methode Execute

     

    	void Execute(const char*script)
    	{
    		//lua_State *L = (lua_State*)GetLuaState();
    		lua_State *L = reinterpret_cast<lua_State*> (GetLuaState());
    
    		if (luaL_loadfile(L, script) || lua_pcall(L, 0, 0, 0))
    		{
    			char szTmp[255];
    			sprintf(szTmp,"err:: %s",lua_tostring(L, -1));
    			MessageBox(NULL, szTmp,"error in MontanaHorse.exe",MB_OK);
    		}
    	}
    
    

     

    yes a try with absolute and relative paths, but same responce "err: attempt to call a string value"

     

    please HELLLLLPPPP ME lol ;-)

×
×
  • Create New...