Qt-interest Archive, February 2007
Qt4 - OpenGL - Windows Compile Error
Message 1 in thread
I have been building an OpenGL app on OS X for a while using Qt. I
started porting it to windows and ran into a bunch of compile
problems. Anything beyond the most basic features does not compile.
It does not recognize GL_NEAREST_MIPMAP_NEAREST or anything much
beyond OpenGL 1.1.
The funny thing is that my windows drivers appear to work fine with
the advanced features when I demo exe's from the superbible and other
sources.
The advanced features are not defined in the gl.h that comes w/
XP-SP2. I have worked w/ OpenGL a lot on Linux and Mac but not w/
windows. Does Qt provide it's own header that defines the advanced
features?
#include <QtOpenGL> does not work.
Any advice would be great...
-Willy
--
[ signature omitted ]
Message 2 in thread
I think you need the GLEW library -- http://glew.sourceforge.net/
Use that to initialize the OpenGL API -- I believe it will define
GL_NEAREST_MIPMAP_NEAREST and other constants at compile time. It will
also bind some functions at runtime, depending on what your card supports.
Paul.
Willy P wrote:
> I have been building an OpenGL app on OS X for a while using Qt. I
> started porting it to windows and ran into a bunch of compile
> problems. Anything beyond the most basic features does not compile.
> It does not recognize GL_NEAREST_MIPMAP_NEAREST or anything much
> beyond OpenGL 1.1.
>
> The funny thing is that my windows drivers appear to work fine with
> the advanced features when I demo exe's from the superbible and other
> sources.
>
> The advanced features are not defined in the gl.h that comes w/
> XP-SP2. I have worked w/ OpenGL a lot on Linux and Mac but not w/
> windows. Does Qt provide it's own header that defines the advanced
> features?
>
> #include <QtOpenGL> does not work.
>
> Any advice would be great...
>
> -Willy
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
--
[ signature omitted ]
Message 3 in thread
My favorite OpenGL extension loader is GLEE:
http://elf-stone.com/glee.php
Just add a .C file to your project and include the header... works
like magic (well, not really). I've used it with Qt for quite a while
now on both Windows and Mac.
The next version of the SuperBible will use GLEE too ;-)
Richard
P.S. GL_NEAREST_MIPMAP_NEAREST is actually available in OpenGL 1.1...
Your just missing the gl/gl.h header from the Visual Studio include
directory (actually, it's buried in the /PlatformSDK sub folder)...
Just get glee.h and put it ahead of your other OpenGL headers, and
include glee.c for the entry points and your set.
On Feb 6, 2007, at 1:05 PM, Willy P wrote:
> I have been building an OpenGL app on OS X for a while using Qt. I
> started porting it to windows and ran into a bunch of compile
> problems. Anything beyond the most basic features does not compile.
> It does not recognize GL_NEAREST_MIPMAP_NEAREST or anything much
> beyond OpenGL 1.1.
>
> The funny thing is that my windows drivers appear to work fine with
> the advanced features when I demo exe's from the superbible and other
> sources.
>
> The advanced features are not defined in the gl.h that comes w/
> XP-SP2. I have worked w/ OpenGL a lot on Linux and Mac but not w/
> windows. Does Qt provide it's own header that defines the advanced
> features?
>
> #include <QtOpenGL> does not work.
>
> Any advice would be great...
>
> -Willy
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
> with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
--
[ signature omitted ]
Message 4 in thread
Willy P schrieb:
> I have been building an OpenGL app on OS X for a while using Qt. I
> started porting it to windows and ran into a bunch of compile
> problems. Anything beyond the most basic features does not compile.
> It does not recognize GL_NEAREST_MIPMAP_NEAREST or anything much
> beyond OpenGL 1.1.
>
> The funny thing is that my windows drivers appear to work fine with
> the advanced features when I demo exe's from the superbible and other
> sources.
>
> The advanced features are not defined in the gl.h that comes w/
> XP-SP2. I have worked w/ OpenGL a lot on Linux and Mac but not w/
> windows. Does Qt provide it's own header that defines the advanced
> features?
>
The header arenot bundled with the OS - they are shipped with the
compiler. Seems like you've an old PlatformSDK because my gl.h from
latest PSDK defines GL_NEAREST_MIPMAP_NEAREST.
You can get the PSDK from http://msdn.microsoft.com/platformsdk
Christian
--
[ signature omitted ]
Message 5 in thread
Wow, lots of options here, I'm going to look into each one:
Christian:
I just installed Studio 2005 (w/o SP1), I would have thought it was
relatively recent. Should I try the sdk you linked to?
Richard and Paul:
I'm going to look into both of these. Do you use them for all the
platforms you build for, or just windows. And I have heard that w/
glew GL_FOO_BAR becomes GLEW_FOO_BAR. Is that true? I would rather
not have to change my code (or my habits.)
Thanks for all these suggestions everyone...
-Willy
On 2/6/07, Christian Ehrlicher <Ch.Ehrlicher@xxxxxx> wrote:
> Willy P schrieb:
> > I have been building an OpenGL app on OS X for a while using Qt. I
> > started porting it to windows and ran into a bunch of compile
> > problems. Anything beyond the most basic features does not compile.
> > It does not recognize GL_NEAREST_MIPMAP_NEAREST or anything much
> > beyond OpenGL 1.1.
> >
> > The funny thing is that my windows drivers appear to work fine with
> > the advanced features when I demo exe's from the superbible and other
> > sources.
> >
> > The advanced features are not defined in the gl.h that comes w/
> > XP-SP2. I have worked w/ OpenGL a lot on Linux and Mac but not w/
> > windows. Does Qt provide it's own header that defines the advanced
> > features?
> >
> The header arenot bundled with the OS - they are shipped with the
> compiler. Seems like you've an old PlatformSDK because my gl.h from
> latest PSDK defines GL_NEAREST_MIPMAP_NEAREST.
> You can get the PSDK from http://msdn.microsoft.com/platformsdk
>
> Christian
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
--
[ signature omitted ]
Message 6 in thread
Willy P schrieb:
> Wow, lots of options here, I'm going to look into each one:
>
> Christian:
> I just installed Studio 2005 (w/o SP1), I would have thought it was
> relatively recent. Should I try the sdk you linked to?
>
You could at least try it out - msvc 2005 is > 1 year old. It can't hurt
to update the sd. But be aware of SP1 :)
Christian
--
[ signature omitted ]
Message 7 in thread
Microsoft has not updated the gl headers in many many years. I can
verify that the latest VISTA SDK is no different. With Microsoft's
headers and libraries you ONLY get OpenGL 1.1 entry points.
On Apple, you get pretty much the currently running version of OpenGL
for that specific OS, provided you have the latest XCode.
GLEE is pretty transparent, and I even link to it on Apple.
This is at the top of all my source files (or in a common header):
// Bring in OpenGL
// Windows
#ifdef WIN32
#include <windows.h> // Must have for Windows platform builds
#include "glee.h" // OpenGL Extension "autoloader"
#include <gl\gl.h> // Microsoft OpenGL headers (version 1.1 by
themselves)
#include <gl\glu.h> // OpenGL Utilities
#endif
// Mac OS X
#ifdef __APPLE__
#include <Carbon/Carbon.h> // Brings in most Apple specific stuff
#include "glee.h" // OpenGL Extension "autoloader"
#include <OpenGL/gl.h> // Apple OpenGL haders (version depends on OS
X SDK version)
#include <OpenGL/glu.h> // OpenGL Utilities
#endif
On Apple, add the OpenGL frameworks, and glee.c to your project
On Windows, add opengl32.lib and glu32.lib in your libraries, and
glee.c to your project (even if you are using C++).
Whether I'm using Qt or not, this keeps 95% of all my rendering code
very portable.
Richard
On Feb 6, 2007, at 4:03 PM, Willy P wrote:
> Wow, lots of options here, I'm going to look into each one:
>
> Christian:
> I just installed Studio 2005 (w/o SP1), I would have thought it was
> relatively recent. Should I try the sdk you linked to?
>
> Richard and Paul:
> I'm going to look into both of these. Do you use them for all the
> platforms you build for, or just windows. And I have heard that w/
> glew GL_FOO_BAR becomes GLEW_FOO_BAR. Is that true? I would rather
> not have to change my code (or my habits.)
>
> Thanks for all these suggestions everyone...
> -Willy
>
> On 2/6/07, Christian Ehrlicher <Ch.Ehrlicher@xxxxxx> wrote:
>> Willy P schrieb:
>> > I have been building an OpenGL app on OS X for a while using Qt. I
>> > started porting it to windows and ran into a bunch of compile
>> > problems. Anything beyond the most basic features does not
>> compile.
>> > It does not recognize GL_NEAREST_MIPMAP_NEAREST or anything much
>> > beyond OpenGL 1.1.
>> >
>> > The funny thing is that my windows drivers appear to work fine with
>> > the advanced features when I demo exe's from the superbible and
>> other
>> > sources.
>> >
>> > The advanced features are not defined in the gl.h that comes w/
>> > XP-SP2. I have worked w/ OpenGL a lot on Linux and Mac but not w/
>> > windows. Does Qt provide it's own header that defines the advanced
>> > features?
>> >
>> The header arenot bundled with the OS - they are shipped with the
>> compiler. Seems like you've an old PlatformSDK because my gl.h from
>> latest PSDK defines GL_NEAREST_MIPMAP_NEAREST.
>> You can get the PSDK from http://msdn.microsoft.com/platformsdk
>>
>> Christian
>>
>> --
>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
>> with "unsubscribe" in the subject or the body.
>> List archive and information: http://lists.trolltech.com/qt-interest/
>>
>>
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
> with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
Message 8 in thread
Willy P wrote:
> Wow, lots of options here, I'm going to look into each one:
>
> Christian:
> I just installed Studio 2005 (w/o SP1), I would have thought it was
> relatively recent. Should I try the sdk you linked to?
>
> Richard and Paul:
> I'm going to look into both of these. Do you use them for all the
> platforms you build for, or just windows. And I have heard that w/
> glew GL_FOO_BAR becomes GLEW_FOO_BAR. Is that true? I would rather
> not have to change my code (or my habits.)
>
I've used GLEW on openSUSE Linux 10.2 i686 and x86_64, OS X 10.4, and
Win XP. The GLEW prefix is for GLEW specific constants. I just grepped
through my code an all I've found is one mention of GLEW_OK and two
mentions of GLEW_VERSION_2_0. In any case, according to grep GLEW
defines GL_NEAREST_MIPMAP_NEAREST:
GLEW/include/GL/glew.h:#define GL_NEAREST_MIPMAP_NEAREST 0x2700
Paul.
--
[ signature omitted ]
Message 9 in thread
Christian:
Yeah, I made vc2005 SP1 mistake and wasted hours of my life. I'll
download the new SDK.
Richard:
Doesn't Qt take care of:
windows.h, carbon.h and gl.h for every platform with <QApplication>
and <QtOpenGL>? I am with you on glee but I've never included carbon
or windows in a Qt app and they've worked (minus the more modern GL
problems. Basic GL works.) In other words if I use
#include <QtOpenGL>
#include "glee.h"
shouldn't that take care of it for both platforms? (Assuming glee.C
is part of my project.)
Paul: Right on, I'm going to evaluate glee and glew tonight.
Thanks again all...
-Willy
On 2/6/07, Paul Koshevoy <paul@xxxxxxxxxx> wrote:
> Willy P wrote:
> > Wow, lots of options here, I'm going to look into each one:
> >
> > Christian:
> > I just installed Studio 2005 (w/o SP1), I would have thought it was
> > relatively recent. Should I try the sdk you linked to?
> >
> > Richard and Paul:
> > I'm going to look into both of these. Do you use them for all the
> > platforms you build for, or just windows. And I have heard that w/
> > glew GL_FOO_BAR becomes GLEW_FOO_BAR. Is that true? I would rather
> > not have to change my code (or my habits.)
> >
> I've used GLEW on openSUSE Linux 10.2 i686 and x86_64, OS X 10.4, and
> Win XP. The GLEW prefix is for GLEW specific constants. I just grepped
> through my code an all I've found is one mention of GLEW_OK and two
> mentions of GLEW_VERSION_2_0. In any case, according to grep GLEW
> defines GL_NEAREST_MIPMAP_NEAREST:
>
> GLEW/include/GL/glew.h:#define GL_NEAREST_MIPMAP_NEAREST 0x2700
>
> Paul.
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
--
[ signature omitted ]
Message 10 in thread
> Doesn't Qt take care of:
> windows.h, carbon.h and gl.h for every platform with <QApplication>
I almost commented on this... I knew somebody would bring this up. ;-)
Short answer: Yes, but put glee.h in front of QtOpenGL as it likes
being ahead of the other OpenGL headers, and your ready to go.
Long answer: Yes, but for my personal preferences, I have a 90/10
rule about cross platform development. 90% of the code is portable,
about 10% is platform specific. Qt actually falls within that 10%,
and I try to keep my rendering code as clean as possible. This makes
it easier to use it in Qt projects, MFC projects, Win32 projects,
DSL, GLUT, Cocoa, Carbon, etc. Every project is different, and Qt is
not always an option for various reasons. This also helps
tremendously with code reuse issues... but we border on a religious
topic here...
Richard
On Feb 6, 2007, at 6:41 PM, Willy P wrote:
> Christian:
> Yeah, I made vc2005 SP1 mistake and wasted hours of my life. I'll
> download the new SDK.
>
> Richard:
> Doesn't Qt take care of:
> windows.h, carbon.h and gl.h for every platform with <QApplication>
> and <QtOpenGL>? I am with you on glee but I've never included carbon
> or windows in a Qt app and they've worked (minus the more modern GL
> problems. Basic GL works.) In other words if I use
>
> #include <QtOpenGL>
> #include "glee.h"
>
> shouldn't that take care of it for both platforms? (Assuming glee.C
> is part of my project.)
>
> Paul: Right on, I'm going to evaluate glee and glew tonight.
>
> Thanks again all...
> -Willy
>
>
>
>
>
> On 2/6/07, Paul Koshevoy <paul@xxxxxxxxxx> wrote:
>> Willy P wrote:
>> > Wow, lots of options here, I'm going to look into each one:
>> >
>> > Christian:
>> > I just installed Studio 2005 (w/o SP1), I would have thought it was
>> > relatively recent. Should I try the sdk you linked to?
>> >
>> > Richard and Paul:
>> > I'm going to look into both of these. Do you use them for all the
>> > platforms you build for, or just windows. And I have heard that w/
>> > glew GL_FOO_BAR becomes GLEW_FOO_BAR. Is that true? I would
>> rather
>> > not have to change my code (or my habits.)
>> >
>> I've used GLEW on openSUSE Linux 10.2 i686 and x86_64, OS X 10.4, and
>> Win XP. The GLEW prefix is for GLEW specific constants. I just
>> grepped
>> through my code an all I've found is one mention of GLEW_OK and two
>> mentions of GLEW_VERSION_2_0. In any case, according to grep GLEW
>> defines GL_NEAREST_MIPMAP_NEAREST:
>>
>> GLEW/include/GL/glew.h:#define GL_NEAREST_MIPMAP_NEAREST 0x2700
>>
>> Paul.
>>
>> --
>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
>> with "unsubscribe" in the subject or the body.
>> List archive and information: http://lists.trolltech.com/qt-interest/
>>
>>
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
> with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
--
[ signature omitted ]
Message 11 in thread
Ahh, I see, so you want your rendering code to remain windowing system
agnostic as well as OS agnostic. Hadn't thought of that, Thanks...
On 2/6/07, Richard S. Wright Jr. <opengl@xxxxxxxxxxxxx> wrote:
> > Doesn't Qt take care of:
> > windows.h, carbon.h and gl.h for every platform with <QApplication>
>
> I almost commented on this... I knew somebody would bring this up. ;-)
>
> Short answer: Yes, but put glee.h in front of QtOpenGL as it likes
> being ahead of the other OpenGL headers, and your ready to go.
>
> Long answer: Yes, but for my personal preferences, I have a 90/10
> rule about cross platform development. 90% of the code is portable,
> about 10% is platform specific. Qt actually falls within that 10%,
> and I try to keep my rendering code as clean as possible. This makes
> it easier to use it in Qt projects, MFC projects, Win32 projects,
> DSL, GLUT, Cocoa, Carbon, etc. Every project is different, and Qt is
> not always an option for various reasons. This also helps
> tremendously with code reuse issues... but we border on a religious
> topic here...
>
> Richard
>
>
> On Feb 6, 2007, at 6:41 PM, Willy P wrote:
>
> > Christian:
> > Yeah, I made vc2005 SP1 mistake and wasted hours of my life. I'll
> > download the new SDK.
> >
> > Richard:
> > Doesn't Qt take care of:
> > windows.h, carbon.h and gl.h for every platform with <QApplication>
> > and <QtOpenGL>? I am with you on glee but I've never included carbon
> > or windows in a Qt app and they've worked (minus the more modern GL
> > problems. Basic GL works.) In other words if I use
> >
> > #include <QtOpenGL>
> > #include "glee.h"
> >
> > shouldn't that take care of it for both platforms? (Assuming glee.C
> > is part of my project.)
> >
> > Paul: Right on, I'm going to evaluate glee and glew tonight.
> >
> > Thanks again all...
> > -Willy
> >
> >
> >
> >
> >
> > On 2/6/07, Paul Koshevoy <paul@xxxxxxxxxx> wrote:
> >> Willy P wrote:
> >> > Wow, lots of options here, I'm going to look into each one:
> >> >
> >> > Christian:
> >> > I just installed Studio 2005 (w/o SP1), I would have thought it was
> >> > relatively recent. Should I try the sdk you linked to?
> >> >
> >> > Richard and Paul:
> >> > I'm going to look into both of these. Do you use them for all the
> >> > platforms you build for, or just windows. And I have heard that w/
> >> > glew GL_FOO_BAR becomes GLEW_FOO_BAR. Is that true? I would
> >> rather
> >> > not have to change my code (or my habits.)
> >> >
> >> I've used GLEW on openSUSE Linux 10.2 i686 and x86_64, OS X 10.4, and
> >> Win XP. The GLEW prefix is for GLEW specific constants. I just
> >> grepped
> >> through my code an all I've found is one mention of GLEW_OK and two
> >> mentions of GLEW_VERSION_2_0. In any case, according to grep GLEW
> >> defines GL_NEAREST_MIPMAP_NEAREST:
> >>
> >> GLEW/include/GL/glew.h:#define GL_NEAREST_MIPMAP_NEAREST 0x2700
> >>
> >> Paul.
> >>
> >> --
> >> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
> >> with "unsubscribe" in the subject or the body.
> >> List archive and information: http://lists.trolltech.com/qt-interest/
> >>
> >>
> >
> > --
> > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
> > with "unsubscribe" in the subject or the body.
> > List archive and information: http://lists.trolltech.com/qt-interest/
> >
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
--
[ signature omitted ]