Closed AngryCarrot789 closed 3 years ago
The normalized parameter should be false: Gl.VertexAttribPointer(0, 3, VertexAttribType.Float, **false**, 0, 0);
If it doesn't solve the problem, probably in the MVP matrix:
representing the matrix, going across the rows and down the colums
Matrices should be column major. Double check that.
Stride is the distance between two contiguous elements (vec3 -> 3 * sizeof(float) = 12
); it could be greater than 12 in the case you configure interleaved attributes.
I'd suggest you to use more appropriate and popular Q&A site suck as stackoverflow, I'll get more help and guidance.
hi, i've been trying to just draw a triangle but it doesn't work at all. i tested my shader, and passing the matrix to the shader and drawing a triangle using Gl.Vertex3, and it does work. the triangle moves around. however, it doesn't work if i draw the triangle using a VAO
and then to draw, i firstly "use" the shader (by calling Gl.UseProgram), then i give my matrix to the shader (with Gl.UniformMatrix4), which i pass an array of 16 floats, representing the matrix, going across the rows and down the colums. and then finally i draw the mesh, by binding the VAO and drawing arrays like so:
but nothing draws onscreen. when drawing the mesh, instead of doing it the DrawArrays way, i instead use the Gl.Vertex3 way, it works fine: (the player/camera can move using the mouse and keyboard, so i moved to the top right corner and looked down to the left a bit, and then the shader obviously "moves" the vertices around using the UniformMatrix4 function)![image](https://user-images.githubusercontent.com/32274404/104951920-6731b780-59bb-11eb-98ac-c003533c6b80.png)
does anyone know what's happening? i could just about use RenderDoc and in Pipeline State>Vertex Input, it showed a buffer that was 36 bytes long, and i know floats are 4 bytes, 36/4 = 9, so it did pass my triangle. im not sure what it means by "stride 12" though. and in Vertex Attribute Formats, it mentioned in_pos. but i couldnt take any more captures because every time i try to analyse another capture, RenderDoc crashes.