本文整理汇总了C#中PixelInternalFormat类的典型用法代码示例。如果您正苦于以下问题:C# PixelInternalFormat类的具体用法?C# PixelInternalFormat怎么用?C# PixelInternalFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PixelInternalFormat类属于命名空间,在下文中一共展示了PixelInternalFormat类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RenderBuffer
public RenderBuffer(IOpenGL30 gl, int width, int height, PixelInternalFormat internalFormat, int samples)
{
if(gl == null)
throw new ArgumentNullException("gl");
if(width <= 0)
throw new ArgumentException("Width must be greater than 0", "width");
if(height <= 0)
throw new ArgumentException("Height must be greater than 0.", "height");
uint handle = gl.GenRenderBuffer();
if(handle == 0)
throw new NoHandleCreatedException();
Handle = handle;
Width = width;
Height = height;
InternalFormat = internalFormat;
_gl = gl;
gl.BindRenderbuffer(Constants.Renderbuffer, Handle);
gl.RenderbufferStorage(Constants.Renderbuffer, (uint)InternalFormat, Width, Height);
gl.BindRenderbuffer(Constants.Renderbuffer, 0);
}
开发者ID:GeirGrusom,项目名称:ModGL,代码行数:25,代码来源:Framebuffer.cs
示例2: Texture
public Texture(int id, int width, int height, TextureTarget target, PixelInternalFormat format)
{
Width = width;
Height = height;
ID = id;
TextureTarget = target;
PixelInternalFormat = format;
}
开发者ID:Lazzu,项目名称:Hatzap,代码行数:8,代码来源:Texture.cs
示例3: RenderTargetTexture
protected RenderTargetTexture(Vector2I size, PixelFormat pixelFormat, PixelInternalFormat internalFormat)
: base(size.X, size.Y)
{
Init2D(pixelFormat, internalFormat);
SetParameters(
TextureMinFilter.Nearest,
TextureMagFilter.Nearest,
TextureWrapMode.ClampToEdge);
}
开发者ID:GoodAI,项目名称:BrainSimulator,代码行数:9,代码来源:RenderTargetTextures.cs
示例4: AttachDepth
public Framebuffer AttachDepth(PixelInternalFormat internalFormat, PixelFormat format, PixelType type, InterpolationMode interpolation)
{
this.BufferTextures[FboAttachment.DepthAttachment] = new Texture2D (TextureTarget.Texture2D, internalFormat, format, type, interpolation, false, this.Width, this.Height);
this.Bind ();
this.BufferTextures[FboAttachment.DepthAttachment].Bind ();
GL.FramebufferTexture (this.Target, FramebufferAttachment.DepthAttachment, this.BufferTextures[FboAttachment.DepthAttachment].TextureId, 0);
this.Unbind ();
return this;
}
开发者ID:splitandthechro,项目名称:nginz,代码行数:9,代码来源:FrameBuffer.cs
示例5: TextureAttributes
public TextureAttributes(int Width, int Height, int Depth, PixelInternalFormat InternalFormat, OpenTK.Graphics.OpenGL.PixelFormat PixelFormat, PixelType PixelType)
{
this.Width = Width;
this.Height = Height;
this.Depth = Depth;
this.InternalFormat = InternalFormat;
this.PixelFormat = PixelFormat;
this.PixelType = PixelType;
}
开发者ID:elliotwoods,项目名称:VVVV.Nodes.OpenGL,代码行数:9,代码来源:Texture.cs
示例6: Attachment
public Attachment(AttachmentPoint attachmentPoint, PixelFormat pixelFormat, PixelInternalFormat pixelInternalFormat, PixelType pixelType, int index = 0, bool mipmaps = false)
{
AttachmentPoint = attachmentPoint;
PixelFormat = pixelFormat;
PixelInternalFormat = pixelInternalFormat;
PixelType = pixelType;
Index = index;
MipMaps = mipmaps;
}
开发者ID:johang88,项目名称:triton,代码行数:9,代码来源:Definition.cs
示例7: AttachTexture
public Framebuffer AttachTexture(FboAttachment attachment, DrawBuffersEnum mode, PixelInternalFormat internalFormat, PixelFormat format, PixelType type, InterpolationMode interpolation)
{
this.Attachments.Add (mode);
this.BufferTextures[attachment] = new Texture2D (TextureTarget.Texture2D, internalFormat, format, type, interpolation, false, this.Width, this.Height);
this.Bind ();
this.BufferTextures[attachment].Bind ();
GL.FramebufferTexture (this.Target, (FramebufferAttachment) mode, this.BufferTextures[attachment].TextureId, 0);
this.Unbind ();
return this;
}
开发者ID:splitandthechro,项目名称:nginz,代码行数:10,代码来源:FrameBuffer.cs
示例8: Texture
protected Texture(TextureTarget type, PixelInternalFormat format, OpenTK.Graphics.OpenGL.PixelFormat format2, int num) {
ID = GL.GenTexture();
Type = type;
Format = format;
Number = num;
Activate();
}
开发者ID:EusthEnoptEron,项目名称:opengl-tests,代码行数:10,代码来源:Texture.cs
示例9: GetOpenGLTextureFormat
internal static void GetOpenGLTextureFormat(SurfaceFormat format, out PixelInternalFormat glInternalFormat, out PixelFormat glFormat, out PixelType glType)
{
glInternalFormat = PixelInternalFormat.Rgba;
glFormat = PixelFormat.Rgba;
glType = PixelType.UnsignedByte;
switch (format)
{
case SurfaceFormat.Color:
glInternalFormat = PixelInternalFormat.Rgba;
glFormat = PixelFormat.Rgba;
glType = PixelType.UnsignedByte;
break;
case SurfaceFormat.Bgr565:
glInternalFormat = PixelInternalFormat.Rgb;
glFormat = PixelFormat.Rgb;
glType = PixelType.UnsignedShort565;
break;
case SurfaceFormat.Bgra4444:
glInternalFormat = PixelInternalFormat.Rgba4;
glFormat = PixelFormat.Rgba;
glType = PixelType.UnsignedShort4444;
break;
case SurfaceFormat.Bgra5551:
glInternalFormat = PixelInternalFormat.Rgba;
glFormat = PixelFormat.Rgba;
glType = PixelType.UnsignedShort5551;
break;
case SurfaceFormat.Alpha8:
glInternalFormat = PixelInternalFormat.Luminance;
glFormat = PixelFormat.Luminance;
glType = PixelType.UnsignedByte;
break;
case SurfaceFormat.Dxt1:
glInternalFormat = PixelInternalFormat.CompressedRgbaS3tcDxt1Ext;
glFormat = (PixelFormat)All.CompressedTextureFormats;
break;
case SurfaceFormat.Dxt3:
glInternalFormat = PixelInternalFormat.CompressedRgbaS3tcDxt3Ext;
glFormat = (PixelFormat)All.CompressedTextureFormats;
break;
case SurfaceFormat.Dxt5:
glInternalFormat = PixelInternalFormat.CompressedRgbaS3tcDxt5Ext;
glFormat = (PixelFormat)All.CompressedTextureFormats;
break;
case SurfaceFormat.Single:
glInternalFormat = PixelInternalFormat.R32f;
glFormat = PixelFormat.Red;
glType = PixelType.Float;
break;
default:
throw new NotSupportedException();
}
}
开发者ID:greenboxal,项目名称:greenbox3d,代码行数:55,代码来源:Texture.cs
示例10: PixelFormatDescriptor
public PixelFormatDescriptor(
System.Drawing.Imaging.PixelFormat drawingFormat,
PixelInternalFormat glInternalPixelFormat,
PixelFormat glPixelFormat,
PixelType glPixelType)
{
DrawingFormat = drawingFormat;
GLPixelInternalFormat = glInternalPixelFormat;
GLPixelFormat = glPixelFormat;
GLPixelType = glPixelType;
}
开发者ID:kidaa,项目名称:Pulse,代码行数:11,代码来源:PixelFormatDescriptor.cs
示例11: Create
public static Texture Create(int width, int height, PixelInternalFormat internalFormat = PixelInternalFormat.Rgba8
, PixelFormat inputPixelFormat = PixelFormat.Rgba, PixelType type = PixelType.UnsignedByte)
{
var texture = new Texture();
//create empty texture of given size
texture.LoadPixels(IntPtr.Zero, width, height, internalFormat, inputPixelFormat, type);
//set default parameters for filtering and clamping
texture.FilterBilinear();
texture.WrapMode(TextureWrapMode.Repeat);
return texture;
}
开发者ID:danielscherzer,项目名称:Framework,代码行数:11,代码来源:Texture.cs
示例12: Texture2D
/// <summary>
/// Creates a new managed 2D Texture with an explicitly specified format
/// </summary>
/// <param name="width">The width in Pixels of the Texture</param>
/// <param name="height">The height in Pixels of the Texture</param>
/// <param name="format">The format to use</param>
/// <param name="target">The target this Texture will be bound to</param>
public Texture2D(int width, int height, PixelInternalFormat format, TextureTarget target = TextureTarget.Texture2D)
: base(target)
{
_internalFormat = format;
Activate();
GL.TexParameter(Target, TextureParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge); // GL_REPEAT
GL.TexParameter(Target, TextureParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge); // GL_REPEAT
GL.TexParameter(Target, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
GL.TexParameter(Target, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
Resize(width, height);
}
开发者ID:hach-que,项目名称:SLSharp,代码行数:19,代码来源:Texture2D.cs
示例13: TexImage2D
public void TexImage2D(
TextureTarget target,
int level,
PixelInternalFormat internalFormat,
int width,
int height,
int border,
PixelFormat format,
PixelType type,
IntPtr pixels)
{
GraphicsContext.Assert();
GL.TexImage2D(target, level, internalFormat, width, height, border, format, type, pixels);
OpenGlErrorHelper.CheckGlError();
}
开发者ID:rmckirby,项目名称:XogoEngine,代码行数:15,代码来源:TextureAdapter.cs
示例14: GLTexture2D
public GLTexture2D(string name, IBitmap bmp, bool genmipmaps = false, bool linearfilter = false, OpenTK.Graphics.OpenGL.PixelFormat sourceformat = OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelInternalFormat destformat = PixelInternalFormat.Rgba, PixelType sourcetype = PixelType.UnsignedByte)
: base(name, TextureTarget.Texture2D, bmp.Width, bmp.Height)
{
tex = GL.GenTexture();
GL.BindTexture(TextureTarget.Texture2D, tex);
reattempt_load:
try {
/*BitmapData bmpdata = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
GL.TexImage2D(TextureTarget.Texture2D, 0, destformat, bmpdata.Width, bmpdata.Height, 0, sourceformat, sourcetype, bmpdata.Scan0);
bmp.UnlockBits(bmpdata);*/
bmp.TexImage2D(destformat);
}
catch(OutOfMemoryException) {
GC.WaitForPendingFinalizers();
goto reattempt_load;
}
if(genmipmaps)
{
GL.GenerateMipmap(GenerateMipmapTarget.Texture2D);
if(linearfilter)
{
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapLinear);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
}
else
{
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.NearestMipmapNearest);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Nearest);
}
}
else
{
if(linearfilter)
{
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
}
else
{
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Nearest);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Nearest);
}
}
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.Clamp);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.Clamp);
}
开发者ID:RcSepp,项目名称:global_view,代码行数:48,代码来源:GLTexture2D.cs
示例15: FBO
/// <summary>
/// Creates a framebuffer object and its associated resources (depth and pbuffers).
/// </summary>
/// <param name="Size">Specifies the size (in pixels) of the framebuffer and it's associated buffers.</param>
/// <param name="Attachments">Specifies the attachments to use for the pbuffers.</param>
/// <param name="Format">Specifies the internal pixel format for the pbuffers.</param>
public FBO(Size Size, FramebufferAttachment[] Attachments, PixelInternalFormat Format, bool Mipmaps)
{
this.Size = Size;
this.Attachments = Attachments;
this.Format = Format;
this.mipmaps = Mipmaps;
// First create the framebuffer
BufferID = Gl.GenFramebuffer();
Gl.BindFramebuffer(FramebufferTarget.Framebuffer, BufferID);
// Create and attach a 24-bit depth buffer to the framebuffer
DepthID = Gl.GenRenderbuffer();
Gl.BindRenderbuffer(RenderbufferTarget.Renderbuffer, DepthID);
Gl.RenderbufferStorage(RenderbufferTarget.Renderbuffer, RenderbufferStorage.DepthComponent24, Size.Width, Size.Height);
// Create n texture buffers (known by the number of attachments)
TextureID = new uint[Attachments.Length];
Gl.GenTextures(Attachments.Length, TextureID);
// Bind the n texture buffers to the framebuffer
for (int i = 0; i < Attachments.Length; i++)
{
Gl.BindTexture(TextureTarget.Texture2D, TextureID[i]);
Gl.TexImage2D(TextureTarget.Texture2D, 0, Format, Size.Width, Size.Height, 0, PixelFormat.Rgba, PixelType.UnsignedByte, IntPtr.Zero);
if (Mipmaps)
{
Gl.TexParameteri(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, 9729); // public const int GL_LINEAR = 9729;
Gl.TexParameteri(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, 9987); // public const int GL_LINEAR_MIPMAP_LINEAR = 9987;
Gl.GenerateMipmap(GenerateMipmapTarget.Texture2D);
}
Gl.FramebufferTexture(FramebufferTarget.Framebuffer, Attachments[i], TextureID[i], 0);
}
// Build the framebuffer and check for errors
Gl.FramebufferRenderbuffer(FramebufferTarget.Framebuffer, FramebufferAttachment.DepthAttachment, RenderbufferTarget.Renderbuffer, DepthID);
FramebufferErrorCode status = Gl.CheckFramebufferStatus(FramebufferTarget.Framebuffer);
if (status != FramebufferErrorCode.FramebufferComplete)
{
Console.WriteLine("Frame buffer did not compile correctly. Returned {0}, glError: {1}", status.ToString(), Gl.GetError().ToString());
}
Gl.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
}
开发者ID:remy22,项目名称:opengl4csharp,代码行数:51,代码来源:FBO.cs
示例16: Texture
public Texture()
{
int id;
// Create handle
GL.GenTextures(1, out id);
ID = id;
GL.BindTexture(TextureTarget.Texture2D, ID);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)DefaultMinFilter);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)DefaultMagFilter);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)DefaultHorizontalWrapFilter);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)DefaultVerticalWrapFilter);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.GenerateMipmap, 0);
PixelInternalFormat = PixelInternalFormat.Rgba;
this.PixelFormat = OpenTK.Graphics.OpenGL.PixelFormat.Bgra;
BorderColor = DefaultBorderColor;
}
开发者ID:mokujin,项目名称:DN,代码行数:19,代码来源:Texture.cs
示例17: GLTextureObject
private GLTextureObject(Size? size, Bitmap bitmap, int numMipMapLevels, PixelInternalFormat internalFormat)
{
if (size != null && bitmap != null) throw new ArgumentException("Can not pass size and bitmap!");
if (size != null)
{
bitmap = makeBitmap(size.Value);
}
this.Size = bitmap.Size;
_id = GL.GenTexture();
this.TextureUnit = TextureUnit.Texture0;
GL.ActiveTexture(this.TextureUnit);
GL.BindTexture(TextureTarget.Texture2D, _id);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureBaseLevel, 0);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMaxLevel, numMipMapLevels - 1);
Size currentSize = new Size(bitmap.Width, bitmap.Height);
Bitmap currentBitmap = new Bitmap(bitmap);
currentBitmap.RotateFlip(RotateFlipType.RotateNoneFlipY); //bitmaps coordinate system does not match opengl's coordinate system... the y coord is flipped
for (int i = 0; i < numMipMapLevels; i++)
{
//Load currentBitmap
BitmapData currentData = currentBitmap.LockBits(new System.Drawing.Rectangle(0, 0, currentBitmap.Width, currentBitmap.Height),
ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
GL.TexImage2D(TextureTarget.Texture2D, i, internalFormat, currentSize.Width, currentSize.Height, 0,
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, currentData.Scan0);
currentBitmap.UnlockBits(currentData);
//Prepare for next iteration
currentSize = new Size(currentSize.Width / 2, currentSize.Height / 2);
Bitmap tempBitmap = scaleBitmap(currentBitmap, currentSize);
currentBitmap.Dispose();
currentBitmap = tempBitmap;
}
currentBitmap.Dispose();
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.NearestMipmapLinear);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
if (size != null)
{
bitmap.Dispose();
}
}
开发者ID:lachesis,项目名称:backsub,代码行数:42,代码来源:GLTextureObject.cs
示例18: AddTarget
public void AddTarget(PixelInternalFormat format, PixelType type)
{
Texture target = new Texture();
// Bind the texture
target.Bind();
// Give an empty image to OpenGL
GL.TexImage2D(TextureTarget.Texture2D, 0, format, gameWindow.Width, gameWindow.Height, 0, PixelFormat.Rgba, type, IntPtr.Zero);
// Poor filtering. Needed !
GL.TexParameter(TextureTarget.Texture2D,
TextureParameterName.TextureMinFilter,
(int)TextureMagFilter.Nearest);
GL.TexParameter(TextureTarget.Texture2D,
TextureParameterName.TextureMagFilter,
(int)TextureMagFilter.Nearest);
targets.Add(target);
}
开发者ID:Lazzu,项目名称:Hatzap,代码行数:20,代码来源:FrameBuffer.cs
示例19: TextureStorage1DEXT
// ARB_texture_storage
/// <summary>
/// TexStorageXX allocates images with the given size (width, height, and depth, where appropriate), with the number of mipmaps given by levels. The storage is created here, but the contents of that storage is undefined.
/// </summary>
/// <param name="textureId"></param>
/// <param name="target">Valid target: GL_TEXTURE_1D</param>
/// <param name="levels">Number of mipmaps to alloc.</param>
/// <param name="piformat">Any Sized Internal format.</param>
/// <param name="Width">Width of base mipmap.</param>
/// <remarks>
/// immutable storage allocates all of the images for the texture all at once. Every mipmap level, array layer, and cube map face is all allocated with a single call, giving all of these images a specific Image Format. It is called "immutable" because once the storage is allocated, the storage cannot be changed. The texture can be deleted as normal, but the storage cannot be altered. A 256x256 2D texture with 5 mipmap layers that uses the GL_RGBA8 image format will *always* be a 256x256 2D texture with 5 mipmap layers that uses the GL_RGBA8 image format.
/// Note that what immutable storage refers to is the allocation of the memory, not the contents of that memory. You can upload different pixel data to immutable storage all you want. With mutable storage, you can re-vamp the storage of a texture object entirely, changing a 256x256 texture into a 1024x1024 texture.
/// </remarks>
public static void TextureStorage1DEXT(uint textureId, TextureTarget target, int levels, PixelInternalFormat piformat, int Width)
{
Delegates.glTextureStorage1DEXT(textureId, target, levels, piformat, Width);
}
开发者ID:raggsokk,项目名称:Kraggs.Graphics.OpenGL,代码行数:17,代码来源:DSA_v42.cs
示例20: Texture
/// <summary>
/// Creates a new Texture based on a <see cref="Duality.Resources.Pixmap"/>.
/// </summary>
/// <param name="basePixmap">The <see cref="Duality.Resources.Pixmap"/> to use as source for pixel data.</param>
/// <param name="sizeMode">Specifies behaviour in case the source data has non-power-of-two dimensions.</param>
/// <param name="filterMag">The OpenGL filter mode for drawing the Texture bigger than it is.</param>
/// <param name="filterMin">The OpenGL fitler mode for drawing the Texture smaller than it is.</param>
/// <param name="wrapX">The OpenGL wrap mode on the texel x axis.</param>
/// <param name="wrapY">The OpenGL wrap mode on the texel y axis.</param>
/// <param name="format">The format in which OpenGL stores the pixel data.</param>
public Texture(ContentRef<Pixmap> basePixmap,
SizeMode sizeMode = SizeMode.Default,
TextureMagFilter filterMag = TextureMagFilter.Linear,
TextureMinFilter filterMin = TextureMinFilter.LinearMipmapLinear,
TextureWrapMode wrapX = TextureWrapMode.ClampToEdge,
TextureWrapMode wrapY = TextureWrapMode.ClampToEdge,
PixelInternalFormat format = PixelInternalFormat.Rgba)
{
this.filterMag = filterMag;
this.filterMin = filterMin;
this.wrapX = wrapX;
this.wrapY = wrapY;
this.pixelformat = format;
this.LoadData(basePixmap, sizeMode);
}
开发者ID:KSLcom,项目名称:duality,代码行数:25,代码来源:Texture.cs
注:本文中的PixelInternalFormat类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论