DrawWorldPreUnit OpenGL state.

DrawWorldPreUnit OpenGL state.

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

Moderator: Moderators

Post Reply
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

DrawWorldPreUnit OpenGL state.

Post by zwzsg »

What state are DrawWorldPreUnit callins supposed to leave OpenGL in?

gl.ResetState() makes water plane drawn over land and add this weird cylinder sporting some textures picked I don't know how at 0,0,0:

Image

Image

Edit: Tried with gl.PushAttrib(GL.ALL_ATTRIB_BITS) at the begining of the callin, gl.PopMatrix() at the end, it solves the water plane issue, so I think it does save the DepthTest state, but I still have the weird cylinder. Commented my gl.Texture and gl.BeginEnd, so I don't see how it could be my own code drawing it.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: DrawWorldPreUnit OpenGL state.

Post by jK »

zwzsg wrote:Edit: Tried with gl.PushAttrib(GL.ALL_ATTRIB_BITS) at the begining of the callin, gl.PopMatrix() at the end, it solves the water plane issue, so I think it does save the DepthTest state, but I still have the weird cylinder.
o_O

2. You know what states you touched, so you know what states you have to reset. The states' defaults depend on the used callin (and can change with spring releases). gl.ResetStates just reset the states to the one mentioned in the wiki and don't have to be the ones for the specific callin you are using! So either use gl.PushAttrib/PopAttrib or find the defaults yourself for the specific states (either just try&error or/and use glGet).
Post Reply

Return to “Lua Scripts”