本文整理汇总了C#中SharpGL.OpenGL.GenTextures方法的典型用法代码示例。如果您正苦于以下问题:C# OpenGL.GenTextures方法的具体用法?C# OpenGL.GenTextures怎么用?C# OpenGL.GenTextures使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharpGL.OpenGL
的用法示例。
在下文中一共展示了OpenGL.GenTextures方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
/// <summary>
/// This function creates the underlying OpenGL object.
/// </summary>
/// <param name="gl"></param>
/// <returns></returns>
public virtual bool Create(OpenGL gl)
{
// If the texture currently exists in OpenGL, destroy it.
Destroy(gl);
// Generate and store a texture identifier.
gl.GenTextures(1, glTextureArray);
return true;
}
示例2: Texture
public Texture(OpenGL gl)
{
_gl = gl;
_gl.GenTextures(1, _texture);
}
示例3: InitializeTexture
private void InitializeTexture(ref OpenGL gl)
{
gImage1 = new Bitmap(@"C:\Users\Lee\Documents\GitHub\SmackBrosClient\SmackBrosClient\files\meleemenu1.jpg");
System.Drawing.Rectangle rect = new System.Drawing.Rectangle(0, 0, gImage1.Width, gImage1.Height);
gbitmapdata = gImage1.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
gImage1.UnlockBits(gbitmapdata);
gl.GenTextures(1, gtexture);
gl.BindTexture(OpenGL.GL_TEXTURE_2D, gtexture[0]);
gl.TexImage2D(OpenGL.GL_TEXTURE_2D, 0, (int)OpenGL.GL_RGBA, gImage1.Width, gImage1.Height, 0, OpenGL.GL_BGR_EXT, OpenGL.GL_UNSIGNED_BYTE, gbitmapdata.Scan0);
gl.TexParameter(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MIN_FILTER, OpenGL.GL_LINEAR);
TexturesInitialised = true;
}
示例4: InitTexture
public void InitTexture(OpenGL renderer)
{
if (String.IsNullOrEmpty(Texture))
{
return;
}
// We need to load the texture from file.
var textureImage = new Bitmap(Texture);
renderer.Enable(OpenGL.GL_TEXTURE_2D);
// Get one texture id, and stick it into the textures array.
renderer.GenTextures(1, _textures);
// Bind the texture.
renderer.BindTexture(OpenGL.GL_TEXTURE_2D, _textures[0]);
// Tell OpenGL where the texture data is.
renderer.TexImage2D(OpenGL.GL_TEXTURE_2D, 0, 3, textureImage.Width, textureImage.Height, 0, OpenGL.GL_BGR, OpenGL.GL_UNSIGNED_BYTE,
textureImage.LockBits(new Rectangle(0, 0, textureImage.Width, textureImage.Height),
ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb).Scan0);
// Specify linear filtering.
renderer.TexParameter(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MIN_FILTER, OpenGL.GL_LINEAR);
}