macklebee Posted July 5, 2014 Share Posted July 5, 2014 Looking over some postprocessing code that I believe shadmar did, it appears there are some Buffer commands exposed in lua but there is no documentation on this. Would like to have access to all the available commands and documentation for each please. I assume in the very least LE3 would have the same commands or similar as what was in LE2: http://www.leadwerks.com/wiki/index.php/Buffers 1 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
shadmar Posted July 6, 2014 Share Posted July 6, 2014 The lua exposed ones are these with //lua at the end. But no docs. virtual void SetMask(const bool red, const bool green, const bool blue, const bool alpha)=0;//lua virtual void SetColor(const Vec4& color);//lua virtual void SetColor(const float r, const float g, const float B);//lua virtual void SetColor(const float r, const float g, const float b, const float a);//lua virtual std::string GetClassName(); virtual void GetPixels(const char* buf, const int component)=0; virtual int CountColorTextures();//lua virtual void Clear(const int mode=Depth|Color)=0;//lua virtual void Enable();//lua virtual void Disable();//lua virtual int GetWidth()=0;//lua virtual int GetHeight()=0;//lua virtual bool SetColorTexture(Texture* texture, const int i=0, const int cubeface=0)=0;//lua virtual bool SetDepthTexture(Texture* texture, const int cubeface=0)=0;//lua virtual Texture* GetColorTexture(const int index=0);//lua virtual Texture* GetDepthTexture();//lua //virtual Clear(const int flags)=0; virtual void Blit(Buffer* dst, const int components)=0;//lua static const int Depth;//lua static const int Color;//lua static const int Color0;//lua static const int Color1;//lua static const int Color2;//lua static const int Color3;//lua static const int Color4;//lua static const int Color5;//lua static const int Color6;//lua static const int Color7;//lua static std::list<Buffer*> list; static void SetCurrent(Buffer* buffer);//lua static Buffer* GetCurrent();//lua static Buffer* Create(const int width, const int height, const int colorcomponents=1, const int depthbuffer=1, const int multisamplemode=0);//lua 4 Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
macklebee Posted July 6, 2014 Author Share Posted July 6, 2014 excellent shadmar! much appreciated. Now it just becomes the waiting game for documentation Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Lunarovich Posted June 30, 2015 Share Posted June 30, 2015 I vote for this one. We definitely need buffer docs! Quote Link to comment Share on other sites More sharing options...
Lunarovich Posted August 15, 2015 Share Posted August 15, 2015 A quick question: does LE Buffer class refers to/wraps this OpenGL object (Renderbuffer object). Thanx. Quote Link to comment Share on other sites More sharing options...
Josh Posted August 16, 2015 Share Posted August 16, 2015 Leadwerks buffers are basically OpenGL FBOs. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Lunarovich Posted August 16, 2015 Share Posted August 16, 2015 Thanks. Just for the reference, here is the offical doc on FBOs. While we're at it, I find the use of FBOs one of the top features of LE. Is the absence of official docs the sign that the feature or its interface might change, or is it just a question of priorities? Quote Link to comment Share on other sites More sharing options...
Josh Posted August 16, 2015 Share Posted August 16, 2015 The post-process stack and render target setting eliminate the need for any direct use of Leadwerks buffers. Buffers are a low-level class that don't really need to be accessed directly. In Leadwerks 2, originally this was the only way to apply a post-processing effect, but no one knew how to use it, so the "Framework" class was created, which was a hack. In Leadwerks 3, the post-processing stack provides more flexibility and ease of use. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Lunarovich Posted August 17, 2015 Share Posted August 17, 2015 Well, I understand and approve the idea to go for the simplicity and the most common use cases (the post-processing, here). However, I like LE precisely because it manages to couple simplicity with generality. A vertex manipulation (normals, uvs), for example, gives us a low level access to the mesh and empowers us to do wonderful things with a procedural geometry. And yet, it's very simple to use. Likewise, I use buffers for procedural textures. I generate a texture directly in a custom shader (insted of using Context's Plot function) and render it to the buffer. For example: -- Save the ref to the current shader & buffer. local context = Context:GetCurrent() local defaultShader = context:GetShader() local defaultBuffer = Buffer:GetCurrent() -- Specify a TEXTURE size. local textureSize = 128 -- Although we can use Context::Plot, -- we rather use the custom SHADER to draw a texture in the GPU. local customShader = Shader:Load("Scripts/Custom/drawimage.shader") -- Create a custom BUFFER to draw a texture to. -- static Buffer* Create(const int width, const int height, const int colorcomponents=1, -- const int depthbuffer=1, const int multisamplemode=0);//lua local customBuffer = Buffer:Create(textureSize, textureSize, 1, 1) Buffer:SetCurrent(customBuffer) -- must be called after Buffer:SetCurrent() context:SetShader(customShader) -- DRAW the texture and store it in the local variable. --context:SetBlendMode(Blend.Alpha) local texture = customBuffer:GetColorTexture(0) context:DrawImage(texture, 0, 0) -- Restore previous buffer and shader. Buffer:SetCurrent(defaultBuffer) context:SetShader(defaultShader) I would be very disappointed to see the possibility to do something like this removed, only because the use of buffers was meant as a hack to enable post-processing. For me, the possiblity to directly manipulate buffers is as essential as a possiblity to directly manipulate vertices. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.