PDA

View Full Version : Question about zgl_primitives_2d



NickS
16-01-2011, 03:45 PM
Hey guys =) good work with this library I find it very useful.

I was wondering if there is a way to control the width of a zgl_primitives_2d.pr2d_Line, because it is only 1 pixel wide.

Thank you!

Andru
16-01-2011, 08:09 PM
Hi,


I was wondering if there is a way to control the width of a zgl_primitives_2d.pr2d_Line, because it is only 1 pixel wide.
The only way to do this is to use OpenGL function glLineWidth(and don't forget to call batch2d_Flush before calling this function). I didn't made this feature for ZenGL, because ZenGL also use Direct3D for graphics, and realization of this is too tricky in Direct3D...

So, you can declare glLineWidth somewhere in your units like this(constant libGL for different OS's you can take from zgl_opengl_all.pas):


procedure glLineWidth( width: Single ); stdcall; external liblGL;

And change line width by this code(somewhere in your Draw):


batch2d_Flush();
glLineWidth( NewWidth );


Oh, stdcall is only for Windows, so for Linux/MacOS X glLineWidth must be declared with cdecl calling convertion.

NickS
18-01-2011, 03:53 PM
Thank you for the quick answer. Works like a charm =] good work!