- Status
- Offline
- Joined
- Mar 3, 2026
- Messages
- 546
- Reaction score
- 7
Anyone here digging into the Stalcraft engine? I've been messing with a glDrawElements hook to get some clean 3D boxes going, but the rendering is being stubborn.
I'm injecting code into the draw call to overlay green lines around specific objects. The logic works, but the color isn't staying static—it shifts depending on the texture or object behind it. Basically, the "green" is blending with the world instead of staying a solid neon.
The current implementation looks like this:
The Issue:
Even with glDisable(GL_DEPTH_TEST) to see them through walls, the lines are picking up tint from the destination buffer. If the object is dark, the green looks fine. If it's a bright texture, the color gets washed out or shifts entirely because of the GL_BLEND state.
I'm trying to figure out how to force a completely static color regardless of the background. Should I be nuking the current texture state or just ditching GL_BLEND for a simple color call?
anyone else dealt with this color shifting in stalcraft?
I'm injecting code into the draw call to overlay green lines around specific objects. The logic works, but the color isn't staying static—it shifts depending on the texture or object behind it. Basically, the "green" is blending with the world instead of staying a solid neon.
The current implementation looks like this:
Code:
glDepthRangef(1, 0.0);
glLineWidth(2.0);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_CONSTANT_COLOR);
glBlendColor(0.0f, 1.0f, 0.0f, 0.0f);
glDisable(GL_DEPTH_TEST);
glBegin(GL_LINES);
{
glVertex3f(0.1f, -0.1f, 0.1f);
glVertex3f(0.1f, 0.1f, 0.1f);
// Drawing logic continues here...
glVertex3f(0.1f, -0.1f, -0.1f);
glVertex3f(0.1f, -0.1f, 0.1f);
}
glEnd();
The Issue:
Even with glDisable(GL_DEPTH_TEST) to see them through walls, the lines are picking up tint from the destination buffer. If the object is dark, the green looks fine. If it's a bright texture, the color gets washed out or shifts entirely because of the GL_BLEND state.
The problem lies in glBlendFunc(GL_ONE, GL_CONSTANT_COLOR). This is telling OpenGL to add the source color to the constant color, which leads to additive blending. If you want a static, solid color that overwrites everything, you usually need to disable blending entirely or use a standard SRC_ALPHA setup while ensuring you've actually set the color via glColor4f.
Stalcraft's rendering pipeline might also be resetting the active texture or shader state right before your hook finishes, which messes with how your lines are rasterized.
Stalcraft's rendering pipeline might also be resetting the active texture or shader state right before your hook finishes, which messes with how your lines are rasterized.
I'm trying to figure out how to force a completely static color regardless of the background. Should I be nuking the current texture state or just ditching GL_BLEND for a simple color call?
anyone else dealt with this color shifting in stalcraft?