Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » AllegroGL help

This thread is locked; no one can reply to it. rss feed Print
 1   2   3 
AllegroGL help
Richard Phipps
Member #1,632
November 2001
avatar

Do it soon before this thread disappears. ;)

Paladin
Member #6,645
December 2005
avatar

Ok so sorry to sound stupid, but what files am I dealing with exactly? I looked in the lib folder and all the folders are empty except for a delete.me file. I moved the header files if I recall, but it didn't seem to do anything. :-/

EDIT: Nevermind, I did a new project and it turns out I did install it. But unfortunately it still crashes.

Richard Phipps
Member #1,632
November 2001
avatar

What alegroGL version string does your project now print out?

Bob
Free Market Evangelist
September 2000
avatar

Ok, first, let's get your AGL version as reported by AGL itself. Then, I'll have to ask you to track down where AGL crashes. There might be an AGL bug that only manifests itself on your system. Most of us don't have Intel Integrated Graphics so it's difficult to debug this issue without your help.

Thanks!

--
- Bob
[ -- All my signature links are 404 -- ]

Paladin
Member #6,645
December 2005
avatar

Ok I have this code

1#include <allegro.h>
2#include <alleggl.h>
3 
4int main() {
5
6 /* Initialize both Allegro and AllegroGL */
7 allegro_init();
8 install_allegro_gl();
9
10 allegro_message("Installed allegro and allegro GL");
11 allegro_message("%s", AGL_VERSION_STR);
12
13 /* Tell Allegro we want to use the keyboard */
14 install_keyboard();
15 
16 allegro_message("Keyboard installed");
17 
18 /* Suggest a good screen mode for OpenGL */
19 allegro_gl_set(AGL_Z_DEPTH, 8);
20 allegro_gl_set(AGL_COLOR_DEPTH, 16);
21 allegro_gl_set(AGL_SUGGEST, AGL_Z_DEPTH | AGL_COLOR_DEPTH);
22
23 allegro_message("Suggested color depths");
24 
25 /* Set the graphics mode */
26 set_gfx_mode(GFX_OPENGL_WINDOWED, 640, 480, 0, 0);
27
28 allegro_message("Graphics mode set.");
29
30 /* Clear the screen */
31 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
32 
33 allegro_message("Cleared buffer");
34 
35 /* Set up the view frustum */
36 glMatrixMode(GL_MODELVIEW);
37 glLoadIdentity();
38 glFrustum(-1.0, 1.0, -1.0, 1.0, 1, 60.0);
39 
40 /* Draw a quad using OpenGL */
41 glBegin(GL_QUADS);
42 glColor3ub(255, 255, 255);
43 glVertex3f(-1, -1, -2);
44 glVertex3f( 1, -1, -2);
45 glVertex3f( 1, 1, -2);
46 glVertex3f(-1, 1, -2);
47 glEnd();
48
49 /* Flip the backbuffer on screen */
50 allegro_gl_flip();
51
52 /* Wait for the user to press a key */
53 readkey();
54
55 /* Finished. */
56 return 0;
57}
58END_OF_MAIN();

It returns the version as "0.4.0 RC4" and the code gets to

allegro_message("Suggested color depths");

then it crashes.

Bob
Free Market Evangelist
September 2000
avatar

Quote:

he code gets to allegro_message("Suggested color depths"); then it crashes.

Can you step in AllegroGL's win.c, function allegro_gl_win_init() and see where it crashes there?

--
- Bob
[ -- All my signature links are 404 -- ]

Paladin
Member #6,645
December 2005
avatar

What do you mean? Do you mean use that function in my code? I'm a little confused on the subject.

Bob
Free Market Evangelist
September 2000
avatar

No. I mean use a debugger (or lots of printfs, whichever you prefer) and try to figure out where is AGL crashing.

--
- Bob
[ -- All my signature links are 404 -- ]

Richard Phipps
Member #1,632
November 2001
avatar

Ok, if you are new to debugging then do this:

Add some printf("1"); printf("2"), etc.. to different lines in the allegro_gl_win_init() function that Bob describes. Recompile the AllegroGL lib and reinstall it. Run your program and make it open a console window (should be done normally, as one of the compile flags removes it) and see what number it gets upto in the console window.

That should help narrow it down so it can be fixed.

Paladin
Member #6,645
December 2005
avatar

So what do I need to include in the parameters to recompile allegrogl? Guys, I'm really sorry that I'm slow, I'm just new to all of this.

Richard Phipps
Member #1,632
November 2001
avatar

Just do what you did before.. For mingw: fix mingw32, make and then make install. :)

EDIT: Come on Brian. If you figure it out if will help you and other people trying to run AllegroGL / Openlayer games. :)

Michael Austin
Member #7,608
August 2006

I will finish debugging this tomorrow, but for now here are the offending lines (from win.c):

  if (allegro_gl_extensions_GL.ARB_multisample) {
    glSampleCoverageARB(1.0, GL_FALSE);
  }

Apparently, the variable allegro_gl_extensions_GL suggests that the Intel 915series chipset is capable of handling this Open GL extension, but it is not. I suspect that the extensions are being parsed improperly, but I ran out of time to verify this today.

Tomorrow, I will try to find out the root of the problem, but for now, if you comment out the lines I copied above, you can at least get allegrogl to run.

Michael Austin

Bob
Free Market Evangelist
September 2000
avatar

Thank you for your help!

--
- Bob
[ -- All my signature links are 404 -- ]

