Programming Trouble (Microsoft Visual Studio)

Discussion in 'macOS Virtual Machine' started by hamishmcgee, May 3, 2009.

  1. hamishmcgee

    hamishmcgee Bit poster

    Messages:
    3
    Hey, I am just going through my first year of a Computer Games technology course at my university, where I've started to learn to program in C++. For this semester we are learning 2D graphics, which involves OpenGL. In class we use Microsoft Visual Studio, however I have a mac at home. So for this purpose I installed Parallels and one way or another I now have Windows XP on my machine, so I can now do a lot of work at home. I installed Visual Studio, and tried a few test example programs, and they worked fine. I then installed openGL and tried a few simple shape examples and they all worked fine. However, for a project of mine I have to create a very basic cannon game, that involves using bitmaps, but when I tried a very simple example of a program that utilizes bitmaps, I get an error. Although the weird thing (for me, at least) is that the error comes after the program compiles.

    [​IMG]

    It seems quite a simple error, but I have no idea why it does it. I have my .bmp file in with the main.cpp file, so it should be alright. Plus it's an example I downloaded from the university, so all the files should definitely be in the right place. It all works fine on the university computers.

    Here's my code (it's very simple just for the purpose of trying to get this to work):

    Code:
    #include"cBitmapImage.h"
    #include<gl/glut.h>
    
    cBitmapImage *imageLoader;
    int background;
    
    void init()
    {
    	imageLoader = new cBitmapImage;
    	background = imageLoader->loadImageTrans("bg.bmp");
    }
    
    void display()
    {
    	imageLoader->drawImageQuad(background, 0, 0, 512, 512);
    	glutPostRedisplay();
    }
    
    void main()
    {
    	glutInitDisplayMode(GLUT_RGBA | GLUT_SINGLE);
    	glutInitWindowSize(512, 512);
    	glutInitWindowPosition(100, 100);
    	glutCreateWindow("Cannon Game");
    	gluOrtho2D(0, 512, 0, 512);
    	init();
    	glutDisplayFunc(display);
    	glutMainLoop();
    }
    As you can see I use more files (supplied by the university, used for opening and reading bitmaps), but I'm hoping the problem is an easy one to fix, and that I don't have to show you those files. But if necessary, please just say and I'll post those files.
     
  2. hamishmcgee

    hamishmcgee Bit poster

    Messages:
    3
    Sorry to be a pest and double post, but does anyone have any suggestions?
     

Share This Page