darhal Posted July 5, 2015 Share Posted July 5, 2015 the walls textures sometimes appear like this : http://imgur.com/tcw9nYi local myshader = dxCreateShader("material/effect.fx") local mytexture = dxCreateTexture(texPath, "dxt3") dxSetShaderValue( myshader,"gTexture", mytexture) engineApplyShaderToWorldTexture( myshader, getObjectTextureName(objectInEdit), createdObject ) this my code nothing special the problem is in dxSetShaderValue the 3 argument is bad argument P.S: this work sometimes and break othertimes Link to comment
Bonsai Posted July 5, 2015 Share Posted July 5, 2015 So it sometimes fails to create the Texture? Maybe you create too many of those at once. Link to comment
darhal Posted July 5, 2015 Author Share Posted July 5, 2015 So it sometimes fails to create the Texture?Maybe you create too many of those at once. Exactly !, It fail to create Textures but what u mean by "creating too many of those once ?" Link to comment
Bonsai Posted July 6, 2015 Share Posted July 6, 2015 So it sometimes fails to create the Texture?Maybe you create too many of those at once. Exactly !, It fail to create Textures but what u mean by "creating too many of those once ?" I don't know how the rest of your code looks like. Also post the error log if possible. Link to comment
darhal Posted July 6, 2015 Author Share Posted July 6, 2015 The block that contain those functions is realy huge this is a part of it for k, v in pairs(zoneTable.objectsPositions) do if area then createdObjectAfterSave = createObject(v.model, v.x, v.y, v.z, v.rx, v.ry, v.rz) setElementCollisionsEnabled (createdObjectAfterSave, true) table.insert(currentZoneObjects, createdObjectAfterSave) --createdObjectAfterSave = currentZoneObjects[k] setObjectScale(createdObjectAfterSave, 1)--v.scale) setElementData(createdObjectAfterSave, "objectArea", area) if v.texture and getObjectTextureName(createdObjectAfterSave) then local myshader = dxCreateShader("material/effect.fx") local mytexture = dxCreateTexture(v.texture, "dxt3") dxSetShaderValue( myshader,"gTexture", mytexture) engineApplyShaderToWorldTexture( myshader, getObjectTextureName(createdObjectAfterSave), createdObjectAfterSave) texture[createdObjectAfterSave] = v.texture end if area then Link to comment
Moderators IIYAMA Posted July 6, 2015 Moderators Share Posted July 6, 2015 Maybe your textures are too heavy? Try to save with "dxt5", dxt3 is an older version of dxt5. Still now chances? > Save large png's without alpha changes/levels, with png-8. And I strongly recommend to load a lot of textures with "onClientRender" in combination with getTickCount(). Because somehow the next frame has to wait before the function has been fully executed. This is an old bug from the gta san core. Example: local index = 1 local nextTextureLoadTime = 0 function loadingTexture () local timeNow = getTickCount() if timeNow > nextTextureLoadTime then nextTextureLoadTime = timeNow+30 local objects = zoneTable.objectsPositions local v = objects[index] if v then -- put your code here -- ------------------------ index = index+1 else removeEventHandler("onClientRender",root,loadingTexture) end end end addEventHandler("onClientRender",root,loadingTexture) So some slow pc's can now gets up with the replacement process and won't crash so fast. Link to comment
darhal Posted July 6, 2015 Author Share Posted July 6, 2015 Maybe your textures are too heavy?Try to save with "dxt5", dxt3 is an older version of dxt5. Still now chances? > Save large png's without alpha changes/levels, with png-8. And I strongly recommend to load a lot of textures with "onClientRender" in combination with getTickCount(). Because somehow the next frame has to wait before the function has been fully executed. This is an old bug from the gta san core. Example: local index = 1 local nextTextureLoadTime = 0 function loadingTexture () local timeNow = getTickCount() if timeNow > nextTextureLoadTime then nextTextureLoadTime = timeNow+30 local objects = zoneTable.objectsPositions local v = objects[index] if v then -- put your code here -- ------------------------ index = index+1 else removeEventHandler("onClientRender",root,loadingTexture) end end end addEventHandler("onClientRender",root,loadingTexture) So some slow pc's can now gets up with the replacement process and won't crash so fast. Well thanks I edited my code and it works fine and the game freeze is massive lag now but I didint understand this part Still now chances? > Save large png's without alpha changes/levels, with png-8. I use phooshop to edit textures is this function in photoshop ? Link to comment
darhal Posted July 7, 2015 Author Share Posted July 7, 2015 OMG OMG i found the problem : why the texture load create inside a loop of table that conaint more than 300 index ? the solution is to load all textures one time ! the lag reduced and the problem solved thx all Link to comment
Moderators IIYAMA Posted July 7, 2015 Moderators Share Posted July 7, 2015 Png-8 can be selected when you use the save for web methode. Png-8 is smaller, but is terible with alpha blending. Your game did also freeze using the onClientRender methode? Well you solved it, but I am still kinda interested. Link to comment
darhal Posted July 7, 2015 Author Share Posted July 7, 2015 No it do lag and fps drops to arround 1 or 2 FPS but the first code that i post result in fame freeze Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now