29 #include "../idlib/precompiled.h"
38 static void cg_error_callback(
void ) {
88 static const float zero[4] = { 0, 0, 0, 0 };
89 static const float one[4] = { 1, 1, 1, 1 };
90 static const float negOne[4] = { -1, -1, -1, -1 };
334 static const int MAX_GLPROGS = 200;
368 idStr fullPath =
"glprogs/";
369 fullPath += progs[progIndex].
name;
385 buffer = (
char *)_alloca( strlen( fileBuffer ) + 1 );
386 strcpy( buffer, fileBuffer );
396 if ( progs[progIndex].ident == 0 ) {
406 common->
Printf(
": GL_VERTEX_PROGRAM_ARB not available\n" );
409 start = strstr( (
char *)buffer,
"!!ARBvp" );
413 common->
Printf(
": GL_FRAGMENT_PROGRAM_ARB not available\n" );
416 start = strstr( (
char *)buffer,
"!!ARBfp" );
422 end = strstr( start,
"END" );
434 strlen( start ), (
unsigned char *)start );
438 if ( err == GL_INVALID_OPERATION ) {
440 common->
Printf(
"\nGL_PROGRAM_ERROR_STRING_ARB: %s\n", str );
442 common->
Printf(
"GL_PROGRAM_ERROR_POSITION_ARB < 0 with error\n" );
443 }
else if ( ofs >= (
int)strlen( (
char *)start ) ) {
451 common->
Printf(
"\nGL_PROGRAM_ERROR_POSITION_ARB != -1 without error\n" );
473 for ( i = 0 ; progs[
i].
name[0] ; i++ ) {
474 if ( progs[i].target != target ) {
486 if ( i == MAX_GLPROGS ) {
493 strncpy( progs[i].
name, program,
sizeof( progs[i].name ) - 1 );
509 for ( i = 0 ; progs[
i].
name[0] ; i++ ) {
524 common->
Printf(
"---------- R_ARB2_Init ----------\n" );
533 common->
Printf(
"---------------------------------\n" );
idImage * specular2DTableImage
const int GLS_DSTBLEND_ONE
const srfTriangles_t * geo
const int GLS_DEPTHFUNC_LESS
void GL_SelectTextureNoClient(int unit)
PFNGLVERTEXATTRIBPOINTERARBPROC qglVertexAttribPointerARB
#define qglEnableClientState
#define qglDisableClientState
stageVertexColor_t vertexColor
idCVar r_testARBProgram("r_testARBProgram","0", CVAR_RENDERER|CVAR_BOOL,"experiment with vertex/fragment programs")
idCVar r_skipTranslucent("r_skipTranslucent","0", CVAR_RENDERER|CVAR_BOOL,"skip the translucent interaction rendering")
idCVar r_useShadowVertexProgram("r_useShadowVertexProgram","1", CVAR_RENDERER|CVAR_BOOL,"do the shadow projection in the vertex program on capable cards")
const float * ToFloatPtr(void) const
virtual int ReadFile(const char *relativePath, void **buffer, ID_TIME_T *timestamp=NULL)=0
void RB_ARB2_DrawInteraction(const drawInteraction_t *din)
PFNGLDISABLEVERTEXATTRIBARRAYARBPROC qglDisableVertexAttribArrayARB
idFileSystem * fileSystem
void RB_ARB2_DrawInteractions(void)
const struct drawSurf_s * localShadows
const struct drawSurf_s * globalInteractions
#define GL_PROGRAM_ERROR_POSITION_ARB
bool IsBlendLight() const
struct vertCache_s * ambientCache
virtual void FreeFile(void *buffer)=0
bool IsAmbientLight() const
void R_LoadARBProgram(int progIndex)
int Icmp(const char *text) const
const idMaterial * lightShader
const int GLS_DEPTHFUNC_EQUAL
void RB_CreateSingleDrawInteractions(const drawSurf_t *surf, void(*DrawInteraction)(const drawInteraction_t *))
struct viewLight_s * next
idImage * ambientNormalMap
struct viewLight_s * viewLights
struct _CGcontext * CGcontext
idStr & StripFileExtension(void)
idImage * normalCubeMapImage
PFNGLENABLEVERTEXATTRIBARRAYARBPROC qglEnableVertexAttribArrayARB
idImage * lightFalloffImage
PFNGLBINDPROGRAMARBPROC qglBindProgramARB
const int GLS_SRCBLEND_ONE
idImageManager * globalImages
bool ARBVertexProgramAvailable
const struct drawSurf_s * translucentInteractions
PFNCGGETERRORPROC cgGetError
virtual void Printf(const char *fmt,...) id_attribute((format(printf
void RB_ARB2_CreateDrawInteractions(const drawSurf_t *surf)
#define GL_PROGRAM_ERROR_STRING_ARB
void RB_DrawElementsWithCounters(const srfTriangles_t *tri)
const float * ToFloatPtr(void) const
void RB_LogComment(const char *comment,...)
static WindowRef ValidModeCallbackProc inCallback OSStatus err
const struct drawSurf_s * globalShadows
idVec4 lightProjection[4]
const struct drawSurf_s * localInteractions
void R_ReloadARBPrograms_f(const idCmdArgs &args)
const float * ToFloatPtr(void) const
PFNCGGETERRORSTRINGPROC cgGetErrorString
void * Position(vertCache_t *buffer)
const struct drawSurf_s * nextOnLight
#define GL_VERTEX_PROGRAM_ARB
PFNGLPROGRAMENVPARAMETER4FVARBPROC qglProgramEnvParameter4fvARB
const char * c_str(void) const
idVertexCache vertexCache
#define GL_PROGRAM_FORMAT_ASCII_ARB
void GL_State(int stateBits)
void RB_StencilShadowPass(const drawSurf_t *drawSurfs)
idCVar r_useScissor("r_useScissor","1", CVAR_RENDERER|CVAR_BOOL,"scissor clip as portals and lights are processed")
PFNGLPROGRAMSTRINGARBPROC qglProgramStringARB
void GL_SelectTexture(int unit)
idImage * specularTableImage
virtual void Error(const char *fmt,...) id_attribute((format(printf
typedef GLuint(APIENTRYP PFNGLGENASYNCMARKERSSGIXPROC)(GLsizei range)
idScreenRect currentScissor
bool ARBFragmentProgramAvailable
int R_FindARBProgram(GLenum target, const char *program)
#define GL_FRAGMENT_PROGRAM_ARB
const viewDef_t * viewDef