Jump to content
  • Advertisement
Sign in to follow this  
shezad

GLSL automatic texture coordinated for cube

This topic is 2129 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

I am rendering in glsl a lot of cubes and I want to apply a texture on them, the easy way would be to send the texture coordinates
but how can I do it if I want to generate them in shader taking in consideration that the shape is known and for this reason I can save
from sending always the same stuff repeatedly?


Thanks

Share this post


Link to post
Share on other sites
Advertisement
You might be interested by triplanar texturing. Using the local position and orientation of the vertices you can compute texture coordinates for arbitrary oriented/sized cubes. If you can use geometry shaders, you could also consider using them to generate the whole geometry of your cube. Edited by Yno

Share this post


Link to post
Share on other sites
You can use GL_EXT_draw_instanced extension for that. Just send matrices (transforms of your cubes) to shader and a number of instance objects you need to render.

Best wishes, FXACE. Edited by FXACE

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!