Help needed with texture mapping images ...
Sean Culhane
culhane at vis.toronto.edu
Sat May 4 07:37:56 AEST 1991
Hello, all.
A *BIG* thanks to all those who replied to my previous posting about
transforming images. I seems that the overwhelming majority would
use texture mapping to do the job (given that one has a VGX).
Now, I am faced with another problem, and have banged my head for just
several hours and I am very dizzy. Here's my situation:
I have an image (in the format that lrectwrite expects), and I do a
texdef2d( 1, 2, ImageSize, ImageSize, Image, 5, texprops);
texbind(TX_TEXTURE_0, 1);
The result is that I only get ONE CORNER of a 256x256 image mapped onto the
polygon. So I look to the manual, and I read that the TX_TILE texture
property will support mapping of high-resolution images with multiple
rendering passes. So, I've set up the following:
float texprops1[] = {TX_MINFILTER, TX_BILINEAR,
TX_MAGFILTER, TX_BILINEAR,
TX_TILE, 0.0, 0.0, 0.5, 0.5,
TX_NULL};
float texprops2[] = {TX_MINFILTER, TX_BILINEAR,
TX_MAGFILTER, TX_BILINEAR,
TX_TILE, 0.5, 0.0, 1., 0.5,
TX_NULL};
float texprops3[] = {TX_MINFILTER, TX_BILINEAR,
TX_MAGFILTER, TX_BILINEAR,
TX_TILE, 0.0, 0.5, 0.5, 1.,
TX_NULL};
float texprops4[] = {TX_MINFILTER, TX_BILINEAR,
TX_MAGFILTER, TX_BILINEAR,
TX_TILE, 0.5, 0.5, 1., 1.,
TX_NULL};
and the four texture definitions:
texdef2d( 1, 2, ImageSize, ImageSize, Image, 10, texprops1);
texdef2d( 2, 2, ImageSize, ImageSize, Image, 10, texprops2);
texdef2d( 3, 2, ImageSize, ImageSize, Image, 10, texprops3);
texdef2d( 4, 2, ImageSize, ImageSize, Image, 10, texprops4);
and I draw the polygon like so:
for( i=1; i<=4; i++ ) {
texbind(TX_TEXTURE_0, i);
bgnpolygon();
t2f(t0); v3f(v0);
t2f(t1); v3f(v1);
t2f(t2); v3f(v2);
t2f(t3); v3f(v3);
endpolygon();
} /* for */
I am obviously mis-interpreting something here, since making these changes
causes the texture to be BLACK! (or non-existant ... who's to say).
Once again, and and all help/comments are greatly appreciated.
Sean.
--
Sean Culhane, Computer Vision Lab, |"I know not with what weapons World War
Dept. of Computer Science, | III will be fought, but World War IV
University of Toronto | will be fought with sticks and stones."
culhane@{vis|ai|cs}.toronto.edu | -- Albert Einstein
More information about the Comp.sys.sgi
mailing list