public ScreenBuffer(GraphicsContext graphics, FrameBuffer deviceScreen, int width, int height, PixelFormat colorFormat, PixelFormat depthFormat, MultiSampleMode multiSampleMode) { if (width == 0) { width = deviceScreen.Width; } if (height == 0) { height = deviceScreen.Height; } colorFormat = deviceScreen.ColorFormat; depthFormat = deviceScreen.DepthFormat; this.AdjustAspect(graphics, deviceScreen, width, height); this.shaderProgram = new ShaderProgram(ScreenBuffer.programData); this.vertexBuffer = new VertexBuffer(12, 18, new VertexFormat[] { VertexFormat.Float3, VertexFormat.Float2, VertexFormat.Float4 }); this.vertexBuffer.SetVertices(ScreenBuffer.vertexData); this.vertexBuffer.SetIndices(ScreenBuffer.indexData); this.colorTexture = new Texture2D(width, height, false, colorFormat, PixelBufferOption.Renderable, InternalOption.SystemResource); this.depthBuffer = new DepthBuffer(width, height, depthFormat, PixelBufferOption.Renderable, InternalOption.SystemResource); base.SetColorTarget(this.colorTexture, 0); base.SetDepthTarget(this.depthBuffer); }
public static extern int Create(int width, int height, PixelFormat colorFormat, PixelFormat depthFormat, MultiSampleMode multiSampleMode, out int result);
public static extern int GetScreenInfo(int handle, out int width, out int height, out PixelFormat colorFormat, out PixelFormat depthFormat, out MultiSampleMode multiSampleMode);
public GraphicsContext(int width, int height, PixelFormat colorFormat, PixelFormat depthFormat, MultiSampleMode multiSampleMode) { int errorCode = PsmGraphicsContext.Create(width, height, colorFormat, depthFormat, multiSampleMode, out this.handle); if (errorCode != 0) { Error.ThrowNativeException(errorCode); } this.caps = new GraphicsCaps(this); this.screen = (this.deviceScreen = new FrameBuffer(this)); if (ScreenBuffer.NeedVirtualScreen(this.screen, ref width, ref height)) { this.screen = (this.virtualScreen = new ScreenBuffer(this, this.deviceScreen, width, height, colorFormat, depthFormat, multiSampleMode)); GraphicsContext.notifyUpdate |= (GraphicsUpdate)6U; } this.SetFrameBuffer(null); this.state.Reset(this.screen); GraphicsContext.notifyUpdate |= GraphicsUpdate.Viewport; }