Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
passionate dongs
May 23, 2001

Snitchin' is Bitchin'
Does anyone know what is going on here?

I'm trying to make some tubes. For some reason when I use shade with GL_FLAT the lighting looks right (although not smooth of course). If I turn on GL_SMOOTH, for some reason the shading isn't continuous. Where should I look to fix this? normals? geometry?

Right now each segment is an individual vertex array that is drawn in sequence.

Adbot
ADBOT LOVES YOU

passionate dongs
May 23, 2001

Snitchin' is Bitchin'

haveblue posted:

That would be the normals. I'm guessing from the picture on the right that each vertex's normal is informed by exactly one polygon, you'll have to calculate the average normal of every poly that touches it.

Hubis posted:

GL_FLAT uses only the first vertex for the primitive, so is it possible that you've got bad normals in one of the other two? The errors look pretty systemic...
Ahh.



So the normal for vertex A would be the average of the normals for quads B, C, D, & E?

passionate dongs
May 23, 2001

Snitchin' is Bitchin'
great! thanks

passionate dongs
May 23, 2001

Snitchin' is Bitchin'
I have a question about OpenGL / VBOs:

I have code that creates a geodesic sphere by subdivision. It works fine, although there are tons of duplicated vertices (something like 6000 unique, 60000 with duplicates). Right now my dumb way of figuring out if a new index should be created is comparing the new vertex to be added to every vertex previously in the array, and if it finds the same vertex it appends the index to the index list. Otherwise, it adds the vertex to the vertex list and creates a new index.

Is this stupid/is there something fundamentally wrong with how I'm creating the sphere? It's frustrating because a lot of OpenGL examples are in immediate mode / inefficient to be explicit / use antiquated things like display lists.

edit: Is there somewhere to look for OpenGL best practices? Is this something the red book would have?

passionate dongs
May 23, 2001

Snitchin' is Bitchin'
edit: nevermind

passionate dongs fucked around with this message at 01:49 on Feb 16, 2012

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply