Image size

New Message Reply Date view Thread view Subject view Author view

Prakash Mahesh (prakash++at++DRAWCOMP.COM)
Mon, 12 Jul 1999 10:54:21 -0400


We are using IFL to load an image into Performer, for
texture mapping
onto objects... Because Performer requires all textures to
have
dimensions that are powers of 2, I'm trying to scale the
image using the
gluScaleImage() call...

However, we are having trouble because sometimes the image
ends up
distorted (see example at
http://www.openworlds.com/scaling.rgb )... In
this example, we are texture mapping the following images:

toosmall.rgb (upper left - color and texel distortion):
  orig. dimensions: 230x220 (3 components)
  new dimensions: 256x256 (3 components)

os_headside.rgb (upper right - looks correct):
  orig. dimensions: 256x256 (3 components)
  new dimensions: 256x256 (3 components)

toobig.rgb (lower left - looks correct):
   orig. dimensions: 300x280 (3 components)
   new dimensions: 256x256 (3 components)

os_headside.jpg (lower right - texel distortion):
   orig. dimensions: 235x256 (3 components)
   new dimensions: 256x256 (3 components)

We think that the problem may be because Performer expects
texel rows to
be aligned on long word boundaries, so I also added calls
to
glPixelStore right before the image gets scaled:

glPixelStorei(GL_PACK_ALIGNMENT, 8);
glPixelStorei(GL_PACK_ROW_LENGTH, newwidth);
gluScaleImage(format, width, height, GL_UNSIGNED_BYTE,
image_buffer,
      newwidth, newheight, GL_UNSIGNED_BYTE,
scaled_buffer);

Please let me know what we are doing wrong... Thanks!

--
  Prakash Mahesh
  prakash++at++drawcomp.com
        --or--
  prakash++at++openworlds.com

 
We are using IFL to load an image into Performer, for
texture mapping
onto objects... Because Performer requires all textures to
have
dimensions that are powers of 2, I'm trying to scale the
image using the
gluScaleImage() call...

However, we are having trouble because sometimes the image
ends up
distorted (see example at
http://www.openworlds.com/scaling.rgb )... In
this example, we are texture mapping the following images:

toosmall.rgb (upper left - color and texel distortion):
  orig. dimensions: 230x220 (3 components)
  new dimensions: 256x256 (3 components)

os_headside.rgb (upper right - looks correct):
  orig. dimensions: 256x256 (3 components)
  new dimensions: 256x256 (3 components)

toobig.rgb (lower left - looks correct):
   orig. dimensions: 300x280 (3 components)
   new dimensions: 256x256 (3 components)

os_headside.jpg (lower right - texel distortion):
   orig. dimensions: 235x256 (3 components)
   new dimensions: 256x256 (3 components)

We think that the problem may be because Performer expects
texel rows to
be aligned on long word boundaries, so I also added calls
to
glPixelStore right before the image gets scaled:
 

glPixelStorei(GL_PACK_ALIGNMENT, 8);
glPixelStorei(GL_PACK_ROW_LENGTH, newwidth);
gluScaleImage(format, width, height, GL_UNSIGNED_BYTE,
image_buffer,
      newwidth, newheight, GL_UNSIGNED_BYTE,
scaled_buffer);
 

Please let me know what we are doing wrong... Thanks!

-- 
  Prakash Mahesh                                     
  prakash++at++drawcomp.com
        --or--
  prakash++at++openworlds.com
 

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Jul 12 1999 - 08:05:56 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.