void render (RenderStateFlags state) const { if (m_particle != 0) { glRasterPos3fv(m_origin); GlobalOpenGL().drawString(m_particle->getName()); } }
void NMS_DebugDraw::draw3dText(const Vector& location,const char* textString) { glPushAttrib(GL_LIGHTING_BIT | GL_CURRENT_BIT); // lighting and color mask glDisable(GL_LIGHTING); // need to disable lighting for proper text color glColor4f(0.1f, 1.0f, 0.1f, 0.2f); // set text color float pos[3]; pos[1] = location[NMS_Y]; pos[2] = location[NMS_Z]; const char * tempName = textString; int i = 0; // loop all characters in the string while(*tempName) { pos[0] = location[NMS_X]+i; glRasterPos3fv(pos); // place text position glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_10, *tempName); ++tempName; i+=1; } glEnable(GL_LIGHTING); glPopAttrib(); }
void renderBitmapString(const float position[3], void *font, const char *string) { const char *c; glRasterPos3fv(position); for (c = string; *c != '\0'; c++) { glutBitmapCharacter(font, *c); } }
static void display_string_3d(char *string, float *pos, const uint8_t *col) { glColor3ubv(col); glRasterPos3fv(pos); while (*string) { glutBitmapCharacter(GLUT_BITMAP_8_BY_13, *string++); } }
void glLabeledPoint(idVec3 &color, idVec3 &point, float size, const char *label) { glColor3fv(color); glPointSize(size); glBegin(GL_POINTS); glVertex3fv(point); glEnd(); idVec3 v = point; v.x += 1; v.y += 1; v.z += 1; glRasterPos3fv (v); glCallLists (strlen(label), GL_UNSIGNED_BYTE, label); }
void bglVertex3fv(const float vec[3]) { switch (curmode) { case GL_POINTS: if (pointhack) { glRasterPos3fv(vec); glBitmap(pointhack, pointhack, (float)pointhack / 2.0f, (float)pointhack / 2.0f, 0.0, 0.0, Squaredot); } else { glVertex3fv(vec); } break; } }
/////////////////////////////////////////////////////////////////////////////// // draw a string in 3D space /////////////////////////////////////////////////////////////////////////////// void DrawString3D(const char *str, float pos[3], float color[4], void *font) { glPushAttrib(GL_LIGHTING_BIT | GL_CURRENT_BIT); // lighting and color mask glDisable(GL_LIGHTING); // need to disable lighting for proper text color glColor4fv(color); // set text color glRasterPos3fv(pos); // place text position // loop all characters in the string while(*str) { glutBitmapCharacter(font, *str); ++str; } glEnable(GL_LIGHTING); glPopAttrib(); }
static void Draw(void) { float mapI[2], mapIA[2], mapIR[2]; glClear(GL_COLOR_BUFFER_BIT); mapI[0] = 0.0; mapI[1] = 1.0; mapIR[0] = 0.0; mapIR[1] = 0.0; mapIA[0] = 1.0; mapIA[1] = 1.0; glPixelMapfv(GL_PIXEL_MAP_I_TO_R, 2, mapIR); glPixelMapfv(GL_PIXEL_MAP_I_TO_G, 2, mapI); glPixelMapfv(GL_PIXEL_MAP_I_TO_B, 2, mapI); glPixelMapfv(GL_PIXEL_MAP_I_TO_A, 2, mapIA); glPixelTransferi(GL_MAP_COLOR, GL_TRUE); SetColor(COLOR_WHITE); glRasterPos3fv(boxA); glPixelStorei(GL_UNPACK_ROW_LENGTH, 24); glPixelStorei(GL_UNPACK_SKIP_PIXELS, 8); glPixelStorei(GL_UNPACK_SKIP_ROWS, 2); glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glBitmap(16, 12, 8.0, 0.0, 0.0, 0.0, logo_bits); glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); glPixelStorei(GL_UNPACK_LSB_FIRST, GL_TRUE); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); SetColor(COLOR_WHITE); glRasterPos3fv(boxB); glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0, OpenGL_bits1); glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0, OpenGL_bits2); SetColor(COLOR_YELLOW); glRasterPos3fv(boxC); glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0, OpenGL_bits1); glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0, OpenGL_bits2); SetColor(COLOR_CYAN); glRasterPos3fv(boxD); glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0, OpenGL_bits1); glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0, OpenGL_bits2); SetColor(COLOR_RED); glRasterPos3fv(boxE); glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0, OpenGL_bits1); glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0, OpenGL_bits2); glFlush(); if (doubleBuffer) { glutSwapBuffers(); } }
M(void, glRasterPos3fv, jobject v) { glRasterPos3fv(BUFF(GLfloat, v)); }
///////////////////////////////////////////////////////// // Render // void GEMglRasterPos3fv :: render(GemState *state) { glRasterPos3fv (v); }
void __glXDisp_RasterPos3fv(GLbyte *pc) { glRasterPos3fv( (GLfloat *)(pc + 0) ); }
static void Redisplay(void) { static const GLfloat px[3] = { 1.2, 0, 0}; static const GLfloat nx[3] = {-1.2, 0, 0}; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); glRotatef(Xrot, 1.0f, 0.0f, 0.0f); glRotatef(Yrot, 0.0f, 1.0f, 0.0f); glEnable(GL_LIGHTING); glPushMatrix(); glScalef(0.5, 0.5, 0.5); glutSolidDodecahedron(); glPopMatrix(); glDisable(GL_LIGHTING); glColor3f(0, 1, 0); glBegin(GL_LINES); glVertex3f(-1, 0, 0); glVertex3f( 1, 0, 0); glEnd(); glColor3f(1, 1, 0); if (Bitmap) { glRasterPos3fv(px); BitmapText("+X"); glRasterPos3fv(nx); BitmapText("-X"); } else { glUseProgram(Program); /* vertex positions (deltas) depend on texture size and window size */ if (uScale != -1) { glUniform2f(uScale, 2.0 * TEX_WIDTH / WinWidth, 2.0 * TEX_HEIGHT / WinHeight); } /* draw +X */ glBindTexture(GL_TEXTURE_2D, Textures[0]); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3fv(px); glTexCoord2f(1, 0); glVertex3fv(px); glTexCoord2f(1, 1); glVertex3fv(px); glTexCoord2f(0, 1); glVertex3fv(px); glEnd(); /* draw -X */ glBindTexture(GL_TEXTURE_2D, Textures[1]); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3fv(nx); glTexCoord2f(1, 0); glVertex3fv(nx); glTexCoord2f(1, 1); glVertex3fv(nx); glTexCoord2f(0, 1); glVertex3fv(nx); glEnd(); glUseProgram(0); } glPopMatrix(); glutSwapBuffers(); }
// create and display volume rendered image void createlocalimage(int rank) { int i=0, j=0; float u, v; float du, dv; ray3f ray, tray; vector3f incri, incrj; color4f color; // initialize framebuffer memset(colorbuf, 0, sizeof(color4f)*viewport.w*viewport.h); // initiliaze deltas for ray stepping du = (viewvolume.right - viewvolume.left)/viewport.w; dv = (viewvolume.top - viewvolume.bottom)/viewport.h; deltasample = fmin(du, dv); // buffers index int fbindex = 0; // cast rays for each pixel in window int istrt = (int) (aabb.wincoord.y - 0.5f); int istop = (int) (aabb.wincoord.y + aabb.wincoord.h + 1.0f); int jstrt = (int) (aabb.wincoord.x - 0.5f); int jstop = (int) (aabb.wincoord.x + aabb.wincoord.w + 1.0f); #ifdef IVR_DEBUG fprintf(stderr, "rank=%d, istrt=%d, istop=%d, jstrt=%d, jstop=%d\n", rank, istrt, istop, jstrt, jstop); #endif // DEBUG /* istrt = (int) (0); istop = (int) (viewport.h); jstrt = (int) (0); jstop = (int) (viewport.w); */ // END DEBUG // initial ray direction v = viewvolume.bottom + istrt * dv + dv/2.0f; u = viewvolume.left + jstrt * du - du/2.0f; ray.dir.u = u; ray.dir.v = v; ray.dir.n = -camera.e.n; buildray(du, dv, &incri, &incrj, &ray); #pragma omp parallel for private(j, color, fbindex, tray) firstprivate(ray) for (i=istrt; i < istop; i++) { tray.orig.x = ray.orig.x; tray.orig.y = ray.orig.y; tray.orig.z= ray.orig.z; tray.dir.x = ray.dir.x + incri.x*(i-istrt); tray.dir.y = ray.dir.y + incri.y*(i-istrt); tray.dir.z = ray.dir.z + incri.z*(i-istrt); for (j=jstrt; j < jstop; j++) { // default color is black color.r = color.g = color.b = color.a = 0.0f; // increment for next ray; SIMD this tray.dir.x += incrj.x; tray.dir.y += incrj.y; tray.dir.z += incrj.z; raycast(tray, &color); // increment color buffer pointer fbindex = i * viewport.w + j; colorbuf[fbindex].r = color.r; colorbuf[fbindex].g = color.g; colorbuf[fbindex].b = color.b; colorbuf[fbindex].a = color.a; } } #ifdef LOCAL // Load array to 0 0 0 to set the raster origition to (0, 0, 0) GLfloat rp[3]; rp[0] = 0.0f; rp[1] = 0.0f; rp[2] = 0.0f; // Set the raster origition and pass the array of colours to drawPixels // use colors directly, don't need to copy. glRasterPos3fv(rp); glDrawPixels(winwidth, winheight, GL_RGBA, GL_FLOAT, (GLvoid *)colorbuf); fprintf(stderr,"w=%d, h=%d\n", winwidth, winheight); #endif return; }