I'm working on a large project that was initially developed on an OSX machine but is now being ported to windows. I expected some degree of difficulty in porting the code, but I solved all issues pertaining to problematic includes and have already made sure to include the proper OpenGL libraries.
My current issue is that, for example, with the following code segment which should display a Quad that takes up most of the screen displays nothing, or, rather, it displays the clearing color (blue or green) but never the quad. Peculiarly, this same code works on my OSX machine.
As it stands, my best guess is that I've made some mistake with my includes or I missed something important to setting up OpenGL in Allegro that I didn't have to do on my OSX machine.
Also important: I know now that Allegro includes primitives that I should've been using from the get-go, but I wanted to use OpenGL for a variety of reasons and so, at the moment, switching to Allegro primitives is not a preferred option.
Any ideas as to what is going wrong would be appreciated.
Allegro and OpenGL each have their own transformations. Allegro uses OpenGL's under the hood, but doesn't respect OpenGL transformations you set yourself.
In your 'init' function you're not setting an identity matrix for the MODELVIEW matrix. Also, just try to draw one thing once and see if it works or not.
Mixing Allegro and OpenGL does work, but has some problems when you change global GL state that one or the other was expecting.
This simple example should show you how to draw your Quad with OpenGL :
Basically, any time you draw with allegro, you reset the target bitmap, which resets opengl state. Any time you want to draw with opengl, you need to reset the state yourself.
Thank you so much, Wonderful explanation. That fixes the problem and provides me a nice example to look back on. Thanks Again!
I had a similar problem just recently with mixing Allegro and OpenGL. Take a look at this thread for the details.
I managed to get a colored textured spinning cube drawn. Here's how I did it :
Download src + win32 binary here
{"name":"611190","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/a\/6aab5988fe9697b0f23d12cce0e2da92.png","w":802,"h":641,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/a\/6aab5988fe9697b0f23d12cce0e2da92"}