Texture Problem using Opengl in Performer

New Message Reply Date view Thread view Subject view Author view

From: ÀÓ¹«Á (yamoo++at++grmanet.sogang.ac.kr)
Date: 10/03/2001 01:55:23


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);
 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..:-)











New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Oct 03 2001 - 01:56:30 PDT

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