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
Paladin
Member #6,645
December 2005
avatar

I just recently started into allegrogl, and I"m not sure what all of this means, but I know a bit of it. This code compiles fine, but when I run it, I get the standard windows error "This program has experienced an error and needs to close".

1#include <allegro.h>
2#include <alleggl.h>
3 
4int main() {
5
6 // Init Allegro and AllegroGL
7 allegro_init();
8 install_allegro_gl();
9
10 install_keyboard();
11 
12 allegro_gl_set(AGL_Z_DEPTH, 8);
13 allegro_gl_set(AGL_COLOR_DEPTH, 16);
14 allegro_gl_set(AGL_SUGGEST, AGL_Z_DEPTH | AGL_COLOR_DEPTH);
15 
16 set_gfx_mode(GFX_OPENGL_WINDOWED, 640, 480, 0, 0);
17
18 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
19 
20 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
21 glLoadIdentity(); // Reset The Modelview Matrix
22
23 glShadeModel(GL_SMOOTH); // Enables smooth shading
24
25 glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Clears screen to black
26
27 glBegin(GL_TRIANGLES); // Drawing Using Triangles
28 glVertex3f( 0.0f, 1.0f, 0.0f); // Top
29 glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
30 glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
31 glEnd(); // Finished Drawing The Triangle
32
33 glTranslatef(3.0f,0.0f,0.0f); // Move Right 3 Units
34
35 glBegin(GL_QUADS); // Draw A Quad
36 glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left
37 glVertex3f( 1.0f, 1.0f, 0.0f); // Top Right
38 glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
39 glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
40 glEnd(); // Done Drawing The Quad
41
42 readkey();
43
44 return 0;
45}
46END_OF_MAIN();

I remember openlayer not working for my computer, so I don't think allegrogl does either. OpenGL does work as far as I know because I've played games with OpenGL only. I dunno what's going on. Any help would be pretty awesome right now. Thanks a lot.

Kitty Cat
Member #2,815
October 2002
avatar

Where's all your error checking code? Unless you know precisely what you're doing, and sometimes even then, if something can fail, make sure it doesn't.

And you also need allegro_gl_flip(); before readkey();.

--
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

Milan Mimica
Member #3,877
September 2003
avatar

Tell us the AGL version, and yes, check for return values.

GullRaDriel
Member #3,861
September 2003
avatar

Allegro version is needed too. Thanks.

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

Paladin
Member #6,645
December 2005
avatar

Ok well I'm using allegro 4.2 (Should I be using 4.3 now? I thought it still had bugs) and I put in some checks and I checked for the return values of install_keyboard and set_gfx_mode. Basically I have an allegro_message after a couple of actions. So it installs allegro and allegrogl, installs the keyboard, suggests the graphics mode, but once I actually get to set_gfx_mode, it crashes.

EDIT: Also, one of the main reasons I don't have a lot of checks for return values is I'm not sure exactly what all returns values. Since I've never used AllegroGL, I still don't know what everything does, but I guess I get the general idea.

GullRaDriel
Member #3,861
September 2003
avatar

You just have to read Allegro && AllegroGL documentations to found the return values.
Also tell us more about the crash.

Try to compile a debug version (link with -lallegd and (i do not remember the name) the debugged version of AllegroGL))

Do the AllegroGL examples works fine ? And Allegro ones ?

Do you have a proper driver for your GFX card ? What is your GFX card ?

EDIT:
Allegro manual
AllegroGL manual

_

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

Paladin
Member #6,645
December 2005
avatar

I'm not sure where to find some allegroGL examples, but the allegro ones do. All of Shawn Hargreaves 3d examples work, but I don't think he's using allegroGL. Every single OpenLayer or AllegroGL game for me though seems to fail. I'm not sure how to check my drivers for my graphics card since I'm not really that well-versed on the topic. My gfx card is a piece of crap, it's an Intel Graphics Media Accelerator 900, built in with the computer. At the moment I'm trying to get a new one, but can't afford one at the moment. Like I said in my first post, I just think that my graphics card isn't good enough to handle AllegroGL.

Richard Phipps
Member #1,632
November 2001
avatar

Your gfx card can handle DirectX 3D games can't it? I'm not sure if there are OpenGL drivers out there for it, but I find it hard to believe you can't do at least basic 3D gfx with it..

Paladin
Member #6,645
December 2005
avatar

Yea, neither can I. It supports direct X games fine, and I'm sure I've even played some OpenGL games fine, I really don't know what the deal is. I've tried looking into it a bit further, but I don't find much unfortunately.

Richard Phipps
Member #1,632
November 2001
avatar

Well, according to Wikipedia:
http://en.wikipedia.org/wiki/Intel_GMA

