Chris Paulson Posted December 2, 2009 Share Posted December 2, 2009 My function: - void tdDraw( TCamera cam, TVec3 s, TVec3 e ) { TVec3 p1; TVec3 p2; p1 = CameraUnproject( cam, s ); p2 = CameraUnproject( cam, e ); if (p1.Z < 0 || p2.Z < 0) return; DrawLine( p1.X, p1.Y, p2.X-p1.X, p2.Y-p1.Y ); } Seems not to work correctly anymore, one end of the line seems to be in the correct place but the other is always top left. Has it changed? Quote Link to comment Share on other sites More sharing options...
TylerH Posted December 2, 2009 Share Posted December 2, 2009 Yes, it now takes the absolute coordinates X1 Y1 and X2 Y2, each pair is its own endpoint. Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
Josh Posted December 2, 2009 Share Posted December 2, 2009 It's the same in 2.28. 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...
Canardia Posted December 2, 2009 Share Posted December 2, 2009 If you are using C++, you might consider using gamelib's Line function instead, as it's about 10 times faster than LE's DrawLine: inline void Color(double r, double g, double b, double a) { glColor4f(r,g,b,a); } inline void Line(int x, int y, int w, int h) { glBegin(GL_LINES); glVertex2i(x,y); if(0==w)w=1; glVertex2i(x+w,y+h); glEnd(); } 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...
Chris Paulson Posted December 2, 2009 Author Share Posted December 2, 2009 Yes, it now takes the absolute coordinates X1 Y1 and X2 Y2, each pair is its own endpoint. Thanks that did the trick. Thnaks Lumooja, I'll convert over. Quote Link to comment Share on other sites More sharing options...
Josh Posted December 2, 2009 Share Posted December 2, 2009 The speed of drawing a line is not a bottleneck. The command you wrote is the same thing the engine does internally. 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...
Canardia Posted December 2, 2009 Share Posted December 2, 2009 Yeah, it's just a simple direct mode OpenGL command after all, but when it's called often, like in speed tests, the fact that the DLL call has to go through many more instructions (BlitzMax GC, C headers) than a C++ inline function (which is stored directly into the loop, not even calling the function internally (thus avoiding the stack, which is slow)), sums up in the speed difference. Sure it's not a bottleneck, as nobody would call thousands of DrawLines per frame 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.