Public feed #888509

Something

public text v1 · immutable
Raw Edit
·published 2008-02-02 04:51 UTC
rendered paste body
/*hook.h*/

//add this 
void TransChams(int r, int g, int b, int a, int r2, int g2, int b2, int a2);

/* in the .cpp*/

#include <gl/gl.h>
#include <gl/glu.h>
#include <gl/glaux.h>
#pragma comment(lib, "opengl32.lib")
#pragma comment(lib,"OpenGL32.lib")
#pragma comment(lib,"GLu32.lib")
#pragma comment(lib,"GLaux.lib")

void __stdcall h_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)//your func, this maybe differnt.
{
	TransChams(255, 255, 0, 120, 0, 0, 255, 120, mode, count, type, indices);
	o_glDrawElements(mode, count, type, indices);//return to the orig func.
}

void TransColorFunc(int r, int g, int b, int a)
{
    glDisableClientState(GL_COLOR_ARRAY);
    glEnable(GL_COLOR_MATERIAL);
    glColor4ub(r, g, b, a);	
}

void TransChams(int r, int g, int b, int a, int r2, int g2, int b2, int a2,GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
{  
    glPushMatrix();
    glDisable(GL_TEXTURE_2D);
    glEnable(GL_BLEND);	
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);		
    glDisable(GL_DEPTH_TEST);	
    TransColorFunc(r, g, b, a);	
	glDrawElements(mode, count, type, indices);
    TransColorFunc(r2, g2, b2, a2);	
    glEnable(GL_DEPTH_TEST);	
    glPopMatrix();	   
}