Seamlessly texture a cylinder with OpenGL and LWJGL

Alzar

New Member
I am working on creating a procedural city, complete with randomly generated buildings and textures. I am generating cylinder-ish buildings correctly, and generating a procedural texture pattern for windows, but when I map the texture onto the cylinder it doesn't come out how I think it should.
5HFx1.png
The picture shows my three problems.Firstly, my cylinder code will randomly skip 90 degrees to create slices out of the cylinder that look nice, and when two of these happen the second one has the stretches texture that you see here. The first slice looks perfectly fine. That is number 2 on the image.The second problem--numbered 1--is that for some reason it appears to take a large section of the texture and map it onto a small slice at the end of the cylinder, and this happens every time.The third problem is slightly harder to notice, although it is easiest to see on number 1, if you look at the top, the texture is much wider than is it at the bottom, and I don't know why.I've pondered over this problem for a while, and I would appreciate any help.Here is my source code for creating and texturing the cylinder: http://pastebin.com/hgMhqScgFor the sake of being complete, here is the code that generates the textures and the code that stores and renders the actual vertices: http://pastebin.com/cUuEBmTr http://pastebin.com/GrytFsf1If you'd ignore any bad code, I'd appreciate it. The project isn't even close to finished.~Elec0
 
Back
Top