本文整理汇总了C#中GraphicsContext.Enable方法的典型用法代码示例。如果您正苦于以下问题:C# GraphicsContext.Enable方法的具体用法?C# GraphicsContext.Enable怎么用?C# GraphicsContext.Enable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GraphicsContext
的用法示例。
在下文中一共展示了GraphicsContext.Enable方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
static bool Init()
{
graphics = new GraphicsContext();
//Window size: Change if Tablet, default is Vita
graphics.SetViewport(0, 0, graphics.Screen.Width, graphics.Screen.Height);
//Background Color Set
graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f);
program = new ShaderProgram("/Application/shaders/VertexColor.cgx");
program.SetUniformBinding(0, "WorldViewProj");
//Detect if processing shadow or not
program.SetUniformBinding(1, "ShadowOn");
program.SetUniformBinding(2, "LocalLightDirection");
program.SetUniformBinding(3, "EyePosition");
program.SetUniformBinding(4, "K_A");
program.SetUniformBinding(5, "K_D");
program.SetUniformBinding(6, "K_S");
program.SetUniformBinding(7, "Shininess");
program.SetUniformBinding(8, "Modelmatrix");
program.SetUniformBinding(9, "ModelmatrixIT");
program.SetUniformBinding(10, "viewMatrix");
program.SetUniformBinding(11, "projMatrix");
program.SetAttributeBinding(0, "a_Position");
program.SetAttributeBinding(1, "a_Color");
//Select Model
//model = new Model("house");
model = new Model("skull");
//Set buffers to hold position data
vbuffer = model.SetBuffer();
//Find size of model to be used in camera positioning
model.computeModelDimensions();
//Set Light Vector
light = new Light(model.centerX-model.diagonal*1.5f, model.centerY+model.diagonal*1.5f, 0);
Console.WriteLine (light.light.X + " " + light.light.Y + " " + light.light.Z);
stopwatch = new Stopwatch();
stopwatch.Start();
//Required to render model without holes
graphics.Enable (EnableMode.DepthTest);
graphics.Enable(EnableMode.CullFace);
graphics.SetCullFace(CullFaceMode.Front, CullFaceDirection.Cw);
return true;
}
示例2: Initialize
public virtual void Initialize()
{
Console.WriteLine("Initialize()");
stopwatch = new Stopwatch();
stopwatch.Start();
preSecondTicks=stopwatch.ElapsedTicks;
graphics = new GraphicsContext();
graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f);
graphics.Enable(EnableMode.Blend);
graphics.Enable(EnableMode.DepthTest);
graphics.SetBlendFunc(BlendFuncMode.Add, BlendFuncFactor.SrcAlpha, BlendFuncFactor.OneMinusSrcAlpha);
debugString = new DebugString(graphics);
}
示例3: Initialize
public virtual void Initialize()
{
Console.WriteLine("Initialize()");
stopwatch = new Stopwatch();
stopwatch.Start();
graphics = new GraphicsContext();
graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f);
graphics.Enable(EnableMode.Blend);
graphics.Enable(EnableMode.DepthTest);
graphics.SetBlendFunc(BlendFuncMode.Add, BlendFuncFactor.SrcAlpha, BlendFuncFactor.OneMinusSrcAlpha);
textureFont = new Texture2D("/Application/resources/DebugFont.png", false);
debugString = new DebugString(graphics, textureFont, 10,20);
}
示例4: AppRenderer
public AppRenderer()
{
int dspWidth = GraphicsContext.ScreenSizes[0].Width;
int dspHeight = GraphicsContext.ScreenSizes[0].Height;
//trace("Display claims to be: " + dspWidth + "x" + dspHeight);
context = new GraphicsContext (dspWidth, dspHeight, PixelFormat.Rgba, PixelFormat.None, MultiSampleMode.None);
Settings.STAGE_W = dspWidth;
Settings.STAGE_H = dspHeight;
context.SetViewport(0, 0, dspWidth, dspHeight);
context.SetScissor(0, 0, dspWidth, dspHeight);
context.Disable(EnableMode.All);
context.Enable(EnableMode.ScissorTest);
context.Enable(EnableMode.Blend);
context.SetBlendFunc(BlendFuncMode.Add, BlendFuncFactor.SrcAlpha, BlendFuncFactor.OneMinusSrcAlpha);
context.SetClearColor(9/255f, 11f/255f, 15f/255f, 1f);
Renderer.screenMatrix = Matrix4.Ortho(0, dspWidth, dspHeight, 0, 0.0f, 32768.0f);
}
示例5: Video
public Video(DisposableI parent, ApplicationI application, DepthStencilFormats depthStencilFormats, bool vSync)
: base(parent)
{
try
{
this.application = application;
FileTag = "Vita_";
currentPixelTextures = new Texture2D[4];
currentSamplerStates = new SamplerState[4];
PixelFormat format = PixelFormat.None;
switch (depthStencilFormats)
{
case DepthStencilFormats.None: format = PixelFormat.None; break;
case DepthStencilFormats.Defualt: format = PixelFormat.Depth16; break;
case DepthStencilFormats.Depth24Stencil8: format = PixelFormat.Depth24Stencil8; break;
case DepthStencilFormats.Depth16: format = PixelFormat.Depth16; break;
case DepthStencilFormats.Depth24: format = PixelFormat.Depth24; break;
default:
Debug.ThrowError("Video", "Unsuported DepthStencilFormat type");
break;
}
context = new GraphicsContext(0, 0, PixelFormat.Rgba, format, MultiSampleMode.None);
currentFrameBuffer = context.Screen;
BackBufferSize = new Size2(currentFrameBuffer.Width, currentFrameBuffer.Height);
((VitaApplication)application).Vita_SetFrameSize(currentFrameBuffer.Width, currentFrameBuffer.Height);
currentEnableMode = EnableMode.None;
context.Enable(currentEnableMode);
}
catch (Exception e)
{
Dispose();
throw e;
}
}
示例6: setPolygonMode
private void setPolygonMode( GraphicsContext graphics, BasicMaterial material )
{
graphics.SetBlendFunc( (BlendFuncMode)material.BlendFuncMode,
(BlendFuncFactor)material.SrcBlendFactor,
(BlendFuncFactor)material.DstBlendFactor );
graphics.SetPolygonOffset( material.PolyOffsetFactor / 1000.0f,
material.PolyOffsetUnits / 1000.0f );
// Depth Test
graphics.Enable( EnableMode.DepthTest, material.DepthTest != 0 );
graphics.SetDepthFunc( (DepthFuncMode)material.DepthMode, material.DepthWrite != 0 );
graphics.Enable( EnableMode.CullFace, (CullFaceMode)material.CullFaceMode != CullFaceMode.None);
graphics.SetCullFace( (CullFaceMode)material.CullFaceMode,
(CullFaceDirection)material.CullFaceDirection );
}
示例7: startup
protected void startup()
{
// Set up the graphics system
graphics = new GraphicsContext();
graphics.SetViewport(0, 0, graphics.Screen.Width, graphics.Screen.Height);
graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f);
graphics.Enable(EnableMode.Blend);
graphics.SetBlendFunc(BlendFuncMode.Add, BlendFuncFactor.SrcAlpha, BlendFuncFactor.OneMinusSrcAlpha);
program = new ShaderProgram("/Application/shaders/Simple.cgx");
program.SetUniformBinding(0, "WorldViewProj");
program.SetAttributeBinding(0, "a_Position");
program.SetAttributeBinding(1, "a_TexCoord");
program.SetAttributeBinding(2, "a_Color");
Matrix4 unitScreenMatrix = new Matrix4(
2.0f / graphics.Screen.Width, 0.0f, 0.0f, 0.0f,
0.0f, -2.0f / graphics.Screen.Height, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
-1.0f, 1.0f, 0.0f, 1.0f
);
program.SetUniformValue(0, ref unitScreenMatrix);
videoBuffer = new byte[VIDEO_WIDTH * VIDEO_HEIGHT * 4];
texture = new Texture2D(512, 512, false, PixelFormat.Rgba);
texture.SetFilter(VIDEO_FILTER ? TextureFilterMode.Linear : TextureFilterMode.Nearest);
float tx = (float) VIDEO_WIDTH / (float) texture.Width;
float ty = (float) VIDEO_HEIGHT / (float) texture.Height;
screenTexcoords = new float[] {
0.0f, 0.0f, // 0 top left.
0.0f, ty, // 1 bottom left.
tx, 0.0f, // 2 top right.
tx, ty, // 3 bottom right.
};
defaultTexcoords = new float[] {
0.0f, 0.0f, // 0 top left.
0.0f, 1.0f, // 1 bottom left.
1.0f, 0.0f, // 2 top right.
1.0f, 1.0f, // 3 bottom right.
};
colors = new float[] {
1.0f, 1.0f, 1.0f, 1.0f, // 0 top left.
1.0f, 1.0f, 1.0f, 1.0f, // 1 bottom left.
1.0f, 1.0f, 1.0f, 1.0f, // 2 top right.
1.0f, 1.0f, 1.0f, 1.0f, // 3 bottom right.
};
vertexCount = vertices.Length / 3;
vertexBuffer = new VertexBuffer(vertexCount,
VertexFormat.Float3,
VertexFormat.Float2,
VertexFormat.Float4);
//vertexBuffer.SetVertices(0, vertices);
//vertexBuffer.SetVertices(1, texcoords);
//vertexBuffer.SetVertices(2, colors);
/////
int fontSize = 14;
normalFont = new Font(FontAlias.System, fontSize, FontStyle.Regular);
/////
emu = new EmulatorApplication(this);
emu.initialize();
statistics = new Statistics();
}