How to create a BasicEffect - Errors in Vulkan / OpenGL renderers
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- csharp, github
- Domain
- documentation
Research direction
Start with the linked Basic Effect guide and reproduce the issue using the linked BasicEffectFromEmptyGame project, running its DesktopVK and DesktopGL projects as described. Compare the guide’s example with the error and black triangle reported across the two renderers; done means the documented example runs without the Vulkan crash and displays the vertex colors in OpenGL.
Written by the indexing model from the issue text.
Description
What happened?
While trying to follow the How to create a Basic Effect guide, starting from the new Empty Game template, running the Platforms.DesktopVK project ended up crashing with the following error:
Unhandled exception. System.InvalidOperationException: An error occurred while preparing to draw. This is probably because the current vertex declaration does not include all the elements required by the current vertex shader. The current vertex declaration includes these elements: POSITION0, NORMAL0, COLOR0.
$(String[] args) in /home/sylvain/Programmes/Jeux/DungeonCrawlerTest (Copie)/Platforms/DesktopVK/Program.cs:line 4
at Microsoft.Xna.Framework.Graphics.VertexInputLayout.GenerateInputElements(VertexAttribute[] inputs, MGG_InputElement[]& elements, Int32[]& strides)
at Microsoft.Xna.Framework.Graphics.Shader.GetOrCreateLayout(VertexBufferBindings vertexBuffers)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.PlatformApplyState(Boolean applyShaders)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.DrawUserPrimitives[T](PrimitiveType primitiveType, T[] vertexData, Int32 vertexOffset, Int32 primitiveCount, VertexDeclaration vertexDeclaration)
at BasicEffectFromEmptyGame.Game1.Draw(GameTime gameTime) in /home/sylvain/Programmes/Jeux/DungeonCrawlerTest (Copie)/Source/Game1.cs:line 99
at Microsoft.Xna.Framework.Game.DoDraw(GameTime gameTime)
at Microsoft.Xna.Framework.Game.Tick()
at Microsoft.Xna.Framework.NativeGamePlatform.RunLoop()
at Program.
The same code when running the Platforms.DesktopGL project doesn't crash, but prints a black triangle (it should have been vertex colored):
I couldn't test the Platforms.DirectX12 build working on a Linux environment with the following specs:
- OS: Ubuntu 24.04.5 LTS (64-bit)
- GNOME version: 46
- windowing system: X11
- kernel version: Linux 7.0.0-43-generic
How to reproduce?
- Clone the reproduction repository: [https://github.com/raaaahman/BasicEffectFromEmptyGame][https://github.com/raaaahman/BasicEffectFromEmptyGame)
- Run
dotnet run --project Platforms/DesktopVK/BasicEffectFromEmptyGame.DesktopVK.csprojanddotnet run --project Platforms/DesktopGL/BasicEffectFromEmptyGame.DesktopGL.csproj - Optional. Comment Game1.cs: line 44 and run the projects again. Notice this doesn't change the issue.
- Dominant language
- C#
- Stars
- 20
- Forks
- 97
- Avg merge
- 8d 1h
- Merged PRs (30d)
- 4
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from MonoGame/docs.monogame.github.io
-
Docs typoOpen
Difficulty 1/5 Under an hour Newbie friendliness 78/100
MonoGame/docs.monogame.github.io#328 · 1 comment ·
-
URGENT! Update documentation on how to install Wine on MacOSMay be free again A pull request for this issue was closed without being merged. Openbug documentation
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
MonoGame/docs.monogame.github.io#308 · 1 comment ·
-
Difficulty 2/5 1-2 days Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
MonoGame/docs.monogame.github.io#263 · 3 comments ·
All issues in MonoGame/docs.monogame.github.io
Similar issues
-
area:frontend bug FE P3
Difficulty 1/5 Under an hour Newbie friendliness 72/100
klasolsson81/jobbliggaren#2288 ·
Maintainers usually reply within 1 day
-
CLI: stale build hint, non-gofmt autocomplete output and a leftover `--revit=<year>` in the docsOpenCommand Line Utility (CLI)
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
pyrevitlabs/pyRevit#4217 ·
Maintainers usually reply within 1 day
-
area: ui bug ready
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Maintainers usually reply within 1 day
-
account bug effort:S P2
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nightscout/nocturne#3745 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
modelcontextprotocol/csharp-sdk#2031 ·
Maintainers usually reply within 1 day