void glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint nsides, GLint rings) { doughnut(innerRadius, outerRadius, nsides, rings, GL_LINE_LOOP); }
/* CENTRY */ void APIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint nsides, GLint rings) { glPushAttrib(GL_POLYGON_BIT); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); doughnut(innerRadius, outerRadius, nsides, rings); glPopAttrib(); }
/** * draw_torus: * @solid: TRUE if the torus should be solid. * @inner_radius: inner radius of the torus. * @outer_radius: outer radius of the torus. * @nsides: number of sides for each radial section. * @rings: number of radial divisions for the torus. * * Renders a torus (doughnut) centered at the modeling coordinates * origin whose axis is aligned with the Z axis. * **/ void draw_torus (gboolean solid, double inner_radius, double outer_radius, int nsides, int rings) { if (solid) { doughnut (inner_radius, outer_radius, nsides, rings); } else { glPushAttrib (GL_POLYGON_BIT); glPolygonMode (GL_FRONT_AND_BACK, GL_LINE); doughnut (inner_radius, outer_radius, nsides, rings); glPopAttrib (); } }
static void DisplayRings(void) { /* static const GLfloat boundingBox[6] = { -0.85, 0.85, -0.85, 0.85, -0.7, 0.7 }; */ if (clearFlag) glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glBarrierExecCR_ptr( MASTER_BARRIER ); glPushMatrix(); glRotatef((GLfloat)frame, 1, 0, 0); glRotatef((GLfloat)(-2 * frame), 0, 1, 0); glRotatef((GLfloat)(frame + rank * theta), 0, 0, 1); glTranslatef(0.5, 0, 0); glRotatef(18, 1, 0, 0); glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, colors[rank%7]); /*glChromiumParametervCR_ptr(GL_OBJECT_BBOX_CR, GL_FLOAT, 6, boundingBox);*/ doughnut(r,R, sides, rings); glPopMatrix(); glBarrierExecCR_ptr( MASTER_BARRIER ); /* The crserver only executes the SwapBuffers() for the 0th client. * No need to test for rank==0 as we used to do. */ if (swapFlag) { /* really swap */ crSwapBuffers_ptr( window, 0 ); } else { /* don't really swap, just mark end of frame */ crSwapBuffers_ptr( window, CR_SUPPRESS_SWAP_BIT ); } frame++; crutPostRedisplay(); }
void CTorus::drawGLScene() { PreRender(); glPushMatrix(); glTranslatef(m_locationX, m_locationY, m_locationZ); glMultMatrixf(m_rotation); glScalef(m_sizeX, m_sizeY, m_sizeZ ); glColor3f(m_colourRed, m_colourGreen, m_colourBlue); int stacks= ((CProtoHapticApp*)AfxGetApp())->getStacks(); doughnut ( m_radiusMinor, m_radiusMajor, stacks, stacks, m_drawnFraction ); glPopMatrix(); }
void APIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint nsides, GLint rings) { doughnut(innerRadius, outerRadius, nsides, rings); }
static void redraw(Display *dpy) { int dbg = 0; glXMakeCurrent(dpy, WindowID, Context); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_DEPTH_TEST); glClearColor(0.5, 0.5, 0.5, 0.0); if (MyID == 0) { /* First process */ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); glTranslatef(-1, 0, 0); glRotatef(Rot, 1, 0, 0); glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, Red); doughnut(0.5, 2.0, 20, 30); glPopMatrix(); glFinish(); if (!Sync) { usleep(1000*10); } /* signal second process to render */ if (Sync) { int code = 1; if (dbg) printf("0: send signal\n"); SendData(Sock, &code, sizeof(code)); SendData(Sock, &Rot, sizeof(Rot)); } /* wait for second process to finish rendering */ if (Sync) { int code = 0; if (dbg) printf("0: wait signal\n"); ReceiveData(Sock, &code, sizeof(code)); if (dbg) printf("0: got signal\n"); assert(code == 2); } } else { /* Second process */ /* wait for first process's signal for me to render */ if (Sync) { int code = 0; if (dbg) printf("1: wait signal\n"); ReceiveData(Sock, &code, sizeof(code)); ReceiveData(Sock, &Rot, sizeof(Rot)); if (dbg) printf("1: got signal\n"); assert(code == 1); } /* XXX this clear should not be here, but for some reason, it * makes things _mostly_ work correctly w/ NVIDIA's driver. * There's only occasional glitches. * Without this glClear(), depth buffer for the second process * is pretty much broken. */ /* glClear(GL_DEPTH_BUFFER_BIT); */ glPushMatrix(); glTranslatef(1, 0, 0); glRotatef(Rot + 90 , 1, 0, 0); glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, Blue); doughnut(0.5, 2.0, 20, 30); glPopMatrix(); glFinish(); glXSwapBuffers(dpy, WindowID); usleep(1000*10); /* signal first process that I'm done rendering */ if (Sync) { int code = 2; if (dbg) printf("1: send signal\n"); SendData(Sock, &code, sizeof(code)); } } }
void APIENTRY auxSolidTorus (GLdouble innerRadius, GLdouble outerRadius) { doughnut(innerRadius, outerRadius, 8, 15, GL_QUADS); }
/* Render wire frame or solid tori. If no display list with * the current model size exists, create a new display list. */ void APIENTRY auxWireTorus (GLdouble innerRadius, GLdouble outerRadius) { doughnut(innerRadius, outerRadius, 5, 10, GL_LINE_LOOP); }
static void gltest( void ) { static const int attribs[] = { GLFBDEV_DOUBLE_BUFFER, GLFBDEV_DEPTH_SIZE, 16, GLFBDEV_NONE }; GLFBDevContextPtr ctx; GLFBDevBufferPtr buf; GLFBDevVisualPtr vis; int bytes, r, g, b, a; float ang; int i; printf("GLFBDEV_VENDOR = %s\n", glFBDevGetString(GLFBDEV_VENDOR)); printf("GLFBDEV_VERSION = %s\n", glFBDevGetString(GLFBDEV_VERSION)); /* framebuffer size */ bytes = VarInfo.xres_virtual * VarInfo.yres_virtual * VarInfo.bits_per_pixel / 8; vis = glFBDevCreateVisual( &FixedInfo, &VarInfo, attribs ); assert(vis); buf = glFBDevCreateBuffer( &FixedInfo, &VarInfo, vis, FrameBuffer, NULL, bytes ); assert(buf); ctx = glFBDevCreateContext( vis, NULL ); assert(buf); b = glFBDevMakeCurrent( ctx, buf, buf ); assert(b); /*printf("GL_EXTENSIONS: %s\n", glGetString(GL_EXTENSIONS));*/ glGetIntegerv(GL_RED_BITS, &r); glGetIntegerv(GL_GREEN_BITS, &g); glGetIntegerv(GL_BLUE_BITS, &b); glGetIntegerv(GL_ALPHA_BITS, &a); printf("RED_BITS=%d GREEN_BITS=%d BLUE_BITS=%d ALPHA_BITS=%d\n", r, g, b, a); glClearColor(0.5, 0.5, 1.0, 0); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum(-1, 1, -1, 1, 2, 30); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0, 0, -15); glViewport(0, 0, VarInfo.xres_virtual, VarInfo.yres_virtual); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_DEPTH_TEST); printf("Drawing %d frames...\n", NumFrames); ang = 0.0; for (i = 0; i < NumFrames; i++) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); glRotatef(ang, 1, 0, 0); doughnut(1, 3, 40, 20); glPopMatrix(); glFBDevSwapBuffers(buf); ang += 15.0; } /* clean up */ b = glFBDevMakeCurrent( NULL, NULL, NULL); assert(b); glFBDevDestroyContext(ctx); glFBDevDestroyBuffer(buf); glFBDevDestroyVisual(vis); }
void glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint nsides, GLint rings) { doughnut(innerRadius, outerRadius, nsides, rings, GL_QUADS); }