Coder Social home page Coder Social logo

void DrawNode::setLineWidth(float lineWidth) supports only thickness between 1...7 (and setLineWidth(x) draws a "linewidth x-1" about axmol HOT 12 CLOSED

axmolengine avatar axmolengine commented on September 16, 2024
void DrawNode::setLineWidth(float lineWidth) supports only thickness between 1...7 (and setLineWidth(x) draws a "linewidth x-1"

from axmol.

Comments (12)

aismann avatar aismann commented on September 16, 2024

...add least on debug modus but im not sure this is a windows only (angle) problem.

a tester snippet like this hepls to show the line thickness is growing:
int startX = 0;
for (size_t i = 0; i < 12; i++)
{
startX = i*10;
auto lineDrawNode = DrawNode::create();
this->addChild(lineDrawNode, 10);
lineDrawNode->setLineWidth(i);
lineDrawNode->drawLine(Vec2(startX, 100 ), Vec2(startX + 10, 100), Color4F::ORANGE);
}

on windows is grows only between x=0...8 => line width==x-1 (and 0 ==1)

from axmol.

halx99 avatar halx99 commented on September 16, 2024

Switch to OpenGL can check this different behavior

from axmol.

aismann avatar aismann commented on September 16, 2024

Switch to OpenGL can check this different behavior

How?

from axmol.

halx99 avatar halx99 commented on September 16, 2024

Modify the macro CC_USE_GLES_ON_DESKTOP to 0 at cocos/platform/CCPlatformConfig.h

from axmol.

aismann avatar aismann commented on September 16, 2024

#define CC_USE_GLES_ON_DESKTOP 1 => it has no thickness.
#define CC_USE_GLES_ON_DESKTOP 0 => shows the behavior as I has written above

from axmol.

halx99 avatar halx99 commented on September 16, 2024

Does the official v3 works well?

from axmol.

aismann avatar aismann commented on September 16, 2024

3.17.2 on windows shows the behavior as I has written above (only 0 is different=> 0 ==7pixel)

from axmol.

halx99 avatar halx99 commented on September 16, 2024

the line width at least 1px, see:

void CommandBufferGL::setLineWidth(float lineWidth)
{
    if(lineWidth > 0.0f)
        glLineWidth(lineWidth);
    else
        glLineWidth(1.0f);
    
}

from axmol.

aismann avatar aismann commented on September 16, 2024

Yes, that's correct it is on line 606 on CommandBufferGL.cpp.
That's the reason why a setLineWidth(0) has a thickness of 1 on engine-x
On 3.17.2 isn't this line anywhere.

from axmol.

aismann avatar aismann commented on September 16, 2024

I have found the reason of supported thickness 1-7 points:

GLint range[2];
glGetIntegerv(GL_ALIASED_LINE_WIDTH_RANGE, range);

returning 1,7
so it is clear that's my system only drawing a thickness between 1-7

Maybe it should be part of the documentation:

It is a good idea to add an info output on CCConfiguration.cpp too.

from axmol.

aismann avatar aismann commented on September 16, 2024

Here are more info for the documentation:
On my system (another system maybe having another min/max) :
CC_USE_GLES_ON_DESKTOP 1 has a supported min/max width of 1/1
CC_USE_GLES_ON_DESKTOP 0 has n supported min/max width of 1/7

from axmol.

halx99 avatar halx99 commented on September 16, 2024

seems google's angle renderer doesn't support non-1 line width.

from axmol.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.