Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Graphics > OpenGL 3D API > A weird problem...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 4778 of 5017
Post > Topic >>

A weird problem about automatic text-coordinate generation

by Neumann <gshy2014@[EMAIL PROTECTED] > Jun 3, 2008 at 08:44 AM

The following code can produce desired output:
     glBegin(GL_QUADS);
 
glTexCoord3f(0,0,1);glVertex4f(-0.5,-0.5,0.5,1.0);
	    glTexCoord3f(0,1.0,1);glVertex4f(0.5,-0.5,0.5,1.0);
                    glTexCoord3f(1.0,1.0,1);glVertex4f(0.5,0.5,
0.5,1.0);
	    glTexCoord3f(1.0,0,1);glVertex4f(-0.5,0.5,0.5,1.0);
      glEnd();
But If I replace it by the following segment using automatic text-
coordinate generation, it does not work:


  static GLfloat sCoeff[] = {0.0, 1.0, 0.0, 0.5};
  static GLfloat tCoeff[] = {1.0, 0.0, 0.0, 0.5};
   static GLfloat rCoeff[] = {0.0, 0.0, 1.0, 0.5};
   glEnable(GL_TEXTURE_GEN_S);
   glEnable(GL_TEXTURE_GEN_T);
   glEnable(GL_TEXTURE_GEN_R);
   glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
   glTexGenfv(GL_S, GL_OBJECT_PLANE, sCoeff);
   glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
   glTexGenfv(GL_T, GL_OBJECT_PLANE, tCoeff);
   glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
   glTexGenfv(GL_R, GL_OBJECT_PLANE, rCoeff);
   glBegin(GL_QUADS);
        glVertex4f(-0.5,-0.5,0.5,1.0);
        glVertex4f(0.5,-0.5,0.5,1.0);
        glVertex4f(0.5,0.5, 0.5,1.0);
        glVertex4f(-0.5,0.5,0.5,1.0);
  glEnd();

But for the four vertex of the quad, their texture coordinate is
exactly the same as the first segment! What is the problem? Thank you.
 




 1 Posts in Topic:
A weird problem about automatic text-coordinate generation
Neumann <gshy2014@[EMA  2008-06-03 08:44:48 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 6:43:01 CST 2008.