making gl.UnitShape() work in drawscreen with loadidentity

making gl.UnitShape() work in drawscreen with loadidentity

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

Moderator: Moderators

Post Reply
User avatar
Floris
Posts: 611
Joined: 04 Jan 2011, 20:00

making gl.UnitShape() work in drawscreen with loadidentity

Post by Floris »

The widget I want to fix is Idle Builders. But I just don't understand how I can show up the unitshapes when using gl.loadidentity() what the wiki suggests.

The widget code: https://github.com/Balanced-Annihilatio ... s.lua#L292

For now I disabled glLoadIdentity() cause I cant get the models to show when I enable it.

Example whats currently broken about at certain camera positions, fading away to the background color.
Image

the relevant code:

Code: Select all

glPushMatrix()
--glLoadIdentity()
glScissor(X1, Y_MIN, X2 - X1, Y_MAX - Y_MIN)

glTranslate(0.5*(X2+X1), 0.5*(Y_MAX+Y_MIN), 0)
glRotate(18, 1, 0, 0)
glRotate(rot, 0, 1, 0)

CenterUnitDef(drawTable[ct].unitDefID)

glUnitShape(drawTable[ct].unitDefID, GetMyTeamID(), false, true, true)

glScissor(false)
glPopMatrix()
Attachments
screen00449.jpg
(30.24 KiB) Not downloaded yet
Post Reply

Return to “Lua Scripts”