Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Index Buffer Issues


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 greenzone   Members   -  Reputation: 672

Like
0Likes
Like

Posted 21 October 2012 - 11:50 AM

Ok I am having this problem and its been the bane of my existence for like two weeks now lol. And I am sure its because I don't fully understand the index buffer. The problem is I am making geometry in 3dsMax and when I load geometry in my program it looks fine when rendered with out using wire frame but the problem is when I try to use wire frame the wires like make no sense to me at all. Ill include images to show what I am talking about.

This is it rendered with out wire frame.
rendered skin.PNG

This is the same surface rendered with wire frame.
rendered wire.PNG

So you can see that each triangle is not defined with lines, there are these strange gaps that I don't understand and I also don't understand how the surface is rendering correctly but the wire frame is not. with that said I am not using GL_LINE_LOOP or GL_TRIANGLE_LOOP it is just triangle and lines. so what am i missing? Now is this something that would be a result of how my index buffer is set up or am I completely not understanding this. Any light shed on the situation would be awesome.

This is a problem for me when i am trying to create my own file types for storing the vertex info. I am not getting a real number of faces or a full triangle face information.

thanks
J-GREEN

Greenpanoply

Sponsor:

#2 greenzone   Members   -  Reputation: 672

Like
0Likes
Like

Posted 21 October 2012 - 11:57 AM

sorry for posting this twice. my browser had a glitch :(
J-GREEN

Greenpanoply

#3 Lauris Kaplinski   Members   -  Reputation: 841

Like
2Likes
Like

Posted 21 October 2012 - 01:05 PM

BY any chance are you using GL_LINES to draw your wireframe?

GL_LINES draws one line segment between each pair of vertices. GL_TRIANGLES draws triangle between each triplet of vertices. Thus if you have, for example, an index buffer:
1,2,3,3,2,4
It defines two adjacent triangles (sharing edge 2-3), but if drawn with GL_LINES, only two line segments (1-2 and 2-4) will be drawn.

Primitive types (GL_TRIANGLES, GL_LINES, etc.) define the topology of your mesh. In your case the topology is triangles so you have to use GL_TRIANGLES always.
glPolygonMode defines whether you want your triangles to be filled or outlined.

So you have to set glPolygonMode to GL_LINE and use glDrawElements with GL_TRIANGLES in your code for wireframe mode.
Lauris Kaplinski

First technology demo of my game Shinya is out: http://lauris.kaplinski.com/shinya
Khayyam 3D - a freeware poser and scene builder application: http://khayyam.kaplinski.com/

#4 TheChubu   Crossbones+   -  Reputation: 4549

Like
0Likes
Like

Posted 21 October 2012 - 03:34 PM

You can check up the primitives section in OpenGL's spec. I was going to say that you could use a GL_LINE_STRIP in your glDraw call for obtaining a wireframe, though what Lauris said (glPolygonMode) works better from what I've seen...

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

 

My journals: dustArtemis ECS framework and Making a Terrain Generator





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS