NO

Author Topic: GLUT  (Read 7244 times)

rob

  • Guest
GLUT
« on: September 19, 2007, 07:19:08 PM »
I need to get glut to work with pelles c but im having troubles getting it all to work correctly.  Has anyone else tried using it and can maybe help me?

JohnF

  • Guest
Re: GLUT
« Reply #1 on: September 20, 2007, 11:44:04 AM »
What problems are you having?

John

AndyCav

  • Guest
Re: GLUT
« Reply #2 on: September 26, 2007, 04:58:57 PM »
Hi.  I too am having a problem with using GLUT so I thought it'd be sensible to post in this thread too... hope you don't mind!  May even be a similar problem.

I just downloaded Pelles C today, though I've been using C on and off for some years.  I downloaded GLUT and copied and pasted an example I found into Pelles to see if it worked.   I receive "fatal error #2210: More than 100 errors, please improve yourself."  after very many warnings!

The GLUT package I downloaded is "glut35.zip" from ftp://sunsite.unc.edu/pub/packages/development/graphics/glut/ while the tutorial containing the example I tried is at http://www.gmonline.demon.co.uk/cscene/CS5/CS5-03.html.

To be honest I'm not sure what the different project types you can start in Pelles do so I picked the "Win32 Console Program (EXE)" type and copied and pasted the tutorial into there.

Also I understand that Pelles needs to somehow know where the GLUT files are so looking around I went into "Project Options->Folders" and added the folder "Include->GL" which seemed to contain the necessary header files that the example program required.  However that was all guess work.

Thanks,

Andy

JohnF

  • Guest
Re: GLUT
« Reply #3 on: September 26, 2007, 05:34:34 PM »
The most likely reason you have "More than 100 errors" is you need to check the "Enable Microsoft Extensions" in Project Options/Compiler tab.

Take a look in the Chit-Chat section, I've recently posted a Glut demo on my web site.

John

AndyCav

  • Guest
Re: GLUT
« Reply #4 on: September 26, 2007, 06:30:34 PM »
Thanks John I'll take a look at that.  I've enabled the Microsoft extensions which has reduced my errors to one: cannot find gl\glut.h.

I'm not sure if I'm meant to just point Pelles to the folder containing this or move the folder into Pelles or something.  I might try that.

AndyCav

  • Guest
Re: GLUT
« Reply #5 on: September 26, 2007, 06:37:58 PM »
In fact moving the folder "GL" into the Pelles "Include" folder results in the following error:

C:\Program Files\PellesC\Include\gl\glut.h(19): error #1050: Macro redefinition of 'APIENTRY'.
C:\Program Files\PellesC\Include\gl\glut.h(20): error #1050: Macro redefinition of 'CALLBACK'.

Hmm.  Something to do with old / new versions?

JohnF

  • Guest
Re: GLUT
« Reply #6 on: September 26, 2007, 06:56:31 PM »
It says in Glut.h

=================
#if defined(_WIN32)

/* GLUT 3.7 now tries to avoid including <windows.h>
=================

Try removing the #include <windows.h>

I've no idea if that will work though.

John

AndyCav

  • Guest
Re: GLUT
« Reply #7 on: September 26, 2007, 07:11:14 PM »
Affraid not, takes me back to >100 errors again!

Watched the demo: very nice, I think I'm a long glong way off anything like that, lol.

AndyCav

  • Guest
Re: GLUT
« Reply #8 on: September 26, 2007, 07:14:41 PM »
It wouldn't surprise me if the problem is that the example code I'm using is from 1998: http://www.gmonline.demon.co.uk/cscene/CS5/CS5-01.html

I'll try to find something more up to date tutorial-wise.

Andy

JohnF

  • Guest
Re: GLUT
« Reply #9 on: September 26, 2007, 08:15:30 PM »
I just pasted the code from here

http://www.gmonline.demon.co.uk/cscene/CS5/CS5-03.html

into a console project and it was fine.

Make sure PellesC can find the headers and you should be ok.

Code: [Select]
#include <windows.h> /* obviously change this to your native library
if you're compiling under unix */
#include <gl\gl.h>
#include <gl\glut.h>

void init(void);
void display(void);

int main (int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(250, 250);
glutInitWindowPosition(100, 100);
glutCreateWindow("My First OpenGL Application");
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}

void init(void)
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glColor3f(0.0, 0.0, 1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-10.0, 10.0, -10.0, 10.0, -10.0, 10.0);
}

void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glRectf(-5.0, 5.0, 5.0, -5.0);
glutSwapBuffers();
}

John

AndyCav

  • Guest
Re: GLUT
« Reply #10 on: September 26, 2007, 09:05:27 PM »
That's the code I'm using alright.  I think it can find the headers alright as the two errors I'm getting specifically mention the necessary library, .e. \include\gl\glut.h:

C:\Program Files\PellesC\Include\gl\glut.h(19): error #1050: Macro redefinition of 'APIENTRY'.
C:\Program Files\PellesC\Include\gl\glut.h(20): error #1050: Macro redefinition of 'CALLBACK'.

So, I'm not sure there's much I can do with my knowledge!  I'll try turning on some more of the tick boxes in the project options.  :-\

Exactly what type of project did you paste the code into?  I don't know what the difference is!  ???

Cheers for your help John.


JohnF

  • Guest
Re: GLUT
« Reply #11 on: September 26, 2007, 09:08:53 PM »
A Win32 console app.

Attached are gl.h and glut.h in case there are differences.

John