小编The*_*Way的帖子

OpenGL ES着色器和64位iPhone 5S

我刚开始在OpenGL ES应用程序上使用iPhone 5S和64位架构进行测试.我看到的问题是(CGFloat)值到达着色器时出错了.我传入0.8并在调试着色器时更改为-1.58819e-23.我正在使用glUniform4fv()来传递值.我需要使用不同的数据类型吗?或者传递价值的另一种方法?当我在32位上测试时,该值很好

CGFloat brushColor[4];

brushColor[0] = 0.8;
brushColor[1] = 0.1;
brushColor[2] = 0.1;
brushColor[3] = 0.3;

glUniform4fv(program[PROGRAM_POINT].uniform[UNIFORM_VERTEX_COLOR], 1, brushColor);
Run Code Online (Sandbox Code Playgroud)

(有些人可能会注意到这是来自GLPaint演示......)

谢谢,

奥斯汀

iphone 64-bit shader opengl-es ios

7
推荐指数
1
解决办法
1625
查看次数

为什么Android以错误的顺序寻找QVGA资源mdpi> hdpi> ldpi?

我正在尝试使用QVGA仿真器进行一些测试,我发现它以上述顺序查找图像资源.

drawable-mdpi 1st
drawable-hdpi 2nd
drawable-ldpi 3rd
(只有在我改变其他两个目录中的图像名称进行测试后才能找到它)

我希望它首先是ldpi.

当运行其他仿真器(HVGA和WVGA)时,他们使用适当的可绘制dirs ......它只是QVGA.我看到的唯一代码可能会影响到这一点(基于文档)

我用2.0模拟器和1.6测试了这个,我得到了相同的结果.

有任何想法吗?非常感谢你.

resources android resolution

5
推荐指数
1
解决办法
1225
查看次数

为什么约束不适用于UIView但适用于UILabel?

我这里有一个简单(完整)的例子,看起来很奇怪,但我肯定只是错过了一些小东西......对吧?你能帮忙调试下面的简单代码吗?这段代码使aView消失,但是如果我将aLabel放在aView所在的约束中,那么它就完美了.为什么?感谢您的任何意见,这对我来说似乎很疯狂.

奥斯汀

UIView *aView = [[UIView alloc] initWithFrame:CGRectMake(0, 100, 100, 30)];
aView.backgroundColor = [UIColor redColor];
aView.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:aView];

UILabel *aLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 100, 100, 30)];
aLabel.backgroundColor = [UIColor redColor];
aLabel.text = @"Label";
aLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:aLabel];

NSLayoutConstraint *myConstraint =[NSLayoutConstraint
                                   constraintWithItem:aView
                                   attribute:NSLayoutAttributeCenterY
                                   relatedBy:NSLayoutRelationEqual
                                   toItem:self.view
                                   attribute:NSLayoutAttributeCenterY
                                   multiplier:1.0
                                   constant:0];

[self.view addConstraint:myConstraint];

myConstraint =[NSLayoutConstraint
               constraintWithItem:aView
               attribute:NSLayoutAttributeCenterX
               relatedBy:NSLayoutRelationEqual
               toItem:self.view
               attribute:NSLayoutAttributeCenterX
               multiplier:1.0
               constant:0];

[self.view addConstraint:myConstraint];
Run Code Online (Sandbox Code Playgroud)

iphone constraints ios

2
推荐指数
2
解决办法
1162
查看次数

标签 统计

ios ×2

iphone ×2

64-bit ×1

android ×1

constraints ×1

opengl-es ×1

resolution ×1

resources ×1

shader ×1