Need help in texturing

i am new to opengl i need some help regarding texturing i am writing code to build periodic table using quads in opengl but i want to add text in the quad using texturing but i do not have any knowledge regarding this. below is the code


void glutdisplay(void)
{
    
    glPushMatrix();
    /*glColor3f(1, 0, 0);
    glScalef(0.7,0.7,0.1);
    glTranslatef(0,0,0);*/
    glBegin(GL_QUADS);
    //glColor3f(0, 0, 0
    //Main Quad
    glVertex3f(-0.8, -0.8, 0);
    glVertex3f(-0.8, 0.8, 0);
    glVertex3f(0.8, 0.8, 0);
    glVertex3f(0.8, -0.8, 0);

    //First 
    glColor3f(1, 0, 0);
    glVertex3f(-0.8, -0.8, 0);
    glVertex3f(-0.7, -0.8, 0);
    glVertex3f(-0.7, -0.65, 0);
    glVertex3f(-0.8, -0.65, 0);

    //second
    glColor3f(0, 0.7, 0);
    glVertex3f(-0.8, -0.65, 0);
    glVertex3f(-0.7, -0.65, 0);
    glVertex3f(-0.7, -0.5, 0);
    glVertex3f(-0.8, -0.5, 0);

    //third
    glColor3f(0, 0, 0.5);
    glVertex3f(-0.8, -0.5, 0);
    glVertex3f(-0.7, -0.5, 0);
    glVertex3f(-0.7, -0.35, 0);
    glVertex3f(-0.8, -0.35, 0);

    //forth
    glColor3f(0, 0.5, 0);
    glVertex3f(-0.8, -0.35, 0);
    glVertex3f(-0.7, -0.35, 0);
    glVertex3f(-0.7, -0.2, 0);
    glVertex3f(-0.8, -0.2, 0);

    //fifth
    /*glColor3f(0, 0, 0.5);
    glVertex3f(-0.8, -0.2, 0);
    glVertex3f(-0.7, -0.2, 0);
    glVertex3f(-0.7, -0.30, 0);
    glVertex3f(-0.8, -0.30, 0);*/
    
    
    
    
    
    
    
    

    /*glColor3f(1, 0, 0);
    glVertex3f(0, 0, 0);
    glVertex3f(0.1, 0, 0);
    glVertex3f(0, 0.2, 0);
    glVertex3f(0.1, 0.2, 0);
  */


    glEnd();
    glFlush();
    glPopMatrix();
    glutSwapBuffers();
}

int main (int argc, char *argv[])
{

glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
glutInitWindowSize(1400, 800);
glutCreateWindow("Beaker1");
glutDisplayFunc(glutdisplay);
glutMainLoop();
return 0;
}

Please use [noparse]

..

or

...

[/noparse] blocks to mark code sections as it makes them more readable. I’ve added this for you.

If you’re comfortable using old OpenGL, then you’re on the right track. Get the OpenGL Programming Guide and do some reading, and/or read some OpenGL tutorials. If you have any specific questions, please post them here.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.