Comments (15)
Do we have a test case here that exercises this issue?
from monogame.
As far as I know WP7 only allows one scissor per spritebatch begin/end.
from monogame.
how about desktop XNA? I wonder what it allows....
from monogame.
I tested it and it works in a simple way:
You enable ScissorTest in rasterizer state.
If you use something like deferred (draw only happens once when the end is called) you can use one scissor rectangle, the one you last set before calling end.
On the other hand, if you use immediate, the textures will draw immediately, so every single draw can use a seperate scissor rectangle.
Note that using deferred has a lot better performance than immediate. For example if you draw lots of sprites from a spritesheet, XNA will draw all those textures in a single pass instead of one pass per object drawn.
from monogame.
We need to get a test case here of the code they think should work.
I suspect it is user error, but it is always possible it is something different or that has been change in our draw process.
from monogame.
Does MG support immediate mode rendering? Yeah, those Xamarin guys need to get us a test case that precipitated this bug report. ahem @CartBlanche ??
from monogame.
He means immediate vs deferred as passed into SpriteBatch.Begin(). Yes it does.
from monogame.
If someone takes the time to test the following code on the platforms, we will see if it works correctly:
RasterizerState rasterizerState = new RasterizerState() { MultiSampleAntiAlias = false, ScissorTestEnable = true };
Texture2D whitePixel = new Texture2D(GraphicsDevice, 1, 1);
whitePixel.SetData<Color>(new Color[] { Color.White });
Rectangle scissorRectangle = new Rectangle(0, 0, GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight);
Rectangle scissorRectangle2 = new Rectangle(0, 0, GraphicsDevice.PresentationParameters.BackBufferWidth / 2, GraphicsDevice.PresentationParameters.BackBufferHeight / 2);
this.SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, rasterizerState);
this.GraphicsDevice.ScissorRectangle = scissorRectangle;
this.SpriteBatch.Draw(whitePixel, new Rectangle(0, 0, GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight), Color.White);
this.GraphicsDevice.ScissorRectangle = scissorRectangle2;
this.SpriteBatch.End();
If this draws to the full screen, we're good.
Change it to SpriteSortMode.Deferred. If it draws to the top left corner only, we're double good.
from monogame.
I've started testing the platforms;
XNA for reference (left immediate - right deferred)
MonoGame/WP8 (left immediate - right deferred)
MonoGame/Windows-Metro (left immediate - right deferred)
I'll test more platforms later.
from monogame.
Seems fine to me considering that WP8 is in portrait.
from monogame.
Yea for WP8, i guess I used the wrong arrow button in emulator.
from monogame.
Has anyone checked if this is working correctly in desktop platforms too?
from monogame.
If it works for any SharpDX platform it works for all of them most likely. So WP8, Win8, and WinDesktop should all work. @raistlinthewiz just had the orientation of the wp8 emulator wrong.
The question is if this is a bug on any of the GL platforms. If it fails on WinDesktop GL then most likely it is broken for the others as well.
from monogame.
Will also test it for WinDesktopGL.
from monogame.
This is most likely working from all our tests.
from monogame.
Related Issues (20)
- Repair WindowsDX tests HOT 4
- Empty Queue Crash in DynamicSoundEffectInstance.PlatformUpdateQueue() HOT 6
- TestFailure: TestMergePositionsMultipleGeometries - Index was outside the bounds of the array. HOT 1
- MGCB editor fails with a parsing error in latest "develop" HOT 5
- Feature Request: Resolve Missing XML For Public Type Warnings HOT 4
- unmanaged callers only HOT 4
- Project Template Type Table Documentation URLs need to be updated HOT 2
- [PAID BOUNTY] [LOCKED] Switch the console runtime from BRUTE to NativeAOT HOT 4
- [PAID BOUNTY] [LOCKED] Implement the Direct3D 12 / GDK/GDKX backend HOT 1
- NoSuitableGraphicsDeviceException on Virtual Machine HOT 2
- PathHelper.GetRelativePath potential bugs HOT 2
- Issue with GetData/SetData as of 2024 HOT 1
- `DrawableGameComponent.Initialize` Does Not Behave How XNA Documentation Describe It HOT 1
- [PAID BOUNTY] [LOCKED] Package up ffmpeg and ffprobe HOT 10
- [PAID BOUNTY][LOCKED] A shared base for public and console repos
- AL lib throws unclosed device warning on proper game exit HOT 4
- Variable rate shading HOT 2
- [Urgent security issue] FreeImage arbitrary code execution vulnerability HOT 2
- tu-clausthal link does not exists HOT 2
- Getting started page is not working HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from monogame.