Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

How to use raw OpenGL Functions in MonoGame

$
0
0

@MaikTheBoss1337 wrote:

Hello, im using MonoGame 3.5.1 and i want to use modern gl functions in Monogame Desktop GL versions...
I want to draw a simple triangle, but the triangle is not drawing in the Draw(GameTime gameTime) function! If i paste the whole source code in an openTK window, its working, so I don't know what im doing wrong!

I know that its not intended to do, but maybe someone can help !

Have a nice day,
Mike

protected override void Initialize() {
shaderProgram = new ShaderProgram("test");
model = new VertexModel(new float[] { -0.5F, 0.5F, 0.0F, -0.5F, -0.5F, 0.0F, 0.5F, -0.5F, 0.0F, 0.5F, 0.5F, 0.0F }, new float[] { 0, 0, 0, 0, 0, 0, 0, 0 },
new uint[] { 0, 1, 3, 3, 1, 2 });
base.Initialize();
}

protected override void Draw(GameTime gameTime) {
base.Draw(gameTime);
GL.Disable(EnableCap.StencilTest);
GL.Disable(EnableCap.Blend);
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
GL.ClearColor(Color.CornflowerBlue.R/255.0F, Color.CornflowerBlue.G/255.0F, Color.CornflowerBlue.B/255.0F, Color.CornflowerBlue.A/255.0F);
shaderProgram.useProgram();
model.bindModel();
GL.EnableVertexAttribArray(0);
GL.EnableVertexAttribArray(1);
model.drawModel();
GL.DisableVertexAttribArray(0);
GL.DisableVertexAttribArray(1);
model.unbindModel();
shaderProgram.unuseProgram();
}

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles