Link error with programs compiled without OpenGL

Hi,

I have found that latest SDL?2.0 includes a change that force programs
to be linked against the libGL (or any other one that provide glEnable,
glScissor and glDisable). I bisected and fount it was the changeset
e276777b4247 (7141 here), if someone want to look at how it added that
dependency and remove it -I take it shouldn?t be there in the first
place.

The error is as follow when linking any program against SDL2:
/usr/lib/libSDL2.so: undefined reference to glScissor' /usr/lib/libSDL2.so: undefined reference toglEnable’
/usr/lib/libSDL2.so: undefined reference to `glDisable’

changeset: 7141:e276777b4247
user: Sam Lantinga
date: Sat May 04 04:46:00 2013 -0700
summary: First pass on SDL render clip rect functionality–
Emmanuel Gil Peyrot
XMPP: <@Emmanuel_Gil_Peyrot>
OpenPGP: 24B1D609
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130509/907addac/attachment.pgp

[snip]

Here is a fix, the issue was that the gl* functions were used instead
of taking them from the GLES/GLES2 renderer.

http://linkmauve.fr/files/fix-7141.patchOn Thu, May 09, 2013 at 02:48:19AM +0200, Emmanuel Gil Peyrot wrote:

Hi,

I have found that latest SDL?2.0 includes a change that force programs
to be linked against the libGL (or any other one that provide glEnable,
glScissor and glDisable). I bisected and fount it was the changeset
e276777b4247 (7141 here), if someone want to look at how it added that
dependency and remove it -I take it shouldn?t be there in the first
place.


Emmanuel Gil Peyrot
XMPP: <@Emmanuel_Gil_Peyrot>
OpenPGP: 24B1D609
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130510/525122ab/attachment.pgp

The glScissor calls are wrong, too? The rect is not given in x, y, w, h
to glScissor.Am 10.05.2013 14:01, schrieb Emmanuel Gil Peyrot:

On Thu, May 09, 2013 at 02:48:19AM +0200, Emmanuel Gil Peyrot wrote:

Hi,

I have found that latest SDL 2.0 includes a change that force programs
to be linked against the libGL (or any other one that provide glEnable,
glScissor and glDisable). I bisected and fount it was the changeset
e276777b4247 (7141 here), if someone want to look at how it added that
dependency and remove it -I take it shouldn’t be there in the first
place.

[snip]

Here is a fix, the issue was that the gl* functions were used instead
of taking them from the GLES/GLES2 renderer.

http://linkmauve.fr/files/fix-7141.patch


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

2013/5/10 Martin Gerhardy <martin.gerhardy at gmail.com>> Am 10.05.2013 14:01, schrieb Emmanuel Gil Peyrot:

On Thu, May 09, 2013 at 02:48:19AM +0200, Emmanuel Gil Peyrot wrote:

Hi,

I have found that latest SDL 2.0 includes a change that force programs
to be linked against the libGL (or any other one that provide glEnable,
glScissor and glDisable). I bisected and fount it was the changeset
e276777b4247 (7141 here), if someone want to look at how it added that
dependency and remove it -I take it shouldn?t be there in the first
place.

[snip]

Here is a fix, the issue was that the gl* functions were used instead
of taking them from the GLES/GLES2 renderer.
http://linkmauve.fr/files/fix-7141.patch


SDL mailing listSDL at lists.libsdl.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

The glScissor calls are wrong, too? The rect is not given in x, y, w, h
to glScissor.

And I think it also doesn’t translate the convention from SDL coordinates
(origin at top, left) to OpenGL (origin at bottom,left).


Gabriel.

Wow, who wrote the patch in question? I sure hope it wasn’t me… o_0

Mason________________________________
From: Gabriel Jacobo
To: SDL Development List
Sent: Friday, May 10, 2013 5:51 AM
Subject: Re: [SDL] Link error with programs compiled without OpenGL

2013/5/10 Martin Gerhardy <martin.gerhardy at gmail.com>

Am 10.05.2013 14:01, schrieb Emmanuel Gil Peyrot:

On Thu, May 09, 2013 at 02:48:19AM +0200, Emmanuel Gil Peyrot wrote:

Hi, I have found that latest SDL?2.0 includes a change that force programs
to be linked against the libGL (or any other one that provide glEnable,
glScissor and glDisable). I bisected and fount it was the changeset
e276777b4247 (7141 here), if someone want to look at how it added that
dependency and remove it -I take it shouldn?t be there in the first
place.

[snip] Here is a fix, the issue was that the gl* functions were used instead
of taking them from the GLES/GLES2 renderer. http://linkmauve.fr/files/fix-7141.patch


SDL mailing list SDL at lists.libsdl.org http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
The glScissor calls are wrong, too? The rect is not given in x, y, w, h to glScissor.

And I think it also doesn’t translate the convention from SDL coordinates (origin at top, left) to OpenGL (origin at bottom,left).


Gabriel.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

2013/5/10 Martin Gerhardy <martin.gerhardy at gmail.com>
[snip]

The glScissor calls are wrong, too? The rect is not given in x, y, w, h
to glScissor.

True, I didn?t look at the arguments at all, assuming they were
correct. It seems they used the same coordinates as the d3d renderer.

And I think it also doesn’t translate the convention from SDL coordinates
(origin at top, left) to OpenGL (origin at bottom,left).

I fixed that in my latest patch[1].

[1] http://linkmauve.fr/files/fix-7141.patchOn Fri, May 10, 2013 at 09:51:47AM -0300, Gabriel Jacobo wrote:


Emmanuel Gil Peyrot
XMPP: <@Emmanuel_Gil_Peyrot>
OpenPGP: 24B1D609
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130510/4ffe31e8/attachment.pgp

2013/5/10 Emmanuel Gil Peyrot > On Fri, May 10, 2013 at 09:51:47AM -0300, Gabriel Jacobo wrote:

2013/5/10 Martin Gerhardy <martin.gerhardy at gmail.com>
[snip]

The glScissor calls are wrong, too? The rect is not given in x, y, w,
h

to glScissor.

True, I didn?t look at the arguments at all, assuming they were
correct. It seems they used the same coordinates as the d3d renderer.

And I think it also doesn’t translate the convention from SDL coordinates
(origin at top, left) to OpenGL (origin at bottom,left).

I fixed that in my latest patch[1].

[1] http://linkmauve.fr/files/fix-7141.patch

Thanks! http://hg.libsdl.org/SDL/rev/bfb5f8f4f006


Gabriel.

sorry, but this is still not correct.

you have to do:

int lowerLeft = window->height - rect.y - rect.height;
glScissor(rect.x, lowerLeft, rect.width, rect.height);

I hope there is no typo in this… and I hope I’m right with this :wink:

Greetings
MartinAm 10.05.2013 15:13, schrieb Emmanuel Gil Peyrot:

On Fri, May 10, 2013 at 09:51:47AM -0300, Gabriel Jacobo wrote:

2013/5/10 Martin Gerhardy <@Martin_Gerhardy>
[snip]

The glScissor calls are wrong, too? The rect is not given in x, y, w, h
to glScissor.
True, I didn?t look at the arguments at all, assuming they were
correct. It seems they used the same coordinates as the d3d renderer.

And I think it also doesn’t translate the convention from SDL coordinates
(origin at top, left) to OpenGL (origin at bottom,left).
I fixed that in my latest patch[1].

[1] http://linkmauve.fr/files/fix-7141.patch

2013/5/10 Martin Gerhardy <martin.gerhardy at gmail.com>> Am 10.05.2013 15:13, schrieb Emmanuel Gil Peyrot:

On Fri, May 10, 2013 at 09:51:47AM -0300, Gabriel Jacobo wrote:

2013/5/10 Martin Gerhardy <martin.gerhardy at gmail.com>

[snip]

The glScissor calls are wrong, too? The rect is not given in x, y, w, h

to glScissor.

True, I didn?t look at the arguments at all, assuming they were
correct. It seems they used the same coordinates as the d3d renderer.

And I think it also doesn’t translate the convention from SDL coordinates

(origin at top, left) to OpenGL (origin at bottom,left).

I fixed that in my latest patch[1].

[1] http://linkmauve.fr/files/fix-**7141.patchhttp://linkmauve.fr/files/fix-7141.patch

sorry, but this is still not correct.

you have to do:

int lowerLeft = window->height - rect.y - rect.height;
glScissor(rect.x, lowerLeft, rect.width, rect.height);

I hope there is no typo in this… and I hope I’m right with this :wink:

Greetings
Martin

Yes, you are absolutely right!


Gabriel.

2013/5/10 Martin Gerhardy <@Martin_Gerhardy
mailto:Martin_Gerhardy>

        2013/5/10 Martin Gerhardy <@Martin_Gerhardy
        <mailto:@Martin_Gerhardy>>

    [snip]

              The glScissor calls are wrong, too? The rect is not
            given in x, y, w, h
            to glScissor.

    True, I didn't look at the arguments at all, assuming they were
    correct.  It seems they used the same coordinates as the d3d
    renderer.

        And I think it also doesn't translate the convention from
        SDL coordinates
        (origin at top, left) to OpenGL (origin at bottom,left).

    I fixed that in my latest patch[1].

    [1] http://linkmauve.fr/files/fix-7141.patch


sorry, but this is still not correct.

you have to do:

int lowerLeft = window->height - rect.y - rect.height;
glScissor(rect.x, lowerLeft, rect.width, rect.height);

I hope there is no typo in this... and I hope I'm right with this ;)

Greetings
Martin

Yes, you are absolutely right!


Gabriel.

http://bugzilla.libsdl.org/show_bug.cgi?id=1844

here is the patch for the issue.

Regards
MartinAm 10.05.2013 21:15, schrieb Gabriel Jacobo:

Am 10.05.2013 15:13, schrieb Emmanuel Gil Peyrot:
    On Fri, May 10, 2013 at 09:51:47AM -0300, Gabriel Jacobo wrote: