Tom McReynolds (tomcat++at++proxima)
Tue, 9 Apr 1996 16:33:40 -0700
On Apr 9, 3:33pm, parviz wrote:
> Subject: (Fwd) Problems with OpenGL conversion of distortion correction pr
> One of our Customer has the following problem with converting distortion
> correction program to OpenGl,
> any ideas??
>
>
> "I modified the distortion correction demo program "hemisphere.c" that
> I found on sgigate.sgi.com in the distribution file
> /pub/Performer/RealityCentre/distort.tar.Z. The modification works fine
> under IrisGL. I then attempted to convert the modified program to
> OpenGL without much success; none of the OpenGL commands seem to draw
> anything. Could you ask one of your Performer/OpenGL gurus to have a look
> at the program please? I've attached copies of both the IrisGL and OpenGL
> versions of the program. Running the programs requires the .flt-format
> models and textures found in the distributon file. Thanks
>
> PS - can I copy the frame buffer into a 1024x1280 texture map? I'm not
> sure what the restrictions on texture map size are.
You need to use proxy calls to figure this out. You make a glTexImage2D call,
using GL_PROXY_TEXTURE_2D_EXT instead of GL_TEXTURE_2D, and then make the
glGetTexLevelParameter{i,f}v() call, again using the proxy texture as an
argument. If the texture would have been too big, the parameters will be
zero. Be sure to set the format, type, size, etc the same as you would want
for the real texture.
>
> ----- IrisGL version (hemisphere.c) -----
>
> #include <stdlib.h>
> #include <stdio.h>
> #include <string.h>
...
> static void
> drawDistort(void)
> {
>
> static unsigned long map[1024 * 1024], flags;
> static int first = 1;
> int i, j;
> float vert[2];
> float tvert[2];
>
> if(first)
> {
> glEnable (GL_TEXTURE_2D);
> first = 0;
> }
> /* texdef2d(1024, 3, 1024, 1024, map, 10, texprops); */
>
> glTexImage2D (
> GL_TEXTURE_2D, 0, 3, 512, 512, 0, GL_RGB, GL_UNSIGNED_INT, map
> );
> glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
> glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
> glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
> glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
>
> glViewport( 0, 0, 1024, 1024);
> /* texbind(TX_TEXTURE_0, 1024);
> fbsubtexload(0, 0, TX_TEXTURE_0, 1024, 0.0, 1.0, 0.0, 1.0, flags); */
> /* glCopyTexImage2DEXT (...); */ /* Don't know arguments yet */
>
> gluOrtho2D(0.0, 16.0, 0.0, 16.0);
> glLoadIdentity();
You probably want to reverse the order of these two. The second is undoing the
first...
-Tom
>
> --
> Regards
>
> Parviz Parandeh
> SE , Montreal Canada
> parviz++at++stlaurent.sgi.com
> Voice mail: 58479
> Tel: 514-745-2440
> Fax: 514-745-2660
>
>
>-- End of excerpt from parviz
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:52:41 PDT