FX_ENTRY void FX_CALL grDrawPoint( const void *pt ) { float *x = (float*)pt + xy_off/sizeof(float); float *y = (float*)pt + xy_off/sizeof(float) + 1; float *z = (float*)pt + z_off/sizeof(float); float *q = (float*)pt + q_off/sizeof(float); unsigned char *pargb = (unsigned char*)pt + pargb_off; float *s0 = (float*)pt + st0_off/sizeof(float); float *t0 = (float*)pt + st0_off/sizeof(float) + 1; float *s1 = (float*)pt + st1_off/sizeof(float); float *t1 = (float*)pt + st1_off/sizeof(float) + 1; float *fog = (float*)pt + fog_ext_off/sizeof(float); LOG("grDrawPoint()\r\n"); if(nvidia_viewport_hack && !render_to_texture) { glViewport(0, viewport_offset, viewport_width, viewport_height); nvidia_viewport_hack = 0; } reloadTexture(); if(need_to_compile) compile_shader(); glBegin(GL_POINTS); if (nbTextureUnits > 2) { if (st0_en) glMultiTexCoord2fARB(GL_TEXTURE1_ARB, *s0 / *q / (float)tex1_width, ytex(0, *t0 / *q / (float)tex1_height)); if (st1_en) glMultiTexCoord2fARB(GL_TEXTURE0_ARB, *s1 / *q / (float)tex0_width, ytex(1, *t1 / *q / (float)tex0_height)); } else { if (st0_en) glTexCoord2f(*s0 / *q / (float)tex0_width, ytex(0, *t0 / *q / (float)tex0_height)); } if (pargb_en) glColor4f(pargb[2]/255.0f, pargb[1]/255.0f, pargb[0]/255.0f, pargb[3]/255.0f); if (fog_enabled && fog_coord_support) { if(!fog_ext_en || fog_enabled != 2) glSecondaryColor3f((1.0f / *q) / 255.0f, 0.0f, 0.0f); else glSecondaryColor3f((1.0f / *fog) / 255.0f, 0.0f, 0.0f); } glVertex4f((*x - (float)widtho) / (float)(width/2) / *q, -(*y - (float)heighto) / (float)(height/2) / *q, ZCALC(*z ,*q), 1.0f / *q); glEnd(); }
inline void VL_glSecondaryColor3f(float r, float g, float b) { if(glSecondaryColor3f) glSecondaryColor3f(r,g,b); else if(glSecondaryColor3fEXT) glSecondaryColor3fEXT(r,g,b); else VL_UNSUPPORTED_FUNC(); }
inline void VL_glSecondaryColor3f(float r, float g, float b) { #ifdef GL_VERSION_1_4_DEPRECATED if(glSecondaryColor3f) glSecondaryColor3f(r,g,b); else #endif if(glSecondaryColor3fEXT) glSecondaryColor3fEXT(r,g,b); else VL_UNSUPPORTED_FUNC(); }
// This function does any needed initialization on the rendering // context. void SetupRC() { GLint success; const GLchar *vsStringPtr[1]; const GLchar *fsStringPtr[1]; GLchar vsString[] = "void main(void)\n" "{\n" " // This is our Hello World vertex shader\n" " // notice how comments are preceded by '//'\n" "\n" " // normal MVP transform\n" " vec4 clipCoord = gl_ModelViewProjectionMatrix * gl_Vertex;\n" " gl_Position = clipCoord;\n" "\n" " // Copy the primary color\n" " gl_FrontColor = gl_Color;\n" "\n" " // Calculate NDC\n" " vec4 ndc = vec4(clipCoord.xyz, 0) / clipCoord.w;\n" "\n" " // Map from [-1,1] to [0,1] before outputting\n" " gl_FrontSecondaryColor = (ndc * 0.5) + 0.5;\n" "}\n"; GLchar fsString[] = "uniform float flickerFactor;\n" "\n" "void main(void)\n" "{\n" " // Mix primary and secondary colors, 50/50\n" " vec4 temp = mix(gl_Color, vec4(vec3(gl_SecondaryColor), 1.0), 0.5);\n" "\n" " // Multiply by flicker factor\n" " gl_FragColor = temp * flickerFactor;\n" "}\n"; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glColor4f(1.0f, 0.0f, 0.0f, 1.0f); // Make sure required functionality is available! if (!GLEE_VERSION_2_0 && (!GLEE_ARB_vertex_shader || !GLEE_ARB_fragment_shader || !GLEE_ARB_shader_objects || !GLEE_ARB_shading_language_100)) { //gltPrintf(GLUT_BITMAP_9_BY_15, 0, 3, "GLSL extensions not available!"); glutSwapBuffers(); Sleep(2000); exit(0); } if (!GLEE_VERSION_1_4 && !GLEE_EXT_secondary_color) { //gltPrintf(GLUT_BITMAP_9_BY_15, 0, 3, "Neither OpenGL 1.4 nor GL_EXT_secondary_color"); //gltPrintf(GLUT_BITMAP_9_BY_15, 1, 3, " extension is available!"); glutSwapBuffers(); Sleep(2000); exit(0); } // Black background glClearColor(0.0f, 0.0f, 0.0f, 1.0f ); glSecondaryColor3f(1.0f, 1.0f, 1.0f); // Hidden surface removal glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glShadeModel(GL_SMOOTH); // Create shader objects and specify shader text vShader = glCreateShader(GL_VERTEX_SHADER); fShader = glCreateShader(GL_FRAGMENT_SHADER); vsStringPtr[0] = vsString; glShaderSource(vShader, 1, vsStringPtr, NULL); fsStringPtr[0] = fsString; glShaderSource(fShader, 1, fsStringPtr, NULL); // Compile shaders and check for any errors glCompileShader(vShader); glGetShaderiv(vShader, GL_COMPILE_STATUS, &success); if (!success) { GLchar infoLog[MAX_INFO_LOG_SIZE]; glGetShaderInfoLog(vShader, MAX_INFO_LOG_SIZE, NULL, infoLog); //gltPrintf(GLUT_BITMAP_9_BY_15, 0, 0, "Error in vertex shader compilation! Info log:"); //gltPrintf(GLUT_BITMAP_HELVETICA_10, 2, 0, "%s", infoLog); glutSwapBuffers(); Sleep(5000); exit(0); } glCompileShader(fShader); glGetShaderiv(fShader, GL_COMPILE_STATUS, &success); if (!success) { GLchar infoLog[MAX_INFO_LOG_SIZE]; glGetShaderInfoLog(fShader, MAX_INFO_LOG_SIZE, NULL, infoLog); //gltPrintf(GLUT_BITMAP_9_BY_15, 0, 0, "Error in fragment shader compilation! Info log:"); //gltPrintf(GLUT_BITMAP_HELVETICA_10, 2, 0, "%s", infoLog); glutSwapBuffers(); Sleep(5000); exit(0); } // Create program object, attach shaders, then link progObj = glCreateProgram(); if (useVertexShader) glAttachShader(progObj, vShader); if (useFragmentShader) glAttachShader(progObj, fShader); Link(GL_TRUE); }
void RfxState::SetGLEnvironment() { switch (state) { case GL_CurrentColor: { GLfloat *res = DecodeColor(value); glColor3f(res[0], res[1], res[2]); delete res; } case GL_SecondaryColor: { GLfloat *res = DecodeColor(value); glSecondaryColor3f(res[0], res[1], res[2]); delete res; break; } case GL_ClearColor: { GLfloat *res = DecodeColor(value); glClearColor(res[0], res[1], res[2], res[3]); delete res; break; } case GL_ClearDepth: glClearDepth(value); break; case GL_ShadeModel: glShadeModel((value == 1)? GL_FLAT : GL_SMOOTH); break; case GL_FrontFace: glFrontFace((value == 1)? GL_CCW : GL_CW); break; case GL_CullMode: if (value == 1) { glDisable(GL_CULL_FACE); } else { glEnable(GL_CULL_FACE); glCullFace((value == 2)? GL_FRONT : ((value == 3)? GL_BACK : GL_FRONT_AND_BACK)); } break; case GL_EdgeFlag: glEdgeFlag(value); break; case GL_DepthNear: case GL_DepthFar: { GLfloat range[2]; glGetFloatv(GL_DEPTH_RANGE, range); if (state == GL_DepthNear) glDepthRange(value, range[1]); else glDepthRange(range[0], value); break; } case GL_FogColor: { glFogfv(GL_FOG_COLOR, DecodeColor(value)); break; } case GL_FogDensity: glFogi(GL_FOG_DENSITY, value); break; case GL_FogStart: glFogi(GL_FOG_START, value); break; case GL_FogEnd: glFogi(GL_FOG_END, value); break; case GL_FogMode: glEnable(GL_FOG); switch ((GLint)value) { case 1: // NONE glDisable(GL_FOG); break; case 2: // LINEAR glFogi(GL_FOG_MODE, GL_LINEAR); break; case 3: // EXP glFogi(GL_FOG_MODE, GL_EXP); break; case 4: // EXP2 glFogi(GL_FOG_MODE, GL_EXP2); break; default: // UNKNOWN break; } break; case GL_PointSize: glPointSize(value); break; case GL_PointMin: glPointParameterf(GL_POINT_SIZE_MIN, value); break; case GL_PointMax: glPointParameterf(GL_POINT_SIZE_MAX_ARB, value); break; case GL_PointSmooth: GLEnableDisable(GL_POINT_SMOOTH); break; case GL_LineWidth: glLineWidth(value); break; case GL_LineSmooth: GLEnableDisable(GL_LINE_SMOOTH); break; case GL_PolyFrontMode: glPolygonMode(GL_FRONT, (value == 1)? GL_POINT : ((value == 2)? GL_LINE : GL_FILL)); break; case GL_PolyBackMode: glPolygonMode(GL_BACK, (value == 1)? GL_POINT : ((value == 2)? GL_LINE : GL_FILL)); break; case GL_PolySmooth: GLEnableDisable(GL_POLYGON_SMOOTH); break; case GL_PolyOffsetFactor: { GLfloat units; glGetFloatv(GL_POLYGON_OFFSET_UNITS, &units); glPolygonOffset(value, units); break; } case GL_PolyOffsetUnits: { GLfloat factor; glGetFloatv(GL_POLYGON_OFFSET_FACTOR, &factor); glPolygonOffset(factor, value); break; } case GL_PolyOffsetPoint: GLEnableDisable(GL_POLYGON_OFFSET_POINT); break; case GL_PolyOffsetLine: GLEnableDisable(GL_POLYGON_OFFSET_LINE); break; case GL_PolyOffsetFill: GLEnableDisable(GL_POLYGON_OFFSET_FILL); break; case GL_AlphaEnable: GLEnableDisable(GL_ALPHA_TEST); break; case GL_AlphaFunction: { GLfloat ref; glGetFloatv(GL_ALPHA_TEST_REF, &ref); glAlphaFunc(GLFunctionMode(), ref); break; } case GL_AlphaReference: { GLint func; glGetIntegerv(GL_ALPHA_TEST_FUNC, &func); glAlphaFunc(func, value); break; } case GL_DepthEnable: GLEnableDisable(GL_DEPTH_TEST); break; case GL_DepthFunction: glDepthFunc(GLFunctionMode()); break; case GL_BlendEnable: GLEnableDisable(GL_BLEND); break; case GL_BlendColor: { GLfloat *res = DecodeColor(value); glBlendColor(res[0], res[1], res[2], res[3]); delete res; break; } case GL_BlendSourceRGB: case GL_BlendDestRGB: case GL_BlendSourceAlpha: case GL_BlendDestAlpha: { GLint srcdst[4]; glGetIntegerv(GL_BLEND_SRC_RGB, &srcdst[0]); glGetIntegerv(GL_BLEND_DST_RGB, &srcdst[1]); glGetIntegerv(GL_BLEND_SRC_ALPHA, &srcdst[2]); glGetIntegerv(GL_BLEND_DST_ALPHA, &srcdst[3]); glBlendFuncSeparate( ((state == GL_BlendSourceRGB)? GLColorMode() : srcdst[0]), ((state == GL_BlendDestRGB)? GLColorMode() : srcdst[1]), ((state == GL_BlendSourceAlpha)? GLColorMode() : srcdst[2]), ((state == GL_BlendDestAlpha)? GLColorMode() : srcdst[3])); break; } case GL_BlendEquation: switch ((GLint)value) { case 1: // ADD glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD); break; case 2: // SUBTRACT glBlendEquationSeparate(GL_FUNC_SUBTRACT, GL_FUNC_SUBTRACT); break; case 3: // REV_SUBTRACT glBlendEquationSeparate(GL_FUNC_REVERSE_SUBTRACT, GL_FUNC_REVERSE_SUBTRACT); break; case 4: // MIN glBlendEquationSeparate(GL_MIN, GL_MIN); break; case 5: // MAX glBlendEquationSeparate(GL_MAX, GL_MAX); break; } break; case GL_WriteMaskColor: { GLint val = (GLint)value; GLboolean par[4]; par[3] = (val > 8)? GL_TRUE : GL_FALSE; par[2] = (val -= (8 * par[3]) > 4)? GL_TRUE : GL_FALSE; par[1] = (val -= (4 * par[2]) > 2)? GL_TRUE : GL_FALSE; par[0] = (val -= (2 * par[1]) > 1)? GL_TRUE : GL_FALSE; glColorMask(par[0], par[1], par[2], par[3]); break; } case GL_WriteMaskDepth: glDepthMask(value); break; case GL_VertexProgramTwoSideARB: GLEnableDisable(GL_VERTEX_PROGRAM_TWO_SIDE_ARB); break; case GL_StencilEnable: GLEnableDisable(GL_STENCIL_TEST); break; case GL_StencilFunction: case GL_StencilValueMask: case GL_StencilReference: { GLint StFun[3]; glGetIntegerv(GL_STENCIL_FUNC, &StFun[0]); glGetIntegerv(GL_STENCIL_VALUE_MASK, &StFun[1]); glGetIntegerv(GL_STENCIL_REF, &StFun[2]); glStencilFunc( (state == GL_StencilFunction)? GLFunctionMode() : StFun[0], (state == GL_StencilValueMask)? value : StFun[1], (state == GL_StencilReference)? value : StFun[2]); break; } case GL_StencilFail: case GL_StencilPassDepthFail: case GL_StencilPassDepthPass: { GLint StOp[3]; glGetIntegerv(GL_STENCIL_FAIL, &StOp[0]); glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL, &StOp[1]); glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS, &StOp[2]); // thanks god at least these values are equivalent to OpenGL ones, // no mapping needed. glStencilOp( (state == GL_StencilFail)? value : StOp[0], (state == GL_StencilPassDepthFail)? value : StOp[1], (state == GL_StencilPassDepthPass)? value : StOp[2]); break; } case GL_WriteMaskStencil: glStencilMask(value); break; case GL_ClearStencil: glClearStencil(value); break; default: // do nothing, unsupported state break; } }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL14_nglSecondaryColor3f(JNIEnv *env, jclass clazz, jfloat red, jfloat green, jfloat blue, jlong function_pointer) { glSecondaryColor3fPROC glSecondaryColor3f = (glSecondaryColor3fPROC)((intptr_t)function_pointer); glSecondaryColor3f(red, green, blue); }
void glSecondaryColor3fv(const GLfloat *v) { glSecondaryColor3f(v[0], v[1], v[2]); }
FX_ENTRY void FX_CALL grDrawVertexArrayContiguous(FxU32 mode, FxU32 Count, void *pointers, FxU32 stride) { unsigned int i; float *x, *y, *q, *s0, *t0, *s1, *t1, *z, *fog; unsigned char *pargb; LOG("grDrawVertexArrayContiguous(%d,%d,%d)\r\n", mode, Count, stride); if(nvidia_viewport_hack && !render_to_texture) { glViewport(0, viewport_offset, viewport_width, viewport_height); nvidia_viewport_hack = 0; } reloadTexture(); if(need_to_compile) compile_shader(); switch(mode) { case GR_TRIANGLE_STRIP: glBegin(GL_TRIANGLE_STRIP); break; case GR_TRIANGLE_FAN: glBegin(GL_TRIANGLE_FAN); break; default: display_warning("grDrawVertexArrayContiguous : unknown mode : %x", mode); } for (i=0; i<Count; i++) { x = (float*)((unsigned char*)pointers+stride*i) + xy_off/sizeof(float); y = (float*)((unsigned char*)pointers+stride*i) + xy_off/sizeof(float) + 1; z = (float*)((unsigned char*)pointers+stride*i) + z_off/sizeof(float); q = (float*)((unsigned char*)pointers+stride*i) + q_off/sizeof(float); pargb = (unsigned char*)pointers+stride*i + pargb_off; s0 = (float*)((unsigned char*)pointers+stride*i) + st0_off/sizeof(float); t0 = (float*)((unsigned char*)pointers+stride*i) + st0_off/sizeof(float) + 1; s1 = (float*)((unsigned char*)pointers+stride*i) + st1_off/sizeof(float); t1 = (float*)((unsigned char*)pointers+stride*i) + st1_off/sizeof(float) + 1; fog = (float*)((unsigned char*)pointers+stride*i) + fog_ext_off/sizeof(float); //if(*fog == 0.0f) *fog = 1.0f; if (nbTextureUnits > 2) { if (st0_en) glMultiTexCoord2fARB(GL_TEXTURE1_ARB, *s0 / *q / (float)tex1_width, ytex(0, *t0 / *q / (float)tex1_height)); if (st1_en) glMultiTexCoord2fARB(GL_TEXTURE0_ARB, *s1 / *q / (float)tex0_width, ytex(1, *t1 / *q / (float)tex0_height)); } else { if (st0_en) glTexCoord2f(*s0 / *q / (float)tex0_width, ytex(0, *t0 / *q / (float)tex0_height)); } if (pargb_en) glColor4f(pargb[2]/255.0f, pargb[1]/255.0f, pargb[0]/255.0f, pargb[3]/255.0f); if (fog_enabled && fog_coord_support) { if(!fog_ext_en || fog_enabled != 2) glSecondaryColor3f((1.0f / *q) / 255.0f, 0.0f, 0.0f); else glSecondaryColor3f((1.0f / *fog) / 255.0f, 0.0f, 0.0f); } glVertex4f((*x - (float)widtho) / (float)(width/2) / *q, -(*y - (float)heighto) / (float)(height/2) / *q, ZCALC(*z, *q), 1.0f / *q); } glEnd(); }
FX_ENTRY void FX_CALL grDrawLine( const void *a, const void *b ) { float *a_x = (float*)a + xy_off/sizeof(float); float *a_y = (float*)a + xy_off/sizeof(float) + 1; float *a_z = (float*)a + z_off/sizeof(float); float *a_q = (float*)a + q_off/sizeof(float); unsigned char *a_pargb = (unsigned char*)a + pargb_off; float *a_s0 = (float*)a + st0_off/sizeof(float); float *a_t0 = (float*)a + st0_off/sizeof(float) + 1; float *a_s1 = (float*)a + st1_off/sizeof(float); float *a_t1 = (float*)a + st1_off/sizeof(float) + 1; float *a_fog = (float*)a + fog_ext_off/sizeof(float); float *b_x = (float*)b + xy_off/sizeof(float); float *b_y = (float*)b + xy_off/sizeof(float) + 1; float *b_z = (float*)b + z_off/sizeof(float); float *b_q = (float*)b + q_off/sizeof(float); unsigned char *b_pargb = (unsigned char*)b + pargb_off; float *b_s0 = (float*)b + st0_off/sizeof(float); float *b_t0 = (float*)b + st0_off/sizeof(float) + 1; float *b_s1 = (float*)b + st1_off/sizeof(float); float *b_t1 = (float*)b + st1_off/sizeof(float) + 1; float *b_fog = (float*)b + fog_ext_off/sizeof(float); LOG("grDrawLine()\r\n"); if(nvidia_viewport_hack && !render_to_texture) { glViewport(0, viewport_offset, viewport_width, viewport_height); nvidia_viewport_hack = 0; } reloadTexture(); if(need_to_compile) compile_shader(); glBegin(GL_LINES); if (nbTextureUnits > 2) { if (st0_en) glMultiTexCoord2fARB(GL_TEXTURE1_ARB, *a_s0 / *a_q / (float)tex1_width, ytex(0, *a_t0 / *a_q / (float)tex1_height)); if (st1_en) glMultiTexCoord2fARB(GL_TEXTURE0_ARB, *a_s1 / *a_q / (float)tex0_width, ytex(1, *a_t1 / *a_q / (float)tex0_height)); } else { if (st0_en) glTexCoord2f(*a_s0 / *a_q / (float)tex0_width, ytex(0, *a_t0 / *a_q / (float)tex0_height)); } if (pargb_en) glColor4f(a_pargb[2]/255.0f, a_pargb[1]/255.0f, a_pargb[0]/255.0f, a_pargb[3]/255.0f); if (fog_enabled && fog_coord_support) { if(!fog_ext_en || fog_enabled != 2) glSecondaryColor3f((1.0f / *a_q) / 255.0f, 0.0f, 0.0f); else glSecondaryColor3f((1.0f / *a_fog) / 255.0f, 0.0f, 0.0f); } glVertex4f((*a_x - (float)widtho) / (float)(width/2) / *a_q, -(*a_y - (float)heighto) / (float)(height/2) / *a_q, ZCALC(*a_z, *a_q), 1.0f / *a_q); if (nbTextureUnits > 2) { if (st0_en) glMultiTexCoord2fARB(GL_TEXTURE1_ARB, *b_s0 / *b_q / (float)tex1_width, ytex(0, *b_t0 / *b_q / (float)tex1_height)); if (st1_en) glMultiTexCoord2fARB(GL_TEXTURE0_ARB, *b_s1 / *b_q / (float)tex0_width, ytex(1, *b_t1 / *b_q / (float)tex0_height)); } else { if (st0_en) glTexCoord2f(*b_s0 / *b_q / (float)tex0_width, ytex(0, *b_t0 / *b_q / (float)tex0_height)); } if (pargb_en) glColor4f(b_pargb[2]/255.0f, b_pargb[1]/255.0f, b_pargb[0]/255.0f, b_pargb[3]/255.0f); if (fog_enabled && fog_coord_support) { if(!fog_ext_en || fog_enabled != 2) glSecondaryColor3f((1.0f / *b_q) / 255.0f, 0.0f, 0.0f); else glSecondaryColor3f((1.0f / *b_fog) / 255.0f, 0.0f, 0.0f); } glVertex4f((*b_x - (float)widtho) / (float)(width/2) / *b_q, -(*b_y - (float)heighto) / (float)(height/2) / *b_q, ZCALC(*b_z, *b_q), 1.0f / *b_q); glEnd(); }
static void ff_render(struct glw_root *gr, const Mtx m, const struct glw_backend_texture *t0, const struct glw_backend_texture *t1, const struct glw_rgb *rgb_mul, const struct glw_rgb *rgb_off, float alpha, float blur, const float *vertices, int num_vertices, const uint16_t *indices, int num_triangles, int flags) { glw_backend_root_t *gbr = &gr->gr_be; float r,g,b; switch(gbr->gbr_blendmode) { case GLW_BLEND_NORMAL: r = rgb_mul->r; g = rgb_mul->g; b = rgb_mul->b; break; case GLW_BLEND_ADDITIVE: r = rgb_mul->r * alpha; g = rgb_mul->g * alpha; b = rgb_mul->b * alpha; break; default: return; } glLoadMatrixf(glw_mtx_get(m) ?: glw_identitymtx); glVertexPointer(3, GL_FLOAT, sizeof(float) * VERTEX_SIZE, vertices); if(flags & GLW_RENDER_COLOR_ATTRIBUTES) { int i; glw_vtmp_resize(gr, num_vertices * 4); for(i = 0; i < num_vertices; i++) { gr->gr_vtmp_buffer[i * 4 + 0] = vertices[i * VERTEX_SIZE + 4] * r; gr->gr_vtmp_buffer[i * 4 + 1] = vertices[i * VERTEX_SIZE + 5] * g; gr->gr_vtmp_buffer[i * 4 + 2] = vertices[i * VERTEX_SIZE + 6] * b; gr->gr_vtmp_buffer[i * 4 + 3] = vertices[i * VERTEX_SIZE + 7] * alpha; } glEnableClientState(GL_COLOR_ARRAY); glColorPointer(4, GL_FLOAT, 0, gr->gr_vtmp_buffer); } else { glColor4f(r, g, b, alpha); } if(rgb_off != NULL) { glEnable(GL_COLOR_SUM); glSecondaryColor3f(rgb_off->r, rgb_off->g, rgb_off->b); } if(t0 == NULL) { glBindTexture(gbr->gbr_primary_texture_mode, 0); glDisableClientState(GL_TEXTURE_COORD_ARRAY); } else { glBindTexture(gbr->gbr_primary_texture_mode, t0->tex); glTexCoordPointer(2, GL_FLOAT, sizeof(float) * VERTEX_SIZE, vertices + 8); } if(indices != NULL) glDrawElements(GL_TRIANGLES, 3 * num_triangles, GL_UNSIGNED_SHORT, indices); else glDrawArrays(GL_TRIANGLES, 0, num_vertices); if(rgb_off != NULL) glDisable(GL_COLOR_SUM); if(flags & GLW_RENDER_COLOR_ATTRIBUTES) glDisableClientState(GL_COLOR_ARRAY); if(t0 == NULL) glEnableClientState(GL_TEXTURE_COORD_ARRAY); }