Hook game is cs 1.6
Hook's glbegin function
I want to assign colors to the character model rendering, but the code is invalid
Ask for help
void APIENTRY hkGLBegin(GLenum mode)
{
if (mode==5)
{
glEnable(GL_TEXTURE_2D);
glColor4f(0, 0, 0, 0); //TODO FIXME failed
glDisable(GL_TEXTURE_2D);
}
}
I am not familiar with this kind of GL hacking so I might be wrong... however
What do you mean by code is invalid? Is there any error message compile time or runtime ? Maybe you just need to add:
or
or any other abbreviation related to your compiler ...
I do not think
glEnable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);are allowed insideglBegin/glEnd...In case the hook is before
glBeginthen enabling and disabling texture will disable texture also if the hook does not call originalglBeginyou might want to add that too...So I would leave just
glColorand remove the texture statement they have nothing to do with color anyway...If it does not work it might suggest that the CS is overiding it with own
glColorcalls or lighting has not enabledglEnable(GL_COLOR_MATERIAL);so try to add it ...Why use
mode == 5instead ofmode == GL_TRIANGLE_STRIP? This is taken fromgl.hAlso are you sure CS is using that primitive only? if not you should also handle the others too ...
so I would change to: