Rick Posted October 15, 2010 Share Posted October 15, 2010 I'm trying to use the framework, so I can get the lua stuff, but use my own buffer and drawing. All I get is a black screen. So I init the framework just like normal, I create my own buffer, and in the loop I call UpdateFramework() but in the drawing part I have: TBuffer buffer = CreateBuffer(1024, 768, BUFFER_COLOR0 | BUFFER_DEPTH | BUFFER_NORMAL); //RenderFramework(); SetBuffer(buffer); RenderWorld(); SetBuffer(BackBuffer()); RenderLights(buffer); // Send to screen Flip(0); This produces a black screen and I can't figure out why. Everything is created in the main framework world and that's what would be set as the current world before RenderWorld() is called so that should render the world to my custom buffer. Then I follow the normal steps for non framework to get the lights drawn on that buffer. Why would this produce a black screen? Quote Link to comment Share on other sites More sharing options...
Canardia Posted October 16, 2010 Share Posted October 16, 2010 CreateBuffer() must be before the main loop, and you should have UpdateFramework() in the loop also. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Rick Posted October 16, 2010 Author Share Posted October 16, 2010 Sorry, I have both of those and it's not working. Quote Link to comment Share on other sites More sharing options...
Canardia Posted October 16, 2010 Share Posted October 16, 2010 You also need to call RenderFramework() once before the main loop, because it initializes a lot of stuff. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Rick Posted October 16, 2010 Author Share Posted October 16, 2010 Did that didn't work. Have you tried this before and got it working? If so I'd be interested in seeing what you have. Quote Link to comment Share on other sites More sharing options...
Canardia Posted October 16, 2010 Share Posted October 16, 2010 Yeah, I use it all the time for rending mirrors, maps and radars and other simple small buffers. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Rick Posted October 16, 2010 Author Share Posted October 16, 2010 Any chance I can see some example code? I must be missing something. Quote Link to comment Share on other sites More sharing options...
Canardia Posted October 16, 2010 Share Posted October 16, 2010 require "scripts/constants/engine_const.lua" RegisterAbstractPath(".") Graphics(800,600) fw = CreateFramework() camera =fw.main.camera camera:SetPosition(Vec3(0,20,-20)) light = CreateDirectionalLight() light:SetRotation(Vec3(45,45,0)) camRotation=Vec3(0,0,0) MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2) HideMouse(1) prevPos = Vec3(0) cube = {} cube1 = {} cube2 = {} gx=0 gy=0 cub=CreateCube() for a = 0, 50, 1 do for b = 0, 100, 1 do cube[b] = CopyEntity(cub) cube[b]:SetPosition(Vec3(prevPos.x + 1,prevPos.y + 1,prevPos.z)) prevPos = cube[b]:GetPosition() end prevPos = Vec3(0,0,prevPos.z + 2) end prevPos = Vec3(0) for a = 0, 50, 1 do for b = 0, 100, 1 do cube[b] = CopyEntity(cub) cube[b]:SetPosition(Vec3(prevPos.x - 1,prevPos.y + 1,prevPos.z)) prevPos = cube[b]:GetPosition() end prevPos = Vec3(0,0,prevPos.z + 2) end CameraClearMode(camera,-1) minibuffer=CreateBuffer(256,256,BUFFER_COLOR+BUFFER_NORMAL+BUFFER_DEPTH) thisbuffer=GetBuffer() while KeyHit(KEY_ESCAPE)==0 do --Camera look gx=Curve(MouseX()- GraphicsWidth()/2,gx,10) gy=Curve(MouseY()- GraphicsHeight()/2,gy,10) MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2) camRotation.x = camRotation.x+gy /10 camRotation.y = camRotation.y-gx /10 camera:SetRotation(camRotation,1) --keys move = Curve(KeyDown(KEY_W)-KeyDown(KEY_S),move,10) strafe = Curve(KeyDown(KEY_D)-KeyDown(KEY_A),strafe,10) camera:Move(Vec3(strafe ,0,move)) fw:Update() thisbuffer=GetBuffer() SetBuffer(minibuffer) camera:Turnf(0,180,0) RenderWorld(); RenderLights(minibuffer); camera:Turnf(0,180,0) SetBuffer(thisbuffer) fw:Render() SetBlend(1); SetColor(Vec4(0,1,0,0.5)); DrawImage(GetColorBuffer(minibuffer,0),0,300,256,-256) SetBlend(0); Flip(0) end Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ 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.