I am using Allegro 5.1.8 with Msys2. I am trying to combine OpenGL and Allegro drawing, using Allegro routines to draw 2D elements in front of the 3D scene.
Well, so far so good, I get it drawing all right but I am getting stuck on Backface culling.
I have allegro drawing a bitmap mousepointer on top of my 3D scene (a spinning cube). I am using a single al_flip_display(), in this fashion:
setupGLstuff();
while(1)
{
drawGLstuff();
restoreALdrawing();
drawALstuff();
al_flip_display();
}
I can either have no backface culling, and my 2D overlay works, or I can have backfaceculling, and my 2D overlay disappears.
Anyone knows the best way to get this to work?
I was thinking maybe rendering 3D to a bitmap, and then disabling backface culling again, and rendering the 2D on top of that bitmap before showing it but maybe there is a better way?
]]>I think you want to disable culling before drawing using allegro.
I'm doing that in my current project.
{"name":"3FAegCS.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/b\/fbcf87028635f4dda63ab2ea7c1bcb93.png","w":806,"h":627,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/b\/fbcf87028635f4dda63ab2ea7c1bcb93"}
]]>I am trying too.
No luck, for instance, if I change the above scenario to this:
setupGLstuff();
while(1)
{
drawGLstuff();
restoreALdrawing();
glDisable(GL_CULL_FACE);
drawALstuff();
al_flip_display();
}
Allegro drawing works, but the GL stuff gets drawn without culling as well.
[Edit:]
Hold on, I just think I realized how truly retarded I should feel right now. Let me test something.
]]>This is basically my code:
]]>
Ok, you are all allowed to mock me relentlessly .
I thought something looked a little of with my description there. The thing is...
setupGLstuff();
while(1)
{
setupGLstuffFrame(); <------------ Was missing
drawGLstuff();
restoreALdrawing();
drawALstuff();
al_flip_display();
}
No matter what I put in there, of course it won't work when it doesn't even gets called. Realized just now when I was reading these posts
It works now anyway, I have to reenable the culling for the GL and that was in the part that didn't get called
]]>