943,948 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 531
  • C++ RSS
Jul 29th, 2009
0

AllegroGL error at set_gfx_mode()

Expand Post »
I just added the allegro and allegroGL packages to my DEV C++ compiler. But I have an error with the set_gfx_mode funtion. I have written this :
#include <allegro.h>
#include <alleggl.h>

int main() {
if (allegro_init() != 0) {
    return 1;
}
if (install_allegro_gl() != 0) {
    return 1;
}

install_keyboard();
install_timer();

allegro_gl_set(AGL_DOUBLEBUFFER, 1);
allegro_gl_set(AGL_WINDOWED, TRUE);
allegro_gl_set(AGL_COLOR_DEPTH, 32);
allegro_gl_set(AGL_SUGGEST, AGL_DOUBLEBUFFER | AGL_WINDOWED | AGL_COLOR_DEPTH);
if(set_gfx_mode(GFX_OPENGL, 640,340, 0, 0)) {
      allegro_message ("Error setting OpenGL graphics  mode:\n%s\n"
      "Allegro GL error : %s\n",
      allegro_error, allegro_gl_error);
      exit(0);
}

allegro_gl_set_allegro_mode();

textout_ex(screen, font, "Hello World!", 50, 100, makecol(255, 0, 0), -1);

allegro_gl_unset_allegro_mode();

allegro_gl_flip();
readkey();

return 0;
}
END_OF_MAIN()

At the the bolded line in the code I get a runtime error : "The instructuin at "0x00000000" referenced memory at "0x00000000". The memory could not be "read"."

What's the problem? And how to solve it?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Nickyu0712 is offline Offline
7 posts
since Nov 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Hi buddies.......
Next Thread in C++ Forum Timeline: Array in class





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC