Applying a Sticker-like texture (v5)

By default, Eyeshot repeats a material with texture when it is applied on an entity:


If you don't want to repeat it, but instead you want to apply it like a sticker, as in the following picture, you can use the approach described in this document.


1) Inherit the class of the Eyeshot entity to use, in this case a Mesh, that sets the wrapping modes to CLAMP_TO EDGE and sets the Linear filtering 

class MyMesh : Mesh 
        public MyMesh() 

        protected override void Render(RenderParams data) 
            gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); 
            gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); 

            gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); 
            gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); 



2)  Create a bitmap to use as the texture that has a 1 pixel border of the color that you want on your Eyeshot entity, then create a Material from that bitmap and assign it to the inherited Eyeshot entity (MyMesh):


 	    MyMesh plate = Mesh.CreatePlanar<MyMesh>(new LinearPath(20, 30), 0.1, meshNatureType.Plain); 

            Size origSize = Properties.Resources.Smiley.Size; 

            // Create a new bitmap from the original one that has 1-pixel border of the appropriate color 
            Bitmap myBmp = new Bitmap(origSize.Width + 2, origSize.Height + 2); 

            using (Graphics gBmp = Graphics.FromImage(myBmp)) 
                SolidBrush brush = new SolidBrush(Color.Red); 
                gBmp.FillRectangle(brush, new Rectangle(0, 0, myBmp.Width, myBmp.Height)); 
                gBmp.DrawImage(Properties.Resources.Smiley, 1, 1, origSize.Width, origSize.Height); 

            Material mat = new Material(myBmp); 
            viewportLayout.Materials.Add("mat", mat); 

            // Apply the texture mapping and assign the material to the entity 
            plate.ApplyTextureMapping(textureMappingType.Plate, 0.5, 0.5); 
            plate.MaterialName = "mat"; 
            plate.ColorMethod = colorMethodType.byEntity; 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


  • The class RenderParams is not found in my Mesh inherited class. 

    I am using eyeShot 6. 

    Is it normal? I am missing something? Which namespace should I include? 



    Comment actions Permalink
  • In Eyeshot 6 there is no RenderParams class.

    Just let Visual Studio create the override for you with the correct signature.

    Comment actions Permalink

Please sign in to leave a comment.