geoteam

Member
  • Content count

    4
  • Joined

  • Last visited

Community Reputation

113 Neutral

About geoteam

  • Rank
    Newbie
  1. getting better at c++

    I want to get better at coding. I code in c++ and I know the language well but i need a tutorial or something that will help me get better at programming, (not the actual language but at programming part). any help would be greatly appreciated. 
  2. Deleteing inside a list using iterators

    Thanks you guys it works fine now
  3. I need help, when i am looping through my list using iterators i need them delete themselves when they leave the screen my code is for(salvoit = salvo.begin(); salvoit != salvo.end(); ) { if((*salvoit)->x < 0 || (*salvoit)->x > 640) { delete (&salvoit); salvoit = salvo.erase(salvoit); } else { salvoit++; } }   whenever i run this it gives me an error when it tries to delete the object in the list. salvo is the list and salvoit is the iterator.
  4. i have a problem where whenever u move the camera all the object on screen disappear here is my code class camera { public: GLfloat eye[3]; GLfloat up[3]; GLfloat side[3]; GLfloat look[3]; GLfloat matrix[3][3]; GLfloat vertMatrix[3]; GLfloat tmpMatrix[3]; camera() { // Camera Position eye[0] = 0.0f; eye[1] = 0.0f; eye[2] = 0.0f; up[0] = 0.0f; up[1] = 1.0f; up[2] = 0.0f; side[0] = 1.0f; side[1] = 0.0f; side[2] = 0.0f; look[0] = 0.0f; look[1] = 0.0f; look[2] = -1.0f; matrix = { {side[0] - eye[0], up[0] - eye[0], look[0] - eye[0]}, {side[1] - eye[1], up[1] - eye[1], look[1] - eye[1]}, {side[2] - eye[2], up[2] - eye[2], look[2] - eye[2]}}; }; void updatePosi() { glLoadIdentity();// Update the camera gluLookAt( eye[0], eye[1], eye[2], look[0], look[1], look[2], up[0] - eye[0], up[1] - eye[1], up[2] - eye[2]); } void translatePosi(GLfloat x1, GLfloat y1, GLfloat z1) { matrix = { {side[0] - eye[0], up[0] - eye[0], look[0] - eye[0]}, {side[1] - eye[1], up[1] - eye[1], look[1] - eye[1]}, {side[2] - eye[2], up[2] - eye[2], look[2] - eye[2]} }; vertMatrix = { x1, y1, -z1}; tmpMatrix = {matrix[0][0] * vertMatrix[0] + matrix[0][1]* vertMatrix[0] + matrix[0][2]* vertMatrix[0], matrix[1][0] * vertMatrix[1] + matrix[1][1]* vertMatrix[1] + matrix[1][2]* vertMatrix[1], matrix[2][0] * vertMatrix[2] + matrix[2][1]* vertMatrix[2] + matrix[2][2]* vertMatrix[2]}; eye[0] += tmpMatrix[0]; eye[1] += tmpMatrix[1]; eye[2] += tmpMatrix[2]; up[0] += tmpMatrix[0]; up[1] += tmpMatrix[1]; up[2] += tmpMatrix[2]; side[0] += tmpMatrix[0]; side[1] += tmpMatrix[1]; side[2] += tmpMatrix[2]; look[0] += tmpMatrix[0]; look[1] += tmpMatrix[1]; look[2] += tmpMatrix[2]; } }; void display() { glClearColor( 0.0, 0.0f, 0.0, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); keymanage(); glLoadIdentity(); cam.updatePosi(); enable(); glutSolidCube(0.25f); glutSwapBuffers(); } int main(int argc, char **args) { glutInit(&argc, args); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowSize(500, 500); glutInitWindowPosition(100, 100); glutCreateWindow("opengl mycode"); init(); glutDisplayFunc(display); glutIdleFunc(display); glutReshapeFunc(reshape); glutKeyboardFunc(keyDown); glutKeyboardUpFunc(keyUp); glutMainLoop(); return 0; }   i 'm am very new to opengl so any help would be appreciated.