Skip to content

Conversation

@Mee-gu
Copy link

@Mee-gu Mee-gu commented Nov 21, 2018

…ture wrap mode, and no mipmapping for non-power-of-two texture

…ure wrap mode, and no mipmapping for non-power-of-two texture
SamplerFilter minFilter = SamplerFilter::LINEAR;
SamplerFilter mipmapFilter = SamplerFilter::LINEAR;
SamplerAddressMode sAddressMode = SamplerAddressMode::REPEAT;
SamplerAddressMode tAddressMode = SamplerAddressMode::REPEAT;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is ok to change default value, but we should do some protection of the usage in Texture.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it.


CC_BACKEND_BEGIN

#define ISPOW2(n) (((n)&(n-1)) == 0)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to define it in .cpp file.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

GLint ret = GL_REPEAT;
GLint ret = GL_CLAMP_TO_EDGE;
if(!bPow2)
return ret;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to output a log to say that the address mode is changed to GL_GLAMP_TO_EDGE.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

{
if(!bPow2)
{
cocos2d::log("Disable mipmap since non-power-of-two texture occur in %s %s %d", __FILE__, __FUNCTION__, __LINE__);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to say that what filter is used instead.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

glGenTextures(1, &_texture);
toGLTypes();

bool bPow2 = ISPOW2(_width) && ISPOW2(_height);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use Hungary style, so it is better to change to isPow2.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it.

@minggo minggo merged commit bca45ae into minggo:metal-support Nov 22, 2018
@Mee-gu Mee-gu deleted the feature/backendSprite branch November 22, 2018 03:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants