macklebee Posted July 16, 2014 Share Posted July 16, 2014 I am trying to grab the various components from the default buffer that is created but for some reason those components come back 'nil'. When I create my own buffer, the commands seem to work. What am I missing to be able to grab the default buffer's components? function App:Start() self.window = Window:Create() self.context = Context:Create(self.window) local width = self.context:GetWidth() local height = self.context:GetHeight() self.world = World:Create() self.cam = Camera:Create() self.buffer = Buffer:GetCurrent() if self.buffer==nil then System:Print("buffer is nil") end if self.buffer:GetDepthTexture()==nil then System:Print("depth is nil") end if self.buffer:GetColorTexture(0)==nil then System:Print("color0 is nil") end if self.buffer:GetColorTexture(1)==nil then System:Print("color1 is nil") end if self.buffer:GetColorTexture(2)==nil then System:Print("color2 is nil") end local buffer = Buffer:Create(width, height, 1+2,1) Buffer:SetCurrent(buffer) local mybuffer = Buffer:GetCurrent() if mybuffer==nil then System:Print("my buffer is nil") end if mybuffer:GetDepthTexture()==nil then System:Print("my depth is nil") end if mybuffer:GetColorTexture(0)==nil then System:Print("my color0 is nil") end if mybuffer:GetColorTexture(1)==nil then System:Print("my color1 is nil") end if mybuffer:GetColorTexture(2)==nil then System:Print("my color2 is nil") end Buffer:SetCurrent(self.buffer) return true end function App:Loop() if self.window:Closed() or self.window:KeyHit(Key.Escape) then return false end Time:Update() self.world:Update() self.world:Render() self.context:SetBlendMode(Blend.Alpha) self.context:DrawText("FPS: "..Time:UPS(),20,20) self.context:Sync() return true end 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 16, 2014 Share Posted July 16, 2014 Good question. Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
Ma-Shell Posted July 16, 2014 Share Posted July 16, 2014 Try using the context instead of Buffer:GetCurrent(). As far, as I remember, Context is inherited from Buffer (at least in C++) and your current buffer should usually be the context (as far, as you don't change it). It might be, that the current buffer only gets set somewhere in between App:Start() und App:Loop(). Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 17, 2014 Author Share Posted July 17, 2014 If the default isn't getting created until the App:Loop() I would say something is wrong since I can create my own buffer and immediately access it in the App:Start() as shown above. In any case, checking for those components in the Start or Loop still returns nil as well as checking for those components via the context. I suspect this is a question that Josh will need to chime in on as he is the only one that knows for sure what is going on in the background since the documentation does not exist. 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...
Rick Posted July 17, 2014 Share Posted July 17, 2014 In C++ the following returns NULL also. Texture* t = Buffer::GetCurrent()->GetDepthTexture(); The buffer comes back as valid but not any textures just like in Lua. Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 17, 2014 Author Share Posted July 17, 2014 Well at least lua is showing the same results - which it should since its built off of the c++ implementation. Thanks for checking. What would be ideal is for Josh to give us maybe a direct variable like we had in LE2 like 'gbuffer'. I suspect that maybe the GetCurrent() is grabbing the BackBuffer? 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...
macklebee Posted July 17, 2014 Author Share Posted July 17, 2014 This reminds me of something... i think i am having deja vu... http://www.leadwerks.com/werkspace/topic/4503-framework-buffers-unavailable-in-lua/ 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...
macklebee Posted July 17, 2014 Author Share Posted July 17, 2014 Ok - well the good news is that there has been an answer to this; the bad news is that apparently there isn't a default buffer per say... even though Buffer:GetCurrent() above is grabbing something and the docs mention buffers in several places with one actual script function having a buffer parameter. But in any case, unless you make your own buffer, there is only a context which is bound to a window for renderable space. And the context can only be written to without a possibility to actually grab from - at least as far as depth/color components go. So big changes from LE2 vs now in LE3. So no grabbing the depth or color or normal.of a main render window. And off hand there doesn't appear to be a way to grab the normal component of a buffer like we used to do in LE2- still waiting for an answer to that one actually 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...
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.