Sign in to follow this  
JoshuaWaring

glDrawElements only draws the first vertex

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Edited by Joshhua5

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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? 

Edited by Joshhua5

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this