-
Notifications
You must be signed in to change notification settings - Fork 15
[Feature] according to es2.0 spec, you must use clamp-to-edge as tex… #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it.
…or non-power-of-two texture
|
|
||
| CC_BACKEND_BEGIN | ||
|
|
||
| #define ISPOW2(n) (((n)&(n-1)) == 0) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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__); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it.
…ture wrap mode, and no mipmapping for non-power-of-two texture