Tag: 布尔

使用GPUImage在OpenGL ES着色器中使用bool返回types

我正在使用GPUImage框架在iOS项目上工作。 我无法让我的着色器编译。 在我的片段着色器中有一个函数: const vec2 boundMin = vec2(0.0, 0.0); const vec2 boundMax = vec2(1.0, 1.0); bool inBounds (vec2 p) { return all(lessThan(boundMin, p)) && all(lessThan(p, boundMax)); } 着色器编译日志: ERROR: 0:1: '_Bool' : syntax error syntax error 当我replace所有的function inBounds(vec2 p) 同 all(lessThan(boundMin, p)) && all(lessThan(p, boundMax)) 它很好用! 问题: OpenGL ES 2.0 Fragment Shader是否支持boolfunction? 如果是这样,我哪里错了? 如果没有,为什么有像all() , […]

设置数组中所有对象的布尔属性

我有一个名为PhotoItem的模型类。 其中我有一个BOOL属性isSelected @interface PhotoItem : NSObject /*! * Indicates whether the photo is selected or not */ @property (nonatomic, assign) BOOL isSelected; @end 我有一个NSMutableArray它拥有这个特定模型的对象。 我想要做的是,在特定的事件中,我想将数组中的所有对象的布尔值设置为true或false。 我可以通过迭代数组并设置值来实现这一点。 而不是我尝试使用: [_photoItemArray makeObjectsPerformSelector:@selector(setIsSelected:) withObject:[NSNumber numberWithBool:true]]; 但我知道这是行不通的,事实并非如此。 另外我不能传递true或false作为参数(因为那些不是对象types)。 所以为了解决这个问题,我实现了一个自定义的公共方法,如: /*! * Used for setting the photo selection status * @param selection : Indicates the selection status */ – (void)setItemSelection:(NSNumber *)selection […]