Hello I’m just trying to create a cube in OpenGL and I’m having issues turning the side part of the cube to the actual side.
what I mean is the vertex for the “Ideal left side of a cube” is not turned to 100 or 200 on the x axis it is stuck at 0 and even when I use glRotatef(1,0,100,0); to rotate the hole “Ideal left side of a cube” vertex it doesn’t rotate it correctly when I run the program.
here is the code I’m working on currently not the full code but enough to give you an idea
I’m using OpenGL 3.3 and SDL 1.2
glPushMatrix();
//Texture Variable
GLuint cubefront;
// Have OpenGL generate a texture object handle for us
glGenTextures( 1, &cubefront );
// Bind the texture object
glBindTexture( GL_TEXTURE_2D, cubefront );
// Set the texture's stretching properties
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB,FrontBoxSurf->w, FrontBoxSurf->h, 0,
GL_RGBA, GL_UNSIGNED_BYTE, FrontBoxSurf->pixels );
//Top File Menu
glEnable( GL_TEXTURE_2D );
glBegin(GL_QUADS);
//Front Side
//Top Left
glTexCoord2i( 0, 0 );
glVertex2f(300, 880);
cout << "first part" << endl;
//Top right
glTexCoord2i( 1, 0 );
glVertex2f(380,880);
cout << "second part" << endl;
//Bottom right
glTexCoord2i( 1, 1 );
glVertex2f(380, 820);
cout << "third part" << endl;
//Bottom Left
glTexCoord2i( 0, 1 );
glVertex2f(300, 820);
cout << "fourth part" << endl;
glPopMatrix();
//Left Side
glPushMatrix() ;
//Top Left
glTexCoord2i( 0, 0 );
glVertex2f(100, 860);
cout << "first part" << endl;
//Top right
glTexCoord2i( 1, 0 );
glVertex2f(180,860);
cout << "second part" << endl;
//Bottom right
glTexCoord2i( 1, 1 );
glVertex2f(180, 810);
cout << "third part" << endl;
//Bottom Left
glTexCoord2i( 0, 1 );
glVertex2f(100, 810);
cout << "fourth part" << endl;
glEnd();
glPopMatrix();
//Rotate Right
if(keystate[SDLK_RIGHT])
{
glRotatef(1, 0, 20, 0);
cout << "Moving Right" << endl;
}
//Rotate Left
if(keystate[SDLK_LEFT])
{
glRotatef(1, 0, -20, 0);
cout << "Moving Left" << endl;
}
If you have any ideas or tips or suggestions please do say :D.