i have a cg shader that does a simple lighting, and the geometry i need to “lighten up” is a display list.
The geometry lighting is correctly displayed, but the object has no textures.
Perhaps, when generating the display list, i have to bind textures using the ARB extension instead of a simple glBindTexture function ?
That shouldn’t matter.
Are you using a fragment program? If so, you have to declare your texture sampler, use a texture read instruction, and multiply with the light contribution yourself. Don’t forget to set the uniform for the texture sampler to the index of the texture unit that contains the texture image you want, either.
Yes i’m using a fragment program. However, what are the benefits of using a lighting shader instead of conventional lighting ?
Speed, quality or else ?
If you’re using a shader, the “regular lighting” will be disabled, and the shader HAS to do it. It’s in the spec. It’s one of the bits of the pipe that’s subsumed by adding a shader. Similarly, you HAVE to do texturing. It’s another bit that’s subsumed. Thus, if your shader doesn’t calculate light and texture data, then your object won’t be rendered with lighting and texturing.
The advantage of using shaders is that you have better control over the lighting model and equation, and you can do things like per-pixel normal-mapped Phong, or spherical harmonics-based radiance transfer, or some other scheme you dream up. “better” or “different” really is in the eye of the beholder
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.