Quote:

GMA 900

On Intel i910G, Intel i915G, Intel i915Gx chipset motherboards.

T/L support: Software based (no Hardware T&L Support)

Clock speed: 333 MHz

Pixel Pipelines: 4

Pixel Fillrate: 1333 MPixel/s

Vertex Shaders: 1 (v2.0) (software)

Pixel Shaders: 4 (v2.0) (hardware)

OpenGL: Yes. v.1.4

DirectX (hardware): Yes. v.9.0

Notice the OpenGL 1.4 support.

Intel's page:
http://www.intel.com/design/graphics/gma900/

And details on drivers and support:
http://www.intel.com/support/graphics/intel915g/index.htm

Bob
Free Market Evangelist
September 2000
avatar

Can you tell which line in your program triggers the error?

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

Paladin
Member #6,645
December 2005
avatar

Ok well you're much better at finding things than I am Richard. ;D I'm going to update my drivers then. Bob, it gets as far as the set_gfx_mode(); then it crashes.

Bob
Free Market Evangelist
September 2000
avatar

Can you track down the crash inside of AGL? Maybe the allegro.log file contains some useful information?

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

Paladin
Member #6,645
December 2005
avatar

I don't get an allegro.log, isn't that only with Visual-C++? I'm using Dev-C++ atm.

Bob
Free Market Evangelist
September 2000
avatar

You need to build the debug version of AllegroGL and link with agld.a

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

Milan Mimica
Member #3,877
September 2003
avatar

Tell us the AGL version!!!

I'm guessing the error you are experiencing was fixed in the current SVN version.

Paladin
Member #6,645
December 2005
avatar

Sorry I haven't replied, my internet has been down for almost 3 hours. Internet service really sucks here. I know this sounds stupid, but I've looked around and I can't find what version of AllegroGL I'm using. I'll compile a debug version and post the results here later as well. Could you tell me how to find out the version of AllegroGL I have? Sorry, I'm a bit slow. :-/

Bob
Free Market Evangelist
September 2000
avatar

printf("%s\n", AGL_VERSION_STR);

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

Paladin
Member #6,645
December 2005
avatar

0.2.5 CVL is the version I have.

Milan Mimica
Member #3,877
September 2003
avatar

Paladin
Member #6,645
December 2005
avatar

I feel incredibly stupid. I have no clue how to compile AllegroGL so I can use it for dev C++. I looked around, but I can't find anything. Can you help me with this?

Evert
Member #794
November 2000
avatar

Quote:

Should I be using 4.3 now? I thought it still had bugs

You absolutely shouldn't use 4.3. It's not yet suitable for normal use (just for testing).

miran
Member #2,407
June 2002

Quote:

I feel incredibly stupid. I have no clue how to compile AllegroGL so I can use it for dev C++. I looked around, but I can't find anything. Can you help me with this?

Did you read the readme files?

--
sig used to be here

Richard Phipps
Member #1,632
November 2001
avatar

Quote:

Mingw/32 instructions
---------------------

Mingw 2.0 and higher already come with the OpenGL header files
and libraries, so you can skip the next step.

If you don't have the OpenGL header files (GL/gl.h) and libraries, you will
first need to acquire thrm. These can be obtained from the Microsoft site,
or from MSVC.

If you obtained the self-extracting archive from the Microsoft site, then
run it. Move the produced header files (*.h) into C:\Mingw32\include\GL\
(replace C:\Mingw32 by wherever you happen to have installed Mingw).
Ignore the other files, as they are only useful for MSVC.

You will need to run 'fix mingw32' in the AllegroGL directory
to update makefile for Mingw32.
Since both Allegro and AllegroGL have native Mingw support
I am happy to say that you can build Allegro/AllegroGL programs
entirely using free software.

For an optimised build, run `make' from the directory containing
this file. Use `make install' to install the library and header
file. Some versions of Mingw come with `mingw32-make' instead of
`make', so you may need to run that instead.

For a debug build, do the same but write `DEBUGMODE=1' on each
of the command lines; for example, 'make DEBUGMODE=1' and
'make install DEBUGMODE=1'.

It worked fine for me. I had to install the lib and header files in my Dev-c directory manually, but that's to be due to a strange dev-c folder setup some years ago. The new version seems to work fine for my game and I hope that means for more people than with the old 0.2.5 version. :)

Paladin
Member #6,645
December 2005
avatar

Well I tried to read the readme files but they got all messed up when I unzipped them. Sorry for not replying and seeming incredibly stupid, just internet is been very jacked up lately. So Richard, you just took the header files and the lib files and just put them right into the folders for Dev-C++?

 1   2   3 


Go to: