|
|
2 months ago | |
|---|---|---|
| .. | ||
| .config | 2 months ago | |
| .vscode | 2 months ago | |
| Core | 2 months ago | |
| Platforms | 2 months ago | |
| README.md | 2 months ago | |
| RenderTarget2DSample.sln | 2 months ago | |
This is a MonoGame 3.8 sample that demonstrates how to use RenderTarget2D to render graphics to a texture and then manipulate that texture before drawing it to the screen. This sample showcases render-to-texture techniques that are commonly used for post-processing effects, screen capture, and dynamic texture generation.
The RenderTarget2D sample creates a scene with textures (checker pattern and logo), renders them to a render target, and then displays the result on the screen with various transformations and effects.
This project has been modernized to use .NET 8.0 and MonoGame 3.8.* with support for the following platforms:
net8.0-windows) - DirectX backendnet8.0) - OpenGL backend for cross-platform desktopnet8.0-android) - Mobile Android devicesnet8.0-ios) - Mobile iOS devicesRenderTarget2DSample.sln in Visual Studio 2022build-windows - Build Windows versionbuild-desktopgl - Build DesktopGL versionbuild-android - Build Android versionrun-windows - Build and run Windows versionrun-desktopgl - Build and run DesktopGL versiondotnet build RenderTarget2D.Windows.csproj
dotnet run --project RenderTarget2D.Windows.csproj
dotnet build RenderTarget2D.DesktopGL.csproj
dotnet run --project RenderTarget2D.DesktopGL.csproj
dotnet build RenderTarget2D.Android.csproj
# Deploy to connected Android device/emulator
dotnet publish RenderTarget2D.Android.csproj -f net8.0-android
dotnet build RenderTarget2D.iOS.csproj
# Requires Xcode and Mac for deployment
Game1.cs - Main game class with render target logicProgram.cs - Entry points for different platformsMainActivity.cs - Android-specific activityContent/ - Game assets (.xnb files)Properties/ - Platform-specific manifests and settingsResources/ - Android-specific resourcesThis project uses pre-compiled .xnb content files located in the ../CompiledContent/ directory. The content includes:
checker.xnb - Checker pattern texturelogo.xnb - Logo textureThe project does not include a Content.mgcb file and uses the existing compiled content directly.
If you get content loading errors, ensure that the ../CompiledContent/ directory exists with the required .xnb files for your target platform.
This sample is part of the MonoGame samples collection and follows the same licensing terms as MonoGame.