Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@sources.redhat.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@sources.redhat.com>
List-Help: <mailto:cygwin-help@sources.redhat.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@sources.redhat.com
Delivered-To: mailing list cygwin@sources.redhat.com
Message-Id: <4.3.2.7.0.20000717130520.00aedde8@courriel.polymtl.ca>
X-Mailer: QUALCOMM Windows Eudora Version 4.3.2
Date: Mon, 17 Jul 2000 13:05:26 -0400
To: cygwin@sources.redhat.com
From: Andre Bleau <andre.bleau@courriel.polymtl.ca>
Subject: glGetString and Open GL link errors: Answer
Cc: dj@delorie.com, jason@whizzird.net
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"; format=flowed
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id NAA10874

Hi there.

I am the "maintainer" for the opengl package.

1-	There is a faulty line in the /usr/local/include/GL/gl.h file. Replace 
the line:

extern const GLubyte * glGetString (GLenum name);
	to read
extern const APIENTRY GLubyte * glGetString (GLenum name);


2-	If you still have link errors, e.g.:

main.o(.text+0x31):main.c: undefined reference to `glColor3f@12'

then you are probably using the wrong include files. If you installed .h 
files that you found somewhere else in /usr/include/GL, these would mask 
the ones that the package installs. Rename /usr/include/GL to 
/usr/include/oldGL so that the compiler sees the files in 
/usr/local/include/GL. This should do the trick.

I don't have my own ftp server, so I uploaded a fixed tar ball to DJ 
Delorie. I hope he will make it available as a contrib or in the main 
distribution.

Now, I want to stress that my own contribution is _very_ small. Here is 
some background:

1-	M$ provides glu32.dll and opengl32.dll with NT 4.0 and Windows 2000. I 
don't know about Windows 95/98.

2-	Cygwin 1.1.2 provides libglut32.a, libglu32.a and libopengl32.a in 
/usr/lib, but no .h files and no glut32.dll. I guess that the .a files were 
built using dlltool from the dll files, not from sources.

3-	If you get .h files from OpenGL and GLUT sites, you are not able to link 
with cygwin's .a files. The linker will complain, for example, that it 
cannot find glColor3f@12 while your code is calling glColor3f . This is 
because the .a files contain functions that are meant to be linked with 
MSVC or Borland C, not with gcc. gcc uses a different API by default; you 
have to tell it explicitly when you called M$ API functions.

4-	After trying for days to solve that problem and profering a lot of 
english four letter words and french profanities, I figured it out with the 
help of Jérôme Benoit, and I prepared modified .h files that declare Open 
GL, GLU and GLUT functions with the right API. I was able to build GLUT and 
Open GL programs; life was wonderfull again.

5-	I thought there might be other people out there, bothered by the same 
problem, so I packaged my modified .h files with a glut32.dll from the GLUT 
site (http://reality.sgi.com/mjk_asd/glut3/glut3.html). I added another 
static library for the GLUI package, which I had built from sources and 
found very usefull; see http://www.cs.unc.edu/~rademach/glui/ . Upon DJ's 
suggestion, this package, opengl-1.2.1-1, was uploaded to his site and he 
placed it in the contrib directory, and later in the main distribution.

6-	I discovered a flawed line in gl.h and received a few emails about it. 
See above.

7-	I realized that M$ was not providing Open GL 1.2.1, but Open GL 1.1.0.

8-	I made a new package, opengl-1.1.0-1, with a corrected README and gl.h 
file and uploaded to DJ's site. Hope you will be able to use it soon.

Please realize that this package only enables you to link with M$ Open GL 
and GLU dll. If these are not provided by your OS, there is nothing I can 
do about it.

Regards,

André Bleau, ing., analyste
bleau@courriel.polymtl.ca

Département de génie électrique et         Electric Engineering and
de génie informatique                      Computer Engineering department
École Polytechnique de Montréal            Montreal Polytechnic School


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

