How to make interactive Texture Change?
I've been following the Nehe Tutorial. But can't seem to find one that enabled the user to change the texture by choice. I want to execute it like this: 1.User input which choice 2.OpenGL attach the texture based on the choice to the quad. What line of code should i write to enable my program to take the user input? Any example i can look at?
From the depth of the Net, I am PhoenixByte...
Something like this should work:
Where key is an array of booleans or something, like how its done in NeHe's tuts.
GLuint texture[2];int tex = 0;...if (key['a']){ tex = 0;} else if (key['s']){ tex = 1;}glBindTexture(GL_TEXTURE_2D, texture[tex]);glBegin(GL_QUADS); glTexCorrd2f(0.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 0.0f); glTexCorrd2f(1.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 0.0f); glTexCorrd2f(1.0f, 1.0f); glVertex3f( 1.0f,-1.0f, 0.0f); glTexCorrd2f(0.0f, 1.0f); glVertex3f(-1.0f,-1.0f, 0.0f);glEnd();
Where key is an array of booleans or something, like how its done in NeHe's tuts.
By stating KEY=A means the keyboard key A is pressed? Am I right or wrong in this one?
What if I want write the message for the user to input the letter 'A' and the program takes it. How do I display the request message?
If in usual C++ Code, we would use cin for reading and cout for writing the message. How do we do that in an OpenGL environment? I've tried using cin and cout before but the prog just straight forwardly rendered the openGL object without displaying the mesage and reading the input.
Thanks.
What if I want write the message for the user to input the letter 'A' and the program takes it. How do I display the request message?
If in usual C++ Code, we would use cin for reading and cout for writing the message. How do we do that in an OpenGL environment? I've tried using cin and cout before but the prog just straight forwardly rendered the openGL object without displaying the mesage and reading the input.
Thanks.
From the depth of the Net, I am PhoenixByte...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement