我正在实施一个着色器来做一些定向灯.我正在关注Lighthouse 3d的教程(http://www.lighthouse3d.com/tutorials/glsl-core-tutorial/directional-lights-per-pixel/)
我遇到的问题是以下几行:
vec3 h = normalize(l_dir + e);
float intSpec = max(dot(h, n), 0.0);
float specularPower = pow(intSpec, shininess);
Run Code Online (Sandbox Code Playgroud)
如果我留下"float specularPower"行 - 那么着色器不再"工作"....我在引号中说"工作",因为我没有从着色器日志中获得输出或错误,但是,现在统一的位置为我的全部返回-1,我无法设置我的纹理位置等.
如果我将其删除,则着色器的其余部分按预期工作(但由于缺少镜面反射功率而产生不正确的结果).
更奇怪的是,如果我附加了nVidia Nsight调试器,那么我在屏幕上得到输出它似乎"工作",但如果我只是在调试模式下使用VS2012我屏幕上没有显示任何内容,并出现以下错误信息:
First-chance exception at 0x000000005EB066E6 (nvoglv64.dll) in application.exe: 0xC0000005: Access violation reading location 0x0000000000000008.
First-chance exception at 0x000000005EB066E6 (nvoglv64.dll) in application.exe: 0xC0000005: Access violation reading location 0x0000000000000008.
Run Code Online (Sandbox Code Playgroud)
在运行Windows 8 64位的PC上,GTX 480和GTX 560都可以看到这种现象.
我知道-1作为Uniform位置返回意味着名称错误,或者编译器已将其优化掉,但是添加一行是没有意义的,之后根本不会使用其结果.当连接或不连接NSight调试器时,行为是不同的
我可能做错了什么?
编辑:
下面是我可以创建的最简单的顶点/片段着色器,它可以复制问题,同时仍然是一个"真实世界"的着色器.
顶点着色器:
// Default Vertex Shader
#version 430 core
uniform mat4 projMatrix;
uniform mat4 modelMatrix;
uniform mat4 …Run Code Online (Sandbox Code Playgroud) 我最近实现了Spring Data REST(http://www.springsource.org/spring-data/rest),以便通过REST接口自动公开CRUD功能.
GET和POST都按预期工作,但是在使用PUT动词时我得到405方法不允许.
根据文件
Verb Method
GET CrudRepository<ID,T>.findOne(ID id)
POST CrudRepository<ID,T>.save(T entity)
PUT CrudRepository<ID,T>.save(T entity)
DELETE CrudRepository<ID,T>.delete(ID id)
Run Code Online (Sandbox Code Playgroud)
默认情况下,所有这些方法都将导出到客户端.我已经阅读了这里的文档(http://static.springsource.org/spring-data/rest/docs/1.1.0.M1/reference/htmlsingle/),但似乎无法找到这种行为的原因.
任何人都可以建议我可能出错的地方?我提供了一个RepositoryRestMvcConfiguration类,它定义了我所有Entity类的资源映射.