void BindStyle() const { const unsigned scaledWidth = Layout::PenWidthPixels(width); const unsigned glWidth=scaledWidth > OpenGL::max_linewidth ? OpenGL::max_linewidth : scaledWidth; // GL behavior seems to be undefined otherwise #if defined(HAVE_GLES) && !defined(HAVE_GLES2) glLineWidthx(glWidth << 16); #else glLineWidth(glWidth); #endif #ifndef HAVE_GLES if (style == DASH1) { /* XXX implement for OpenGL/ES (using a 1D texture?) */ glLineStipple(2, 0x1818); glEnable(GL_LINE_STIPPLE); } else if (style == DASH2) { /* XXX implement for OpenGL/ES (using a 1D texture?) */ glLineStipple(2, 0x1f1f); glEnable(GL_LINE_STIPPLE); } else if (style == DASH3) { /* XXX implement for OpenGL/ES (using a 1D texture?) */ glLineStipple(2, 0x8f8f); glEnable(GL_LINE_STIPPLE); } #endif }
/** * Configures this pen in the OpenGL context. */ void Set() const { color.Set(); #ifdef HAVE_GLES glLineWidthx(width << 16); #else glLineWidth(width); #endif }
void DrawOutlineRectangle(int left, int top, int right, int bottom, Color color) { color.Bind(); #if defined(HAVE_GLES) && !defined(HAVE_GLES2) glLineWidthx(1 << 16); #else glLineWidth(1); #endif OutlineRectangleGL(left, top, right, bottom); }
void DrawOutlineRectangle(PixelScalar left, PixelScalar top, PixelScalar right, PixelScalar bottom, Color color) { color.Set(); #ifdef HAVE_GLES glLineWidthx(1 << 16); #else glLineWidth(1); #endif OutlineRectangleGL(left, top, right, bottom); }
void DrawOutlineRectangle(int left, int top, int right, int bottom, Color color) { color.Bind(); const unsigned scaledWidth=Layout::PenWidthPixels(1); const unsigned glWidth=scaledWidth > OpenGL::max_linewidth ? OpenGL::max_linewidth : scaledWidth; // GL behavior seems to be undefined otherwise #if defined(HAVE_GLES) && !defined(HAVE_GLES2) glLineWidthx(glWidth << 16); #else glLineWidth(glWidth); #endif OutlineRectangleGL(left, top, right, bottom); }
void BindStyle() const { #if defined(HAVE_GLES) && !defined(HAVE_GLES2) glLineWidthx(width << 16); #else glLineWidth(width); #endif #ifndef HAVE_GLES if (style == DASH) { /* XXX implement for OpenGL/ES (using a 1D texture?) */ glLineStipple(2, 0x1f1f); glEnable(GL_LINE_STIPPLE); } #endif }
void Canvas::OutlineRectangleGL(int left, int top, int right, int bottom) { const GLexact penWidth = std::max(1U,pen.GetWidth()); if(penWidth <= 1) { // use line loop only for line with = 1, otherwise few pixel are missing on each corner. const ExactRasterPoint vertices[] = { RasterPoint{left, top}, RasterPoint{right-1, top}, RasterPoint{right-1, bottom-1}, RasterPoint{left, bottom-1}, }; const ScopeVertexPointer vp(vertices); glDrawArrays(GL_LINE_LOOP, 0, array_size(vertices)); } else { #if defined(HAVE_GLES) && !defined(HAVE_GLES2) glLineWidthx(1 << 16); #else glLineWidth(1); #endif const ExactRasterPoint vertices[] = { RasterPoint{left, top}, RasterPoint{left + penWidth, top + penWidth}, RasterPoint{right, top}, RasterPoint{right - penWidth, top + penWidth}, RasterPoint{right, bottom}, RasterPoint{right- penWidth, bottom - penWidth}, RasterPoint{left, bottom}, RasterPoint{left + penWidth, bottom - penWidth}, RasterPoint{left, top}, RasterPoint{left + penWidth, top + penWidth} }; const ScopeVertexPointer vp(vertices); glDrawArrays(GL_TRIANGLE_STRIP, 0, array_size(vertices)); } }
void glLineWidthxLogged(GLfixed width) { printf("glLineWidthx(%i)\n", width); glLineWidthx(width); }