Jump to content
  • Advertisement
Sign in to follow this  
Halconero

Vertex array & wireframe problem

This topic is 4132 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

Hi everyone, I'm new to vertex arrays and I'm trying to do a 3D mesh using them. I get to draw the mesh with filled quads. But when I switch to wireframe mode (glPolygonMode(GL_FRONT, GL_LINE) nothing gets drawn.. Is it obligatory to specify an edge flag / color arrays along with the vertex array or these are taken from the default / current values? I tried it also but nothing happened. Besides, I draw quads using glBegin and they draw perfectly in any of the two modes. Please help! Thank you. [smile] [Edited by - Halconero on March 23, 2007 9:20:21 PM]

Share this post


Link to post
Share on other sites
Advertisement
Try using glPolygonMode(GL_FRONT_AND_BACK, GL_LINE) instead, it's possible the vertices of your quads are in the "wrong" order, which leads to them being culled.

Share this post


Link to post
Share on other sites
Thank you

Well it seems something strange happened here because I tried changing the orientation of the quads by changing the indices passed to glDrawElements but still one moment I have a filled quad and then I remove the comment to the line:

glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

and the quad disappears!

By the way I changed to glDrawArrays to render my quads and it worked fine.

Share this post


Link to post
Share on other sites
Sounds like you have your indices setup wrong. Your order is incorrect. With glDrawElements you need to have the order and amount setup correctly for it to work right, vs. with glDrawArrays() you just tell it the number of indices to render.

Share this post


Link to post
Share on other sites
Yeah that's true, with glDrawArrays you have to provide the array with ordered vertices instead of providing ordered indices to glDrawElements, but I'm almost sure that they were correct, as a proof of this the quads drew right in fill mode. I think is a local issue (My PC!).

Share this post


Link to post
Share on other sites
I found a similar case:

http://209.85.165.104/search?q=cache:-qSpjYACzvUJ:www10.dcccafe.com/NewsPortal-0.37/article.php%3Fid%3D152931%26group%3Dcomp.graphics.api.opengl+glDrawElements+not+working+GL_LINE&hl=es&ct=clnk&cd=1&gl=cl

If you can't see the link here goes:

Quote:

Re: glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ) not working with vertex arrays on laptop
Newsgroups Answer

Subject: Re: glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ) not working with vertex arrays on laptop
From: nospam@nospam.net (Carl Bateman)
Newsgroups: comp.graphics.api.opengl
Organization: Aioe.org NNTP Server
Date: Nov 21 2006 11:39:06

"jbwest" <jbwest@comcast.net> wrote in message
news:leadnUDioLiAK8LYnZ2dnUVZ_tudnZ2d@comcast.com...


Do you have backface/frontface culling on ?

jbw


Short answer, I don''t know, I''m a noob. However, I''ve tried variations of
glEnable/glDisable (GL_CULL_FACE)
but to no avail.

However,
glDrawElements(GL_LINE_STRIP, 4, GL_UNSIGNED_INT, cube_indexes);
and
glDrawElements(GL_LINES, 4, GL_UNSIGNED_INT, cube_indexes);
do give me lines.


I program during my daily commute, but since OpenGL doesn''t seem to properly
implemented I have a problem. It slows dev work, but nothing catastrophic.
I''m asking about this more out of curiosity than anything else, I was
wondering whether this is a known issue and what the cause might be.


Sorry for delay in replying I have limited access to news servers I can post
from.

CB

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!