From: 임무 (yamoo++at++grmanet.sogang.ac.kr)
Date: 10/04/2001 20:36:19
Thanks for reply...^^;
I have solved this problem at last night..
As your opinion, the prombem is bad texture index and
didn't calling glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)...
Once more, thank you very much.
----- Original Message -----
From: "Benedikt Kessler" <bjk++at++munich.sgi.com>
To: "ÀÓ¹«Áø" <yamoo++at++grmanet.sogang.ac.kr>
Cc: <info-performer++at++sgi.com>
Sent: Thursday, October 04, 2001 4:37 PM
Subject: Re: Texture Problem using Opengl in Performer
> Hi!
>
> I assume that you're running in sigle process mode; If not you will have
> crashes calling OpenGL calls in the APP or CULL processes as they do bat
> have a graphics context. So calling glGenTextures (or any other gl*
> call) will only be allowed in the DRAW process.
>
> By calling glGenTextures(1, texture) only the first element (index 0!!!)
> of the texture array is initialized; that means that you must call:
>
> glBindTexture(GL_TEXTURE_2D, texture[0]);
> ^^^ instead of 1!!!
>
> So both the sample code and your own code were wrong...
>
> You might also either call glTexParameteri(GL_TEXTURE_2D,
> GL_TEXTURE_MIN_FILTER, GL_LINEAR); or define all mipmap levels in your
> code! For the default GL_NEAREST_MIPMAP_LINEAR minification filter all
> mipmap levels must be defined (or no texturing is used).
>
>
> Bye! Benedikt
>
>
>
> > Hi..
> >
> > I am student of Sogang Univ. in Seoul, Korea, and my name is Im, Moo
> > Jin...
> >
> > I saw the following reply at Info-Performer Mailing List (2000.10)
> >
> > ------------------------------------------------------------------------------------
> >
> > Hi,
> >
> > did you use glGenTextures to generate the texture name? I did the same
> >
> > thing and it worked out well. Here is what I did (the main idea):
> >
> > Init time:
> > glGenTextures(1, texture)
> >
> > Post Draw time:
> > // copy frame buffer to texture
> > glBindTextureEXT(GL_TEXTURE_2D,texture[1]);
> > glCopyTexSubImage2DEXT(GL_TEXTURE_2D, 0, 0, 0, 0, 0, sizeX, sizeY);
> >
> > // draw textured quad with frame buffer texture
> > pfPushIdentMatrix();
> > pfEnable(PFEN_TEXTURE);
> > glEnable(GL_TEXTURE_2D);
> > glBindTextureEXT(GL_TEXTURE_2D,texture[1]);
> > glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);
> > glBegin(GL_QUADS);
> > glColor4f(1.0f,1.0f,1.0f,1.0f);
> > glTexCoord2f(0.0f,0.0f); glVertex2f(-1.0f,-1.0f);
> > glTexCoord2f(1.0f,0.0f); glVertex2f(1.007f,-1.0f);
> > glTexCoord2f(1.0f,1.0f); glVertex2f(1.007f,1.005f);
> > glTexCoord2f(0.0f,1.0f); glVertex2f(-1.0f,1.005f);
> > glEnd();
> >
> > regards, Sylvain
> >
> > ------------------------------------------------------------------------------------
> >
> > So. I programming refer to this code.
> >
> > I want programming simple 2d texture code using OpenGL.
> >
> > My code is :
> >
> > ------------------------------------------------------------------------------------
> >
> > In Main Function :
> >
> > /* This is from Opengl Programming Guide */
> > glGenTextures(1, texture);
> > for(i=0; i<checkImageHeight; i++) {
> >
> > for(j=0; j<checkImageWidth; j++) {
> > c = ((((i&0x8)==0)^((j&0x8))==0))*255;
> > checkImage[i][j][0] = (GLubyte) c;
> > checkImage[i][j][1] = (GLubyte) c;
> > checkImage[i][j][2] = (GLubyte) c;
> > checkImage[i][j][3] = (GLubyte) 255;
> > }
> > }
> > glBindTextureEXT(GL_TEXTURE_2D, texture[1]);
> > glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, checkImageWidth,
> > checkImageHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE,
> > checkImage);
> >
> > In channelSetup Function :
> >
> > pfChanTravFunc(chan, PFTRAV_DRAW, drawHUD);
> >
> > In drawHUD Function :
> >
> > {
> >
> > pfClearChan(chan);
> > pfDraw();
> >
> > /* post draw */
> > pfPushIdentMatrix();
> > pfEnable(PFEN_TEXTURE);
> > glEnable(GL_TEXTURE_2D);
>
> no need to glEnable(GL_TEXTURE_2D); if pfEnable(PFEN_TEXTURE); is
> already used.
>
>
> > glBindTextureEXT(GL_TEXTURE_2D, texture[1]);
> > glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
> >
> > glBegin(GL_QUADS);
> > glColor4f(1.0, 1.0, 1.0, 1.0);
> > glTexCoord2f(0.0, 0.0); glVertex2f(-1.0f,-1.0f);
> > glTexCoord2f(1.0, 0.0); glVertex2f( 1.0f,-1.0f);
> > glTexCoord2f(1.0, 1.0); glVertex2f( 1.0f, 1.0f);
> > glTexCoord2f(0.0, 1.0); glVertex2f(-1.0f, 1.0f);
> > glEnd();
> > }
> >
> > ------------------------------------------------------------------------------------
> >
> > Please check my code..
> >
> > What is the problem...?
> >
> > Because this problem, I can't proceed my job.
> >
> > Please answer my question.
> >
> > Besides if possible, send me sample texture program code using Opengl.
> >
> >
> >
> > Im, Moo Jin
> >
> > p.s. Sorry, My terrible English..:-)
>
>
> --
> +---------------------------------+----------------------------------+
> |Benedikt J. Kessler | Silicon Graphics GmbH |
> |Professional Services | Am Hochacker 3 - Technopark |
> |SGI | 85630 Grasbrunn-Neukeferloh, FRG |
> | --- __o ,__o | |
> | ------_ \<,_ _-\_<, | Phone: (+49) 89 46108-366 or -0 |
> |----- (*)/ (*) (*)/'(*) | Fax: (+49) 89 46107-366 |
> +---------------------------------+----------------------------------+
> |E-Mail: bjk++at++sgi.com Web (private): http://reality.sgi.com/bjk |
> | Web: http://www.sgi.de/dienstleistungen/ |
> +--------------------------------------------------------------------+
This archive was generated by hypermail 2b29 : Thu Oct 04 2001 - 20:38:08 PDT