glDrawElements only draws the first vertex

Started by
4 comments, last by vstrakh 8 years, 6 months ago

Hello,

I've been trying to writer a height map loader, the data on the GPU side appear to be fine. but when I render with GL_POINTS, I only get one pixel in the center of the screen. GL_TRIANGLE_STRIP doesn't show anything.

Here's a folder containing pictures of the callstack, vertex data, shaders, element data and the result on screen.

https://www.dropbox.com/sh/obndxcase6hzh22/AADV92E5HEGa6Xbo7OIzYfusa?dl=0

The only difference is I've since removed the projection and model matrix to reduce the scope of the problem.

Advertisement

The only difference is I've since removed the projection and model matrix to reduce the scope of the problem.

That would likely cause a problem. Why would they be more likely to appear on the screen if you aren’t transorming them correctly?


color = in_pos;

This is not a very good way of removing possible errors.
Your background is black and most of your points will be black (negative numbers are black).
For all you know, your points are right there in front of you.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

Well the mesh data is between 0 and 1, so I thought without any projection it should all be in the top right of the screen.

I change it to 1, 1, 1 for the color and it's still just the same pixel, good point though.

The viewport origin is at the center of the screen, which is probably why your vertex or vertices are drawn there. Sounds like you have zero values there.. Could you take a look at your buffer, if its really correct?

As L. Spiro said, it doesnt make much sense to Not do projection, so apply the projection matrix and try again with debug color, i Suggest.

The viewport origin is at the center of the screen, which is probably why your vertex or vertices are drawn there. Sounds like you have zero values there.. Could you take a look at your buffer, if its really correct?

I followed the buffer and the first row is correct, but beyond those 8 elements, it's wrong. I'm going to redo the whole thing, but technically that first strip should of still displayed?

Note also that your vertex buffer has 16 verts [0-15], but index buffer refers 16's vertex, which is beyond buffer limits.

This topic is closed to new replies.

Advertisement