OpenGL钩,如何修改3D模型颜色?
挂钩游戏是CS 1.6
Hook的Glbegin功能,
我想为角色模型渲染分配颜色,但是代码无效
寻求帮助
void APIENTRY hkGLBegin(GLenum mode)
{
if (mode==5)
{
glEnable(GL_TEXTURE_2D);
glColor4f(0, 0, 0, 0); //TODO FIXME failed
glDisable(GL_TEXTURE_2D);
}
}
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);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不熟悉这种GL黑客攻击,所以我可能错了...但是
您的代码是什么意思是无效的?是否有任何错误消息编译时间或运行时?也许您只需要添加:
或
与您的编译器相关的任何其他缩写...
我不认为
glenable(gl_texture_2d); gldisable(gl_texture_2d);
在glbegin/glend
中允许...如果挂钩在
glbegin
之前,则启用和禁用纹理也将在Hook不调用原始glbegin
您也可能要添加它...因此,我只剩下
glcolor
并删除纹理语句,它们与颜色无关。 ..如果它不起作用,则可能表明CS使用自己的
Glcolor
呼叫或照明尚未启用glenable(gl_color_material);
,因此请尝试添加它。 ..为什么使用
模式== 5
而不是mode == gl_triangle_strip
?这是从gl.h
中获取的,您还确定CS仅使用该原始性吗?如果不是,您也应该处理其他人...
所以我将更改为:
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
glBegin
then enabling and disabling texture will disable texture also if the hook does not call originalglBegin
you might want to add that too...So I would leave just
glColor
and 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
glColor
calls or lighting has not enabledglEnable(GL_COLOR_MATERIAL);
so try to add it ...Why use
mode == 5
instead ofmode == GL_TRIANGLE_STRIP
? This is taken fromgl.h
Also are you sure CS is using that primitive only? if not you should also handle the others too ...
so I would change to: