Jump to content

Tiling Texture (and understanding GLSL)


Spacechimp
 Share

Recommended Posts

Hello. I am just starting to look at HLSL and Leadwerks materials. My understanding is very rudimentary.

 

 

I am trying to get a diffuse texture to "tile" (repeat, etc) on the surfaces of a cube.

 

In rendermonkey I was able to achieve that with the following .vert and .frag files.

 

 

.frag

uniform sampler2D baseMap;

varying vec2 Texcoord;

vec2 mytexcoord = vec2(16.0,16.0);

void main( void )
{

   gl_FragColor = texture2D( baseMap , Texcoord * mytexcoord );

}

 

.vert

varying vec2 Texcoord;

void main( void )
{
   gl_Position = ftransform();
   Texcoord    = gl_MultiTexCoord0.xy;

}

 

It seems as if multiplying the gl_MultiTexCoord0.xy via:

gl_FragColor = texture2D( baseMap , Texcoord * mytexcoord );

is the way to make it tile over a surface.

 

 

 

I am assuming that if I multiply the Texcoord variable in leadwerks "mesh.frag", I will get the tiling effect I am looking for. Using mesh.vert and mesh.frag as includes, how do I manage to do that in leadwerks?

 

Thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...