Richard Phipps
Member #1,632
November 2001
avatar

Thank you too! I hope we can find the problem and fix it so AllegroGL can work on these chipsets. :)

EDIT: I found this snippet of code for X at : http://www.ks.uiuc.edu/Research/vmd/doxygen/OpenGLDisplayDevice_8C-source.html

00058 // determine if all of the ARB multisample extension routines are available
00059 #if defined(GL_ARB_multisample) && defined(GLX_SAMPLES_ARB) && defined(GLX_SAMPLE_BUFFERS_ARB)
00060 #define USEARBMULTISAMPLE 1
00061 #endif

Does this mean we need GLX extensions as well to use it for some chipsets?

And this link might be useful:
http://oss.sgi.com/projects/ogl-sample/registry/ARB/multisample.txt

You probably know this already though.. :)

Hope you can fix this one!

Koiu Lpoi
Member #7,607
August 2006

I just ran into this little problem myself when sending a binary to a friend of mine on a laptop with the 915m chipset. I think we may have to put another branching point to detect this particular chipset, or we need to contact intel, as This piece of software crashed in a similar way on the test "Static VAO".

Hope that helps!

Drew

Michael Austin
Member #7,608
August 2006

In the file "gl_ext_list.h"
The number "1.3"
AGL_EXT(ARB_multisample, 1.3)
is causing this code; (in "glext.c")

  /* Get extension info for the rest of the lib */
#    define AGL_EXT(name, ver) {                               \
    allegro_gl_extensions_GL.name =                        \ 
          allegro_gl_is_extension_supported("GL_" #name)   \ 
      || (allegro_gl_info.version >= ver && ver > 0);      \ 
  } 
#   include "allegrogl/GLext/gl_ext_list.h"
#   undef AGL_EXT

To set
allegro_gl_extensions_GL.ARB_multisample = 1

However, the extension GL_ARB_multisample is apparently NOT available on this chipset (INTEL 915GM)

allegro.log said:

OpenGL Version: 1.4.0 - Build 4.14.10.4332
Vendor: Intel
Renderer: Intel 915GM

GLU Version : 1.2.2.0 Microsoft Corporation

subsequently, when allegrogl attempts to use the extension (in "win.c")

  if (allegro_gl_extensions_GL.ARB_multisample) {
    glSampleCoverageARB(1.0, GL_FALSE);
  }

It crashes (and burns).

Two possible solutions:
1. change line in "gl_ext_list.h" to read:
AGL_EXT(ARB_multisample, 1.4)

OR

2. change line in "win.c" to read:

  if (allegro_gl_is_extension_supported("GL_ARB_multisample")){
    glSampleCoverageARB(1.0, GL_FALSE);
  }

Michael Austin

Richard Phipps
Member #1,632
November 2001
avatar

Thanks a lot Mike! ;)

Mike, Bob, which option do you recommend? I'll be changing my version of AllegroGL so that it works on this chipset. :)

Bob
Free Market Evangelist
September 2000
avatar

We should do Option 3: Detect Intel 915G chipsets and force multisampling to be disabled. We alreday do this for ARB_texture_non_power_of_two.

The fix would be in src/glext.c in function __allegro_gl_manage_extensions(void).

--
- Bob
[ -- All my signature links are 404 -- ]

Richard Phipps
Member #1,632
November 2001
avatar

For now I've implemented no. 2 and my game now works on a Intel 915 laptop.

Can one of the AllegroGL devs post in the forum when this fix is applied to the CVS branch and I'll download.

Also, I'm not sure if this problem applies to other Intel chipsets in that range..?

Thanks Bob!

Bob
Free Market Evangelist
September 2000
avatar

The problem with Option 2 is that it will work in Windows XP and under, but it will not necessarily work properly in Linux or Windows Vista. The extensions string does not need to contain things that are part of the core spec.

--
- Bob
[ -- All my signature links are 404 -- ]

Richard Phipps
Member #1,632
November 2001
avatar

So is this a bug in the OpenGL drivers for this Intel chipset?

Milan Mimica
Member #3,877
September 2003
avatar

What does printf("%s", (const char*)glGetString(GL_VENDOR)); say?

Should GL_ARB_multisample be disabled only for Intel 915G? I've seen AGL working fine on some other Intel chipsets (not sure which ones).

Richard Phipps
Member #1,632
November 2001
avatar

Milan:
From Mike's Allegro Log file:

Quote:

OpenGL Version: 1.4.0 - Build 4.14.10.4332
Vendor: Intel
Renderer: Intel 915GM

GLU Version : 1.2.2.0 Microsoft Corporation

Is that the vendor string you refered to?

Michael Austin
Member #7,608
August 2006

Bob said:

The problem with Option 2 is that it will work in Windows XP and under, but it will not necessarily work properly in Linux or Windows Vista. The extensions string does not need to contain things that are part of the core spec.

I was wondering if you could point me at any documentation regarding this? I would like to learn more. Most of what I have read in regards to glGetString(GL_EXTENSIONS) merely mentions that it returns "A list of supported GL extensions." If they didn't mean "all supported extensions" it seems like there would be some documentation somewhere explaining which supported extensions would be in this list?

edit I don't doubt you, I just would like to read more about this.

Michael Austin

Milan Mimica
Member #3,877
September 2003
avatar

Richard: yes that's it, thanks

edit:
Here is the patch. If someone could test it that would be great.

 1   2   3 


Go to: