• Advertisement
Sign in to follow this  

Mesh glitch

This topic is 4523 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone have any idea what might be causing this glitch? The code is supposed to display a single landscape mesh however some bits of it appear floating in the distance where they shouldn't. (see them!?) (a close up of one floating bit - on the left... it looks like a random strip off the end) It's probably a bug in my mesh loader that I need to find, but I thought i'd check if anyone else has seen this phenomenon! In case there is a different cause.

Share this post


Link to post
Share on other sites
Advertisement
I'll bet you its not a gl glitch, but mroe a gitch in your data or the way you load the data.

Share this post


Link to post
Share on other sites
That reminds me of the time I was playing with vertex arrays and I had it reading beyond the data. The heightmap ended up with a cool wavy effect for about 30 seconds, at which point Windows decided I shouldn't have been accessing that memory and killed my app. Either way, I'm going to have to go with skow on this one.

Share this post


Link to post
Share on other sites
xDan:

Do these weird landscape parts look like "floating" in front of you without any depth test? If it is so, I had a similar problem, and it was a Cg 1.3 bug, resulting in a incorrect vertex attributes binding, when I used vertex program with vp_20 profile and vertex attributes with indices 6 and 7 (all the others are binded to pos/color/normal/seccolor/texcoord#X/etc) and UNUSED(!!!) uniform constants declaration (e.g., I had a declaration of ModelView matrix, but I didn't use it).
Cg has inserted such a string into compiled shader:

#var float3x4 ModelViewMatrix : : , 3 : 1 : 0

After, when loading and using compiled shader, Cg runtime did incorrect bindings, because this string alters indices shifts, causing vertex shader to incorrectly calculate output WPOS position with normalized post-perspective Z and W coordinate of 0.

I fixed it, simply killing unused declarations and recompiling shader, so, this weird string dissapeared )))

Share this post


Link to post
Share on other sites
Depth test is fine, I am not using shaders. skow is probably right...

Share this post


Link to post
Share on other sites
It looks like there's a last row of triangles being drawn with the wrong winding order, and not being rendered correctly because of the backface culling. (You have enabled backface culling, right?)

Share this post


Link to post
Share on other sites
It looks like you're reading from somewhere way over the rainbow.. err the buffer.

Post your code.

Share this post


Link to post
Share on other sites
Cheers for the suggestions! I have it working now. I tested some simple objects and found exactly 1/3 the triangles were shown. Looking in the loader code I found I was putting the vertexes into arrays by going from 0 to triangle count not count*3 as I should have been!


(working now!)

:-)

Share this post


Link to post
Share on other sites
hi,i am a beginner of opengl, i am very interesting in Terrain,
can you give your landspace's part's source code to me,
i will be very appreciate, thanks!
and we can discuss how to render terrain, i can give you my terrain's code
my email is: sssa2000@163.com

Share this post


Link to post
Share on other sites
Well I would try and help you but my code does not really have a terrain part, it just has a mesh loader. So it's just rendered as any other mesh.
I'm just beginning opengl too... :-)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement