dkopf.blogg.se

Glenableclientstate opengl es 2.0
Glenableclientstate opengl es 2.0








glenableclientstate opengl es 2.0

I found fltk-cairo convenient to build so I actually took Cairo, the popular 2D rendering API on Linux, as a benchmark. It is not perfect though, the end points are not sharp enough, and so I say "nearly perfect".

glenableclientstate opengl es 2.0

I did it by experiment and hand calibrated the drawing code:

glenableclientstate opengl es 2.0

Using triangles to approximate line segments in the correct dimension is not easy. The above picture shows lines with thickness starting from 0.3 pixels and increasing by 0.3 pixel. In particular, Maxim Shemanarev (responsible for Anti-Grain Geometry) is the boss in fine grained 2D rendering. This article focuses on 2D line drawing so the meaning of "perfect quality" is with respect to 2D graphics. This gives us the effect of anti-aliasing. Let's call this the 'fade polygon technique': draw a thin quadrilateral to render the core part of a line, then draw two more beside the original one that fade in color. GlColorPointer( 3, GL_FLOAT, 0, para_color) GlVertexPointer( 2, GL_FLOAT, 0, para_vertex) If you copy only part of the code, make sure you also copy the function. You can just include the header vase_rend_draft_2.h and it should work. I provide this in case you do not need all the functionalities. You can optionally use alpha blend otherwise, it assumes the background is white. The second function hair_line() draws near-perfectly a black "hair line" of thickness 1px with no color or thickness control. The below image should tell you what alphablend=false means: In no- alpha- blending mode, you still get good results when the background is solid and lines are not dense.

glenableclientstate opengl es 2.0

You can choose not to use alpha blending by setting alphablend to false in this case, you will get color fading to the background. The first function line() gives you all the functionality. Void hair_line( double x1, double y1, double x2, double y2, bool alphablend= 0) Br=alpha of color when alphablend=trueīool alphablend) //use alpha blend or not Void line( double x1, double y1, double x2, double y2, //coordinates of the lineįloat w, //width/thickness of the line in pixelįloat Cr, float Cg, float Cb, //RGB color componentsįloat Br, float Bg, float Bb, //color of background when alphablend=false,










Glenableclientstate opengl es 2.0