Jump to content

  • Log In with Google      Sign In   
  • Create Account

14 years ago on June 15th Gamedev.net was first launched! We want to thank all of you for being part of our community and hope the best years are ahead of us. Happy birthday Gamedev.net!

#Actualwabbz111

Posted 15 October 2012 - 12:03 AM

Sorry about not reporting the errors.
About the missing #includes that is a problem when pasting
but the three libraries iam using are:
#include <GL/freeglut.h>
#include <iostream>
#include <stdio>
Here is the full error list i will try implement your suggestions. Cheers

[source lang="cpp"]shapes.cpp:168: error: expected constructor, destructor, or type conversion before '*' tokenshapes.cpp:168: error: expected `,' or `;' before '*' tokenshapes.cpp:170: error: expected constructor, destructor, or type conversion before '(' tokenshapes.cpp:170: error: expected `,' or `;' before '(' tokenshapes.cpp:174: error: expected unqualified-id before "for"shapes.cpp:174: error: expected `,' or `;' before "for"shapes.cpp:174: error: expected constructor, destructor, or type conversion before '<' tokenshapes.cpp:174: error: expected `,' or `;' before '<' tokenshapes.cpp:174: error: expected constructor, destructor, or type conversion before '++' tokenshapes.cpp:174: error: expected `,' or `;' before '++' tokenshapes.cpp:175: error: expected constructor, destructor, or type conversion before '(' tokenshapes.cpp:175: error: expected `,' or `;' before '(' tokenmake.exe: *** [shapes.o] Error 1Execution terminated[/source]

Here is the source code cube with vertices defined(without the changes reccomended)

[source lang="cpp"]#include <GL/freeglut.h>#include <iostream>#include <stdio>bool fullscreen = false;bool mouseDown = false;float xrot = 0.0f;float yrot = 0.0f;float xdiff = 0.0f;float ydiff = 0.0f;void drawBox(){ glBegin(GL_QUADS); glColor3f(1.0f, 0.0f, 0.0f); // FRONT glVertex3f(-0.5f, -0.5f, 0.5f); glVertex3f( 0.5f, -0.5f, 0.5f); glVertex3f( 0.5f, 0.5f, 0.5f); glVertex3f(-0.5f, 0.5f, 0.5f); // BACK glVertex3f(-0.5f, -0.5f, -0.5f); glVertex3f(-0.5f, 0.5f, -0.5f); glVertex3f( 0.5f, 0.5f, -0.5f); glVertex3f( 0.5f, -0.5f, -0.5f); glColor3f(0.0f, 1.0f, 0.0f); // LEFT glVertex3f(-0.5f, -0.5f, 0.5f); glVertex3f(-0.5f, 0.5f, 0.5f); glVertex3f(-0.5f, 0.5f, -0.5f); glVertex3f(-0.5f, -0.5f, -0.5f); // RIGHT glVertex3f( 0.5f, -0.5f, -0.5f); glVertex3f( 0.5f, 0.5f, -0.5f); glVertex3f( 0.5f, 0.5f, 0.5f); glVertex3f( 0.5f, -0.5f, 0.5f); glColor3f(0.0f, 0.0f, 1.0f); // TOP glVertex3f(-0.5f, 0.5f, 0.5f); glVertex3f( 0.5f, 0.5f, 0.5f); glVertex3f( 0.5f, 0.5f, -0.5f); glVertex3f(-0.5f, 0.5f, -0.5f); // BOTTOM glVertex3f(-0.5f, -0.5f, 0.5f); glVertex3f(-0.5f, -0.5f, -0.5f); glVertex3f( 0.5f, -0.5f, -0.5f); glVertex3f( 0.5f, -0.5f, 0.5f); glEnd();}bool init(){ glClearColor(0.93f, 0.93f, 0.93f, 0.0f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glClearDepth(1.0f); return true;}void display(){ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); gluLookAt( 0.0f, 0.0f, 3.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); glRotatef(xrot, 1.0f, 0.0f, 0.0f); glRotatef(yrot, 0.0f, 1.0f, 0.0f); drawBox(); glFlush(); glutSwapBuffers();}void resize(int w, int h){ glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(0, 0, w, h); gluPerspective(45.0f, 1.0f * w / h, 1.0f, 100.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity();}void idle(){ if (!mouseDown) { xrot += 0.3f; yrot += 0.4f; } glutPostRedisplay();}void keyboard(unsigned char key, int x, int y){ switch(key) { case 27 : exit(1); break; }}void specialKeyboard(int key, int x, int y){ if (key == GLUT_KEY_F1) { fullscreen = !fullscreen; if (fullscreen) glutFullScreen(); else { glutReshapeWindow(500, 500); glutPositionWindow(50, 50); } }}void mouse(int button, int state, int x, int y){ if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) { mouseDown = true; xdiff = x - yrot; ydiff = -y + xrot; } else mouseDown = false;}void mouseMotion(int x, int y){ if (mouseDown) { yrot = x - xdiff; xrot = y + ydiff; glutPostRedisplay(); }}//*///save verticesstruct THeader{int vertlen; //amount of vertices you want to save};struct t3dpoint {float x;float y;float z;};FILE* f = fopen(filename,"wb+");fwrite(&header,sizeof(THeader),1,f);//now you can save them//through all vertices in array for (j=0; j < header.vertlen ; j++) fwrite(&verts[j],sizeof(verts[j]),1,f); //or sizeof t3dpoint (whatever)fclose(f);//*/int main(int argc, char *argv[]){ glutInit(&argc, argv); glutInitWindowPosition(50, 50); glutInitWindowSize(500, 500); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); glutCreateWindow("13 - Solid Shapes"); glutDisplayFunc(display); glutKeyboardFunc(keyboard); glutSpecialFunc(specialKeyboard); glutMouseFunc(mouse); glutMotionFunc(mouseMotion); glutReshapeFunc(resize); glutIdleFunc(idle); if (!init()) return 1; glutMainLoop(); return 0;}[/source]

#3wabbz111

Posted 15 October 2012 - 12:01 AM

Sorry about not reporting the errors.
About the missing #includes that is a problem when pasting it is not displaying the libraries
Here is the full error list i will try implement your suggestions. Cheers

[source lang="cpp"]shapes.cpp:168: error: expected constructor, destructor, or type conversion before '*' tokenshapes.cpp:168: error: expected `,' or `;' before '*' tokenshapes.cpp:170: error: expected constructor, destructor, or type conversion before '(' tokenshapes.cpp:170: error: expected `,' or `;' before '(' tokenshapes.cpp:174: error: expected unqualified-id before "for"shapes.cpp:174: error: expected `,' or `;' before "for"shapes.cpp:174: error: expected constructor, destructor, or type conversion before '<' tokenshapes.cpp:174: error: expected `,' or `;' before '<' tokenshapes.cpp:174: error: expected constructor, destructor, or type conversion before '++' tokenshapes.cpp:174: error: expected `,' or `;' before '++' tokenshapes.cpp:175: error: expected constructor, destructor, or type conversion before '(' tokenshapes.cpp:175: error: expected `,' or `;' before '(' tokenmake.exe: *** [shapes.o] Error 1Execution terminated[/source]

Here is the source code cube with vertices defined(without the changes reccomended)

[source lang="cpp"]#include <GL/freeglut.h>#include <iostream>#include <stdio>bool fullscreen = false;bool mouseDown = false;float xrot = 0.0f;float yrot = 0.0f;float xdiff = 0.0f;float ydiff = 0.0f;void drawBox(){ glBegin(GL_QUADS); glColor3f(1.0f, 0.0f, 0.0f); // FRONT glVertex3f(-0.5f, -0.5f, 0.5f); glVertex3f( 0.5f, -0.5f, 0.5f); glVertex3f( 0.5f, 0.5f, 0.5f); glVertex3f(-0.5f, 0.5f, 0.5f); // BACK glVertex3f(-0.5f, -0.5f, -0.5f); glVertex3f(-0.5f, 0.5f, -0.5f); glVertex3f( 0.5f, 0.5f, -0.5f); glVertex3f( 0.5f, -0.5f, -0.5f); glColor3f(0.0f, 1.0f, 0.0f); // LEFT glVertex3f(-0.5f, -0.5f, 0.5f); glVertex3f(-0.5f, 0.5f, 0.5f); glVertex3f(-0.5f, 0.5f, -0.5f); glVertex3f(-0.5f, -0.5f, -0.5f); // RIGHT glVertex3f( 0.5f, -0.5f, -0.5f); glVertex3f( 0.5f, 0.5f, -0.5f); glVertex3f( 0.5f, 0.5f, 0.5f); glVertex3f( 0.5f, -0.5f, 0.5f); glColor3f(0.0f, 0.0f, 1.0f); // TOP glVertex3f(-0.5f, 0.5f, 0.5f); glVertex3f( 0.5f, 0.5f, 0.5f); glVertex3f( 0.5f, 0.5f, -0.5f); glVertex3f(-0.5f, 0.5f, -0.5f); // BOTTOM glVertex3f(-0.5f, -0.5f, 0.5f); glVertex3f(-0.5f, -0.5f, -0.5f); glVertex3f( 0.5f, -0.5f, -0.5f); glVertex3f( 0.5f, -0.5f, 0.5f); glEnd();}bool init(){ glClearColor(0.93f, 0.93f, 0.93f, 0.0f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glClearDepth(1.0f); return true;}void display(){ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); gluLookAt( 0.0f, 0.0f, 3.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); glRotatef(xrot, 1.0f, 0.0f, 0.0f); glRotatef(yrot, 0.0f, 1.0f, 0.0f); drawBox(); glFlush(); glutSwapBuffers();}void resize(int w, int h){ glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(0, 0, w, h); gluPerspective(45.0f, 1.0f * w / h, 1.0f, 100.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity();}void idle(){ if (!mouseDown) { xrot += 0.3f; yrot += 0.4f; } glutPostRedisplay();}void keyboard(unsigned char key, int x, int y){ switch(key) { case 27 : exit(1); break; }}void specialKeyboard(int key, int x, int y){ if (key == GLUT_KEY_F1) { fullscreen = !fullscreen; if (fullscreen) glutFullScreen(); else { glutReshapeWindow(500, 500); glutPositionWindow(50, 50); } }}void mouse(int button, int state, int x, int y){ if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) { mouseDown = true; xdiff = x - yrot; ydiff = -y + xrot; } else mouseDown = false;}void mouseMotion(int x, int y){ if (mouseDown) { yrot = x - xdiff; xrot = y + ydiff; glutPostRedisplay(); }}//*///save verticesstruct THeader{int vertlen; //amount of vertices you want to save};struct t3dpoint {float x;float y;float z;};FILE* f = fopen(filename,"wb+");fwrite(&header,sizeof(THeader),1,f);//now you can save them//through all vertices in array for (j=0; j < header.vertlen ; j++) fwrite(&verts[j],sizeof(verts[j]),1,f); //or sizeof t3dpoint (whatever)fclose(f);//*/int main(int argc, char *argv[]){ glutInit(&argc, argv); glutInitWindowPosition(50, 50); glutInitWindowSize(500, 500); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); glutCreateWindow("13 - Solid Shapes"); glutDisplayFunc(display); glutKeyboardFunc(keyboard); glutSpecialFunc(specialKeyboard); glutMouseFunc(mouse); glutMotionFunc(mouseMotion); glutReshapeFunc(resize); glutIdleFunc(idle); if (!init()) return 1; glutMainLoop(); return 0;}[/source]

#2wabbz111

Posted 14 October 2012 - 11:56 PM

Sorry about not reporting the errors.
Here is the full error list i will try implement your suggestions. Cheers
[source lang="cpp"]shapes.cpp:168: error: expected constructor, destructor, or type conversion before '*' tokenshapes.cpp:168: error: expected `,' or `;' before '*' tokenshapes.cpp:170: error: expected constructor, destructor, or type conversion before '(' tokenshapes.cpp:170: error: expected `,' or `;' before '(' tokenshapes.cpp:174: error: expected unqualified-id before "for"shapes.cpp:174: error: expected `,' or `;' before "for"shapes.cpp:174: error: expected constructor, destructor, or type conversion before '<' tokenshapes.cpp:174: error: expected `,' or `;' before '<' tokenshapes.cpp:174: error: expected constructor, destructor, or type conversion before '++' tokenshapes.cpp:174: error: expected `,' or `;' before '++' tokenshapes.cpp:175: error: expected constructor, destructor, or type conversion before '(' tokenshapes.cpp:175: error: expected `,' or `;' before '(' tokenmake.exe: *** [shapes.o] Error 1Execution terminated[/source]

Here is the source code cube with vertices defined(without the changes reccomended)

[source lang="cpp"]#include <GL/freeglut.h>bool fullscreen = false;bool mouseDown = false;float xrot = 0.0f;float yrot = 0.0f;float xdiff = 0.0f;float ydiff = 0.0f;void drawBox(){ glBegin(GL_QUADS); glColor3f(1.0f, 0.0f, 0.0f); // FRONT glVertex3f(-0.5f, -0.5f, 0.5f); glVertex3f( 0.5f, -0.5f, 0.5f); glVertex3f( 0.5f, 0.5f, 0.5f); glVertex3f(-0.5f, 0.5f, 0.5f); // BACK glVertex3f(-0.5f, -0.5f, -0.5f); glVertex3f(-0.5f, 0.5f, -0.5f); glVertex3f( 0.5f, 0.5f, -0.5f); glVertex3f( 0.5f, -0.5f, -0.5f); glColor3f(0.0f, 1.0f, 0.0f); // LEFT glVertex3f(-0.5f, -0.5f, 0.5f); glVertex3f(-0.5f, 0.5f, 0.5f); glVertex3f(-0.5f, 0.5f, -0.5f); glVertex3f(-0.5f, -0.5f, -0.5f); // RIGHT glVertex3f( 0.5f, -0.5f, -0.5f); glVertex3f( 0.5f, 0.5f, -0.5f); glVertex3f( 0.5f, 0.5f, 0.5f); glVertex3f( 0.5f, -0.5f, 0.5f); glColor3f(0.0f, 0.0f, 1.0f); // TOP glVertex3f(-0.5f, 0.5f, 0.5f); glVertex3f( 0.5f, 0.5f, 0.5f); glVertex3f( 0.5f, 0.5f, -0.5f); glVertex3f(-0.5f, 0.5f, -0.5f); // BOTTOM glVertex3f(-0.5f, -0.5f, 0.5f); glVertex3f(-0.5f, -0.5f, -0.5f); glVertex3f( 0.5f, -0.5f, -0.5f); glVertex3f( 0.5f, -0.5f, 0.5f); glEnd();}bool init(){ glClearColor(0.93f, 0.93f, 0.93f, 0.0f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glClearDepth(1.0f); return true;}void display(){ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); gluLookAt( 0.0f, 0.0f, 3.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); glRotatef(xrot, 1.0f, 0.0f, 0.0f); glRotatef(yrot, 0.0f, 1.0f, 0.0f); drawBox(); glFlush(); glutSwapBuffers();}void resize(int w, int h){ glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(0, 0, w, h); gluPerspective(45.0f, 1.0f * w / h, 1.0f, 100.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity();}void idle(){ if (!mouseDown) { xrot += 0.3f; yrot += 0.4f; } glutPostRedisplay();}void keyboard(unsigned char key, int x, int y){ switch(key) { case 27 : exit(1); break; }}void specialKeyboard(int key, int x, int y){ if (key == GLUT_KEY_F1) { fullscreen = !fullscreen; if (fullscreen) glutFullScreen(); else { glutReshapeWindow(500, 500); glutPositionWindow(50, 50); } }}void mouse(int button, int state, int x, int y){ if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) { mouseDown = true; xdiff = x - yrot; ydiff = -y + xrot; } else mouseDown = false;}void mouseMotion(int x, int y){ if (mouseDown) { yrot = x - xdiff; xrot = y + ydiff; glutPostRedisplay(); }}//*///save verticesstruct THeader{int vertlen; //amount of vertices you want to save};struct t3dpoint {float x;float y;float z;};FILE* f = fopen(filename,"wb+");fwrite(&header,sizeof(THeader),1,f);//now you can save them//through all vertices in array for (j=0; j < header.vertlen ; j++) fwrite(&verts[j],sizeof(verts[j]),1,f); //or sizeof t3dpoint (whatever)fclose(f);//*/int main(int argc, char *argv[]){ glutInit(&argc, argv); glutInitWindowPosition(50, 50); glutInitWindowSize(500, 500); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); glutCreateWindow("13 - Solid Shapes"); glutDisplayFunc(display); glutKeyboardFunc(keyboard); glutSpecialFunc(specialKeyboard); glutMouseFunc(mouse); glutMotionFunc(mouseMotion); glutReshapeFunc(resize); glutIdleFunc(idle); if (!init()) return 1; glutMainLoop(); return 0;}[/source]

#1wabbz111

Posted 14 October 2012 - 11:50 PM

Sorry about not reporting the errors.
Here is the full error list i will try implement your suggestions. Cheers
[source lang="cpp"]shapes.cpp:168: error: expected constructor, destructor, or type conversion before '*' tokenshapes.cpp:168: error: expected `,' or `;' before '*' tokenshapes.cpp:170: error: expected constructor, destructor, or type conversion before '(' tokenshapes.cpp:170: error: expected `,' or `;' before '(' tokenshapes.cpp:174: error: expected unqualified-id before "for"shapes.cpp:174: error: expected `,' or `;' before "for"shapes.cpp:174: error: expected constructor, destructor, or type conversion before '<' tokenshapes.cpp:174: error: expected `,' or `;' before '<' tokenshapes.cpp:174: error: expected constructor, destructor, or type conversion before '++' tokenshapes.cpp:174: error: expected `,' or `;' before '++' tokenshapes.cpp:175: error: expected constructor, destructor, or type conversion before '(' tokenshapes.cpp:175: error: expected `,' or `;' before '(' tokenmake.exe: *** [shapes.o] Error 1Execution terminated[/source]

PARTNERS