I started out trying to come up with a 1D Texture for coloring triangles in Google Earth however XMLLint kept telling me that sampler1D was not allowed as a child element within the library_effects node. Since all the examples I could find were for 2D textures I decided to try that and created a 256x128 pixel JPEG with vertical bands of color. My experience with OpenGL made me expect ST texture coordinates in the range of 0 to 1 but the examples (SketchUp) showed some rather strange values. GE showed my triangles but ignored my textures. Can someone explain how to calculate the texture coordinates for Collada?
1D texturing should look just like 2D texturing except that you use a sampler1D instead of a sampler2D, and your texture coordinates should have only a single component ‘S’.
I started out trying to come up with a 1D Texture for coloring triangles in Google Earth however XMLLint kept telling me that sampler1D was not allowed as a child element within the library_effects node.
Right, it isn’t. The Collada spec release notes has a pretty complete texturing example toward the end.
To get a good example of texturing in Collada, you should output a textured model from Sketchup. That model should load into GE fine, with textures. If that doesn’t work there’s either something fundamentally wrong with SketchUp/GE, or you’re not setting up the textures right in SketchUp (I don’t think there was any “trick” to it). When I tested this (over a year ago now) it worked fine, and it’s hard for me to imagine they broke something so basic.
The problem turns out not to be with the texture coordinates but is somewhere else. I swapped my coordinates and texture with a SketchUp created model and everything worked. Now I just need to figure out what I’m doing wrong.