Laxman Warpe

Rendering bitmap image on part

Discussion created by Laxman Warpe on Oct 9, 2019

Hi everyone,

I am working on the SolidWorks API (C#) and OpenTk. I would like to display the bitmap image on part in 2D. The new image will get regenerated on _BufferSwapNotify and it should get display according to rotation on the new plane. A few lines of code is here.


_temperatureTextureId = GL.GenTexture();

var data = _bitmap.LockBits(new Rectangle(Point.Empty, _bmp.Size), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
bitmapSource.CopyPixels(Int32Rect.Empty, data.Scan0, data.Height * data.Stride, data.Stride);
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, data.Width, data.Height, 0, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, data.Scan0);

GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);


GL.Color3((byte)211, (byte)211, (byte)211);

GL.TexCoord2(0, 0);
GL.Vertex3(x1,y1, z1);

GL.TexCoord2(1, 0);
GL.Vertex3(x2,y2, z2);

GL.TexCoord2(1, 1);
GL.Vertex3(x3,y3, z3);

GL.TexCoord2(0, 1);
GL.Vertex3(x4,y4, z4);


If the hard-coded vertices values are applied to the Quad then I am getting the image. But not able to get the new quad vertices according to transformation. For each transform the new image should get displayed on a new plane with four boundary vertices.

Please help. 

Thanks in advance