i’m using lwjgl for a game, and i’m gonna put all the textures into one big giant textures so i can render it all with 1 vertex array. the problem, though, is that i can’t use GL_repeat. So, how do i divide a triangle into smaller triangles that’ll fit. then i’ve got to do the same thing with the texcoords.
Why can’t you use GL_REPEAT? Is the only reason you need to split triangles so you can get the effect of a repeated texture?
And why do you want to render it all with one vertex array?
Cas
If I was in your shoes, I’d want to know for sure that the benefits of fewer texture binds outweighed the work of splitting up your geometry. I’d be very surprised if the benefit was significant enough to merit the programming time needed.
Texture binding isn’t the great expense it once was either… GL drivers these days are super pipelined command queues. You set up tons of little batches of stuff asychronously on the CPU, and the GPU starts slurping the commands off the queue before you’ve even finished. If you’re lucky you can keep them both busy but anything made in the last 3-4 years you’ll have to try pretty hard with an indie effort to max either of them out…
Cas
uh… hahaha you haven’t seen the computers at my high school. also, i figure itl, help with lighting when i get into shaders. i’m gonna create a type of light that uses part of a texture as the light color. quite useful for making projections. and, i figure that rendering with 1 vertex array is simpler for me than using a separate vertex array for each texture.
It’s simply not simpler.
Stop wasting your time, and do it the easy way, make it work first.
Premature optimization is the square root of all evil.
Fixed that up for you, should run a lot faster now.
At least that’s what this awesome article about software rendering in C from the late 90s told me, and if it works in C, it must work even better in Java, since Java’s so slow! I herd that the guy that made Doom invented it.