Rescaling vertices?

Posts: 321
Joined: 2004.10
Post: #1
I read in long list of GL_TRIANGLES and GL_QUADS vertices from a data file which comprise a complex 2D polygonal.

Is it possible to scale these vertices?

For instance, I read in the data from file ComplexPoly.txt and create a Display List.

If I do

glScale(scale.x, scale.y, 1.0);

That will grow or shrink the polygonal, but only for that one instance.

I want to resize the vertices programmatically and then write the new values
back to ComplexPoly.txt.
Quote this message in a reply
Posts: 304
Joined: 2002.04
Post: #2
when you read each x, y, z from ComplexPoly.txt, first multiply it by scalingFactor then store the value. Write the values back out to ComplexPoly.txt if you want.
Quote this message in a reply
Posts: 1,403
Joined: 2005.07
Post: #3
You can either do this by,
A. by-passing opengl completly the better option.
B. looping through each vertex calling gluProject with identity projection and viewport matrices, then storing the altered values in that file.

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Posts: 321
Joined: 2004.10
Post: #4
Thank!. Codemattic's approach is more understandable to my puny brain,
but I'll try Unknown's technique sounds interesting. I'll try both.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Rescaling LongJumper 1 3,112 Oct 25, 2004 09:30 PM
Last Post: OneSadCookie
  Algorithm for sorting Vertices LongJumper 7 8,423 Jul 30, 2004 12:41 AM
Last Post: Bames53
  moving and rotating vertices furballphat 10 6,302 Jul 19, 2003 09:11 PM
Last Post: furballphat