ATTN: do NOT use GL_LINES and immediate mode - Page 2

ATTN: do NOT use GL_LINES and immediate mode

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: ATTN: do NOT use GL_LINES and immediate mode

Post by imbaczek »

got more fixes done. turns out /water 1 and /water 3 were leaking texture memory - glBindTexture(GL_TEXTURE_2D, 0) fixed them. removed immediate mode from there for great justice.

moral: clean up after yourself...

edit: i guess i'll have to change the topic - from 'do not' to 'avoid if possible because they can leak but not always do and i don't know when it happens'.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: ATTN: do NOT use GL_LINES and immediate mode

Post by hoijui »

they up required system specs of their games.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: ATTN: do NOT use GL_LINES and immediate mode

Post by Argh »

I just tested CA's customformations2... it doesn't draw anything. I am kinda scratching my head- the Widget's working, just nothing happens when it goes through DrawWorld, etc. This is on nVidia hardware. My stuff with GroundCircles works atm, but I'm wondering if I should remove the stipples, etc. to avoid crashes with ATi or not.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: ATTN: do NOT use GL_LINES and immediate mode

Post by imbaczek »

lemme check that out. edit: master+ca 6796 (stable) works for me.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: ATTN: do NOT use GL_LINES and immediate mode

Post by Argh »

That's bad news for me, then. I haven't the foggiest what could be breaking it.

Had another thought- instead of using LINES, we could use QUAD_STRIP and use a shader to move the texture coordinates every draw frame. That's probably what the pros are doing.

[EDIT]Tested with latest version from CA... it draws in the minimap, but nothing shows up in DrawWorld.[/EDIT]
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: ATTN: do NOT use GL_LINES and immediate mode

Post by Argh »

Moving the draw call to DrawWorldPreUnit() fixed the not-drawing issue over here. Probably some screwup on my part.

Hmm. Here's another thought. May be useless, but... has anybody tried explicitly declaring gl.Texture(0,false) as a safety precaution before invoking GL.LINES? Maybe ATi's drivers are just being really picky about attempting to texture lines... sorry if that sounds crazy, but in all my "fun" experiences with ATi's drivers, it mainly seems like their engineers are obsessed with adhering to the strict letter of the specifications, whereas nVidia's a little more... understanding about these things.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: ATTN: do NOT use GL_LINES and immediate mode

Post by imbaczek »

i think you may be onto something. haven't tried it though.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: ATTN: do NOT use GL_LINES and immediate mode

Post by imbaczek »

it seems catalyst 10.2 fixed this problem. need independent confirmation.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: ATTN: do NOT use GL_LINES and immediate mode

Post by Argh »

Even so... you know how people are about drivers... it'd be safer to just make sure that the behavior can't happen, tbh.
User avatar
det
Moderator
Posts: 737
Joined: 26 Nov 2005, 11:22

Re: ATTN: do NOT use GL_LINES and immediate mode

Post by det »

imbaczek wrote:it seems catalyst 10.2 fixed this problem. need independent confirmation.
I can confirm that.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: ATTN: do NOT use GL_LINES and immediate mode

Post by imbaczek »

Argh wrote:Even so... you know how people are about drivers... it'd be safer to just make sure that the behavior can't happen, tbh.
absolutely, engine fixes for both command lines and water are in master.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: ATTN: do NOT use GL_LINES and immediate mode

Post by Argh »

Wow, that was fast! GJ people!
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: ATTN: do NOT use GL_LINES and immediate mode

Post by hoijui »

baczek had the idea before you mentioned that on the forum.

... somehow even ... finished it before you mentioned it! :o
(time travel involved?!?)
dizekat
Posts: 438
Joined: 07 Dec 2007, 12:10

Re: ATTN: do NOT use GL_LINES and immediate mode

Post by dizekat »

You could emulate immediate mode to some extent in engine (for Lua), by storing all the attributes into an array and drawing it on glEnd. The inconvenient part is determining what attributes are actually used (this could be how driver itself screws up. I've a suspicion the immediate mode is emulated like this in the driver). You could simply allow just the colour attribute and nothing else.
This could be made optional just for the ATI.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: ATTN: do NOT use GL_LINES and immediate mode

Post by imbaczek »

there are even libraries for that, specifically targeting opengl es implementations.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: ATTN: do NOT use GL_LINES and immediate mode

Post by lurker »

There is no replacement in lua? Why can't it use a display list?
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: ATTN: do NOT use GL_LINES and immediate mode

Post by Kloot »

Because display lists are not suited as a replacement for IM (being immutable).
Post Reply

Return to “Lua Scripts”