/*------------------------------------------------------------------------ * draw the checkboard pattern * * Input: none * Output: */ void drawChecker(int w_size, int h_size) { int i = 0; int j = 0; for (i = 0; i < 4; i++) { for( j=0; j<4; j++) { if((i + j)%2 == 0) // if i + j is even glColor3f( 1, 1, 1); else glColor3f( 0, 0, 0); glRecti(i*w_size, j*h_size, (i+1)*w_size, (j+1)*h_size); // draw the rectangle }; // end for(j) }; // end for(i) }
void EditorViewWindow::Draw2D () { char * str; switch (mode) { case MAP_3D: str = "3D"; break; case MAP_XY: str = "XY"; break; case MAP_XZ: str = "XZ"; break; case MAP_YZ: str = "YZ"; break; } glMatrixMode (GL_MODELVIEW); glLoadIdentity (); glDisable (GL_TEXTURE_2D); glColor3ub(255,255,255); glPolygonMode (GL_FRONT_AND_BACK, GL_LINE); glDisable(GL_CULL_FACE); glRecti (1,1,w()-2,h()-2); fltk::glsetcolor(fltk::GRAY50); glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); glRecti (1,1,PopupBoxW,PopupBoxH); fltk::glsetfont(fltk::COURIER, 16); fltk::glsetcolor(fltk::BLUE); fltk::gldrawtext(str, 5,15); }
static void display(void) { /* Testing origin */ glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glRecti(0, 0, 1, 1); glColor3f(0.0, 0.0, 0.0); image_orig->x = 1; image_orig->y = 1; gl_framebuf_draw(image_orig, GL_BACK); image_dest->x = image_orig->width + 2; image_dest->y = 1; gl_framebuf_draw(image_dest, GL_BACK); glFlush(); }
static void console_draw_sel(const char *str, const int sel[2], const int xy[2], const int str_len_draw, int cwidth, int lheight, const unsigned char bg_sel[4]) { if (sel[0] <= str_len_draw && sel[1] >= 0) { const int sta = txt_utf8_offset_to_column(str, max_ii(sel[0], 0)); const int end = txt_utf8_offset_to_column(str, min_ii(sel[1], str_len_draw)); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4ubv(bg_sel); glRecti(xy[0] + (cwidth * sta), xy[1] - 2 + lheight, xy[0] + (cwidth * end), xy[1] - 2); glDisable(GL_BLEND); } }
/* The nine squares are drawn. In selection mode, each * square is given two names: one for the row and the * other for the column on the grid. The color of each * square is determined by its position on the grid, and * the value in the board[][] array. */ void drawSquares(GLenum mode) { GLuint i, j; for (i = 0; i < 3; i++) { if (mode == GL_SELECT) glLoadName (i); for (j = 0; j < 3; j ++) { if (mode == GL_SELECT) glPushName (j); glColor3f ((GLfloat) i/3.0, (GLfloat) j/3.0, (GLfloat) board[i][j]/3.0); glRecti (i, j, i+1, j+1); if (mode == GL_SELECT) glPopName (); } } }
void Drawing::DrawingImpl::drawPoint(int x, int y) { #if COLLISION_DETECTION int left = std::max(0, x - ROBOT_DIAMETER / 2); int right = std::min(static_cast<int>(texture->width()) - 1, x + ROBOT_DIAMETER / 2); int bottom = std::max(0, y - ROBOT_DIAMETER / 2); int top = std::min(static_cast<int>(texture->height()) - 1, y + ROBOT_DIAMETER / 2); glRecti(left, bottom, right, top); #else int offsetX = x; int offsetY = texture->height() - 1 - y; glTranslatef(offsetX, offsetY, 0.0f); glDrawArrays(GL_TRIANGLE_FAN, 0, 301); glTranslatef(-offsetX, -offsetY, 0.0f); #endif }
void GenerateTextures(const uint8_t* operationBuffer) { uint32_t* destBuffer; uint32_t currIndex = operationBuffer[0]; uint32_t prevIndex = currIndex + 1; GLuint program = compileShader(g_operatorVertexShader, g_operatorFragmentShader); useShader(program); #ifndef NDEBUG int S = ((PFNGLGETUNIFORMLOCATIONPROC)GL_FUNC(get_uniform_location))(program, "S"); int F = ((PFNGLGETUNIFORMLOCATIONPROC)GL_FUNC(get_uniform_location))(program, "F"); #endif CreateTexture(prevIndex, TEXTURE_WIDTH, TEXTURE_HEIGHT, 4, GL_RGBA, TEXTURE_MEMORY(0)); checkGLError(); float params[3]; int slot = 0; // evaluate the array one operation function after another do { glViewport(0, 0, TEXTURE_WIDTH, TEXTURE_HEIGHT); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glEnable(GL_TEXTURE_2D); glDisable(GL_CULL_FACE); glDisable(GL_BLEND); glBindTexture(GL_TEXTURE_2D, prevIndex); checkGLError(); params[0] = operationBuffer[currIndex]; setFloatParams(0, params, 3); setIntParams(3, &slot, 1); glRecti(-1, -1, 1, 1); destBuffer = TEXTURE_MEMORY(currIndex); glReadPixels(0, 0, TEXTURE_WIDTH, TEXTURE_HEIGHT, GL_RGBA, GL_UNSIGNED_BYTE, destBuffer); CreateTexture(currIndex, TEXTURE_WIDTH, TEXTURE_HEIGHT, 4, GL_RGBA, destBuffer); //glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, TEXTURE_WIDTH, TEXTURE_HEIGHT, 0); checkGLError(); prevIndex = currIndex; currIndex -= operationBuffer[currIndex] >> TEXTURE_OPERATION_MODE_SHIFT; } while(--currIndex); }
static void DrawBackground(void) { // Whole window cleared with clear color, checkerboard rendered on top of it. glClear(GL_COLOR_BUFFER_BIT); DrawCheckerBoard(); // ANIM background color rendered (blend) on top. Default is white for still // images (without ANIM chunk). glClear() can't be used for that (no blend). if (kParams.draw_anim_background_color) { glPushMatrix(); glLoadIdentity(); glColor4f(GetColorf(kParams.bg_color, 16), // BGRA from spec GetColorf(kParams.bg_color, 8), GetColorf(kParams.bg_color, 0), GetColorf(kParams.bg_color, 24)); glRecti(-1, -1, +1, +1); glPopMatrix(); } }
static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth, int lheight) { if(sel[0] <= str_len_draw && sel[1] >= 0) { int sta = MAX2(sel[0], 0); int end = MIN2(sel[1], str_len_draw); glEnable(GL_POLYGON_STIPPLE); glPolygonStipple(stipple_halftone); glEnable( GL_BLEND ); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4ub(255, 255, 255, 96); glRecti(xy[0]+(cwidth*sta), xy[1]-2 + lheight, xy[0]+(cwidth*end), xy[1]-2); glDisable(GL_POLYGON_STIPPLE); glDisable( GL_BLEND ); } }
void draw_overlay() { glColor4f( 0.0, 0.0, 1.0, 0.1 ); #ifdef __APPLE__DISABLED__ const GLfloat vertices []= { 0, 0, 640, 0, 640, 480, 0, 480 }; glEnableClientState (GL_VERTEX_ARRAY); glVertexPointer (2, GL_FLOAT , 0, vertices); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); #else glRecti( 0, 0, 640, 480 ); #endif }
void draw_image_cache(const bContext *C, ARegion *ar) { SpaceImage *sima = CTX_wm_space_image(C); Scene *scene = CTX_data_scene(C); Image *image = ED_space_image(sima); float x, cfra = CFRA, sfra = SFRA, efra = EFRA, framelen = ar->winx / (efra - sfra + 1); Mask *mask = NULL; if (!ED_space_image_show_cache(sima)) { return; } if (sima->mode == SI_MODE_MASK) { mask = ED_space_image_get_mask(sima); } glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); /* Draw cache background. */ ED_region_cache_draw_background(ar); /* Draw cached segments. */ if (image != NULL && image->cache != NULL && ELEM(image->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) { int num_segments = 0; int *points = NULL; IMB_moviecache_get_cache_segments(image->cache, IMB_PROXY_NONE, 0, &num_segments, &points); ED_region_cache_draw_cached_segments(ar, num_segments, points, sfra + sima->iuser.offset, efra + sima->iuser.offset); } glDisable(GL_BLEND); /* Draw current frame. */ x = (cfra - sfra) / (efra - sfra + 1) * ar->winx; UI_ThemeColor(TH_CFRAME); glRecti(x, 0, x + ceilf(framelen), 8 * UI_DPI_FAC); ED_region_cache_draw_curfra_label(cfra, x, 8.0f * UI_DPI_FAC); if (mask != NULL) { ED_mask_draw_frames(mask, ar, cfra, sfra, efra); } }
static void printhelp(void) { glEnable(GL_BLEND); glColor4f(0.5, 0.5, 0.5, 0.5); glRecti(40, 40, 600, 440); glDisable(GL_BLEND); glColor3f(1.0, 0.0, 0.0); glRasterPos2i(300, 420); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help"); glRasterPos2i(60, 390); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Toggle Help"); glRasterPos2i(60, 360); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Toggle Textures"); glRasterPos2i(60, 330); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Toggle Fog"); glRasterPos2i(60, 300); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Toggle Back face culling"); glRasterPos2i(60, 270); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate"); glRasterPos2i(60, 240); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "a - Increase velocity"); glRasterPos2i(60, 210); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "z - Decrease velocity"); glRasterPos2i(60, 180); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "p - Toggle Wire frame"); glRasterPos2i(60, 150); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "n - Toggle GL_EXT_rescale_normal extension"); glRasterPos2i(60, 120); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "+/- - Increase/decrease the Object maximum LOD"); glRasterPos2i(60, 90); if (joyavailable) printstring(GLUT_BITMAP_TIMES_ROMAN_24, "j - Toggle jostick control (Joystick control available)"); else printstring(GLUT_BITMAP_TIMES_ROMAN_24, "(No Joystick control available)"); }
static void DrawCheckerBoard(void) { const int square_size = 8; // must be a power of 2 int x, y; GLint viewport[4]; // x, y, width, height glPushMatrix(); glGetIntegerv(GL_VIEWPORT, viewport); // shift to integer coordinates with (0,0) being top-left. glOrtho(0, viewport[2], viewport[3], 0, -1, 1); for (y = 0; y < viewport[3]; y += square_size) { for (x = 0; x < viewport[2]; x += square_size) { const GLubyte color = 128 + 64 * (!((x + y) & square_size)); glColor3ub(color, color, color); glRecti(x, y, x + square_size, y + square_size); } } glPopMatrix(); }
void drawGrid(){ GLuint i,j; glMatrixMode(GL_MODELVIEW); glPushMatrix(); glTranslatef(-40.0f,-5.0f, -40.0f); glTranslatef(0.0f,-5.0f, 0.0f); glRotatef(90, 0,1,0); glRotatef(90, 1,0,0); for (i = 0; i < 80; i++) { for (j = 0; j < 80; j ++) { glColor3f ((GLfloat) i/80.0, (GLfloat) j/80.0, (GLfloat) (i + j)/80.0); glRecti (i, j, i+1, j+1); } } glMatrixMode(GL_MODELVIEW); glPopMatrix(); }
void clip_draw_curfra_label(SpaceClip *sc, float x, float y) { uiStyle *style = UI_GetStyle(); int fontid = style->widget.uifont_id; char numstr[32]; float font_dims[2] = {0.0f, 0.0f}; /* frame number */ BLF_size(fontid, 11.0f, U.dpi); BLI_snprintf(numstr, sizeof(numstr), "%d", sc->user.framenr); BLF_width_and_height(fontid, numstr, &font_dims[0], &font_dims[1]); glRecti(x, y, x + font_dims[0] + 6.0f, y + font_dims[1] + 4.0f); UI_ThemeColor(TH_TEXT); BLF_position(fontid, x + 2.0f, y + 2.0f, 0.0f); BLF_draw(fontid, numstr, sizeof(numstr)); }
static int console_textview_line_color(struct TextViewContext *tvc, unsigned char fg[3], unsigned char UNUSED(bg[3])) { ConsoleLine *cl_iter = (ConsoleLine *)tvc->iter; /* annoying hack, to draw the prompt */ if (tvc->iter_index == 0) { const SpaceConsole *sc = (SpaceConsole *)tvc->arg1; const ConsoleLine *cl = (ConsoleLine *)sc->history.last; const int prompt_len = strlen(sc->prompt); const int cursor_loc = cl->cursor + prompt_len; const int line_len = cl->len + prompt_len; int xy[2] = {CONSOLE_DRAW_MARGIN, CONSOLE_DRAW_MARGIN}; int pen[2]; xy[1] += tvc->lheight / 6; /* account for wrapping */ if (line_len < tvc->console_width) { /* simple case, no wrapping */ pen[0] = tvc->cwidth * cursor_loc; pen[1] = -2; } else { /* wrap */ pen[0] = tvc->cwidth * (cursor_loc % tvc->console_width); pen[1] = -2 + (((line_len / tvc->console_width) - (cursor_loc / tvc->console_width)) * tvc->lheight); } /* cursor */ UI_GetThemeColor3ubv(TH_CONSOLE_CURSOR, fg); glColor3ubv(fg); glRecti((xy[0] + pen[0]) - 1, (xy[1] + pen[1]), (xy[0] + pen[0]) + 1, (xy[1] + pen[1] + tvc->lheight) ); } console_line_color(fg, cl_iter->type); return TVC_LINE_FG; }
static void printhelp(void) { glColor4f(0.0, 0.0, 0.0, 0.5); glRecti(40, 40, 600, 440); glColor3f(1.0, 0.0, 0.0); glRasterPos2i(300, 420); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help"); glRasterPos2i(60, 390); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Toggle Help"); glRasterPos2i(60, 360); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Increase particle size"); glRasterPos2i(60, 330); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "T - Decrease particle size"); glRasterPos2i(60, 300); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "r - Increase emission radius"); glRasterPos2i(60, 270); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "R - Decrease emission radius"); glRasterPos2i(60, 240); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Toggle Fog"); glRasterPos2i(60, 210); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "s - Toggle shadows"); glRasterPos2i(60, 180); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate"); glRasterPos2i(60, 150); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "a - Increase velocity"); glRasterPos2i(60, 120); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "z - Decrease velocity"); glRasterPos2i(60, 90); if (joyavailable) printstring(GLUT_BITMAP_TIMES_ROMAN_24, "j - Toggle jostick control (Joystick control available)"); else printstring(GLUT_BITMAP_TIMES_ROMAN_24, "(No Joystick control available)"); }
void Canvas::fill_rectangle(int left, int top, int right, int bottom, const Color color) { color.set(); #ifdef HAVE_GLES const RasterPoint vertices[] = { { left, top }, { right, top }, { left, bottom }, { right, bottom }, }; glVertexPointer(2, GL_VALUE, 0, vertices); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); #else glRecti(left, top, right, bottom); #endif }
void Camera::raytrace(Scene & scn, int blockSize, int nRows, int nCols) { Ray theRay; theRay.setStart(eye); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0, nCols, 0, nRows); glDisable(GL_LIGHTING); for (int row = 0; row < nRows; row+=blockSize) { for (int col = 0; col < nCols; col+=blockSize) { calcDirection(theRay, nCols, nRows, row, col); Color3 clr = scn.shade(theRay); glColor3f(clr.red, clr.green, clr.blue); glRecti(col, row, col+blockSize, row+blockSize); glFlush(); glutSwapBuffers(); } } }
/*** *** The "expose_event" signal handler. All the OpenGL re-drawing should *** be done here. This is repeatedly called as the painting routine *** every time the 'expose'/'draw' event is signalled. ***/ static gboolean expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer data) { GdkGLContext *glcontext = gtk_widget_get_gl_context (widget); GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget); guint count; Point* coord; /*** OpenGL BEGIN ***/ if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext)) return FALSE; glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); /* Set the foreground colour. */ glColor3f(0.0,0.0,0.0); /* Draw the list of brush strokes. */ for (count=0; count<g_list_length(brushStrokeList); count++) { coord = g_list_nth_data(brushStrokeList, count); glRecti(coord->x + thickness, coord->y - thickness, coord->x - thickness, coord->y + thickness); } /* Swap buffers */ if (gdk_gl_drawable_is_double_buffered (gldrawable)) gdk_gl_drawable_swap_buffers (gldrawable); else glFlush (); gdk_gl_drawable_gl_end (gldrawable); /*** OpenGL END ***/ return TRUE; }
void RosalilaGraphics::drawRectangle(int x,int y,int width,int height,float rotation,int red,int green,int blue,int alpha,bool camera_align) { glMatrixMode( GL_PROJECTION ); glLoadIdentity(); glOrtho(0.0f, screen_width, screen_height, 0.0f, -1.0f, 1.0f); glMatrixMode( GL_MODELVIEW ); glDisable (GL_LIGHTING); glEnable (GL_LIGHT0); glDisable (GL_DEPTH_TEST); glDisable(GL_TEXTURE_2D); GLubyte r=red; GLubyte g=green; GLubyte b=blue; GLubyte a=alpha; glColor4ub(r,g,b,a); if(camera_align) { y+=camera_y; x-=camera_x; } //OpenGL draw //Save the current matrix. glPushMatrix(); //Change the current matrix. float translate_x=x; float translate_y=y; glTranslatef(translate_x,translate_y, 1.0); glRotatef(-rotation, 0, 0, 1.0); x-=translate_x; y-=translate_y; glRecti(x, y, width+x, height+y); glFlush(); //Reset the current matrix to the one that was saved. glPopMatrix(); }
void Canvas::DrawFilledRectangle(PixelScalar left, PixelScalar top, PixelScalar right, PixelScalar bottom, const Color color) { color.Set(); #ifdef HAVE_GLES const RasterPoint vertices[] = { { left, top }, { right, top }, { left, bottom }, { right, bottom }, }; glVertexPointer(2, GL_VALUE, 0, vertices); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); #else glRecti(left, top, right, bottom); #endif }
void CalibPlugin::drawFrame() { // calibration code -- no trivial painting done of num x num random rectangles const float meanintensity = 0.5f, variance = 0.05f; const int num = 1; int w = width(), h = height(), x = 0, y = 0, xincr = w/num, yincr = h/num; for (;;) { glColor3f( meanintensity + ran1Gen.range(-variance,variance), meanintensity + ran1Gen.range(-variance,variance), meanintensity + ran1Gen.range(-variance,variance) ); glRecti( x, y, x+xincr, y+yincr ); if ( (x += xincr) + xincr > w ) x = 0, y += yincr; if ( y + yincr > h ) break; } static const unsigned calibTot = 240; Debug() << "Frame " << frameNum << " fpsnow " << fps << " avg " << fpsAvg << " hwframe " << getHWFrameCount(); if (frameNum >= calibTot) { stop(); emit refreshRateCalibrated(static_cast<unsigned>(qRound(fpsAvg))); emit finished(); } }
static void draw_textscroll(SpaceText *st, rcti *scroll, rcti *back) { bTheme *btheme = UI_GetTheme(); uiWidgetColors wcol = btheme->tui.wcol_scroll; unsigned char col[4]; float rad; UI_ThemeColor(TH_BACK); glRecti(back->xmin, back->ymin, back->xmax, back->ymax); uiWidgetScrollDraw(&wcol, scroll, &st->txtbar, (st->flags & ST_SCROLL_SELECT) ? UI_SCROLL_PRESSED : 0); uiSetRoundBox(UI_CNR_ALL); rad = 0.4f * min_ii(BLI_rcti_size_x(&st->txtscroll), BLI_rcti_size_y(&st->txtscroll)); UI_GetThemeColor3ubv(TH_HILITE, col); col[3] = 48; glColor4ubv(col); glEnable(GL_BLEND); uiRoundBox(st->txtscroll.xmin + 1, st->txtscroll.ymin, st->txtscroll.xmax - 1, st->txtscroll.ymax, rad); glDisable(GL_BLEND); }
void barChart(void){ GLint month, k; glClear(GL_COLOR_BUFFER_BIT); glColor3f(0.0, 0.0, 1.0); glColor3f(1.0, 0.0, 0.0); for(k = 0; k < 12; k++) glRecti(20 + k*50, 165, 40 + k*50, dataValue[k]); glColor3f(0.0, 0.0, 0.0); xRaster = 20; for(month = 0; month < 12 ; month++){ glRasterPos2i(xRaster, yRaster); for(k = 3*month; k < 3*month + 3; k++){ glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, label[k]); } xRaster += 50; } glFlush(); }
void Renderer::render() { double widthPixel = camera->getWidth() / nCols; double heightPixel = camera->getHeight() / nRows; Vector v1 = -(camera->getWidth()/2)*camera->getU() + (camera->getHeight()/2)*camera->getV(); Vector v3 = -camera->getDistance()*camera->getN() + v1; for (int r = 0; r < nRows; r++) { for (int c = 0; c < nCols; c++) { Vector v2 = (c*widthPixel)*camera->getU() + (-r*heightPixel)*camera->getV(); Vector dir = v2 + v3; Ray ray(camera->getEye(), dir); Colour col = rayTracer->shade(ray); glColor3d(col.r, col.g, col.b); glRecti(c, nRows-r, c+1, nRows-r-1); } } }
static void printhelp(void) { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4f(0.0, 0.0, 0.0, 0.5); glRecti(40, 40, 600, 440); glDisable(GL_BLEND); glColor3f(1.0, 0.0, 0.0); glRasterPos2i(300, 420); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help"); glRasterPos2i(60, 390); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Toggle Help"); glRasterPos2i(60, 360); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Toggle Textures"); glRasterPos2i(60, 330); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Toggle Fog"); glRasterPos2i(60, 300); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "p - Wire frame"); glRasterPos2i(60, 270); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Toggle Back face culling"); glRasterPos2i(60, 240); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate"); glRasterPos2i(60, 210); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "a - Increase velocity"); glRasterPos2i(60, 180); printstring(GLUT_BITMAP_TIMES_ROMAN_24, "z - Decrease velocity"); glRasterPos2i(60, 150); if (joyavailable) printstring(GLUT_BITMAP_TIMES_ROMAN_24, "j - Toggle jostick control (Joystick control available)"); else printstring(GLUT_BITMAP_TIMES_ROMAN_24, "(No Joystick control available)"); }
void NavigationGUI::drawLidarTilt() { char text[50]; glPushMatrix(); glTranslated(100, 10 - currWinH, 0); // draw text for lidar value glTranslated(-50, 50, 0); glColor4f(0, 1, 0, TEXTBOX_ALPHA); glRecti(-30, 30, 250, -30); if (lidarTilt == 0) { sprintf(text, "Lidar Mode: sweep"); } else if (lidarTilt == 1) { sprintf(text, "Lidar Mode: stationary"); } else if (lidarTilt == 2) { sprintf(text, "Lidar Mode: joy_control"); } else { sprintf(text, "Lidar Mode: invalid"); } glColor4f(1, 0, 0, ALPHA); drawText(text, GLUT_BITMAP_TIMES_ROMAN_24, 0, 0); glPopMatrix(); }
static int console_textview_line_color(struct TextViewContext *tvc, unsigned char fg[3], unsigned char UNUSED(bg[3])) { ConsoleLine *cl_iter = (ConsoleLine *)tvc->iter; /* annoying hack, to draw the prompt */ if (tvc->iter_index == 0) { const SpaceConsole *sc = (SpaceConsole *)tvc->arg1; const ConsoleLine *cl = (ConsoleLine *)sc->history.last; int offl = 0, offc = 0; int xy[2] = {CONSOLE_DRAW_MARGIN, CONSOLE_DRAW_MARGIN}; int pen[2]; xy[1] += tvc->lheight / 6; console_cursor_wrap_offset(sc->prompt, tvc->console_width, &offl, &offc, NULL); console_cursor_wrap_offset(cl->line, tvc->console_width, &offl, &offc, cl->line + cl->cursor); pen[0] = tvc->cwidth * offc; pen[1] = -2 - tvc->lheight * offl; console_cursor_wrap_offset(cl->line + cl->cursor, tvc->console_width, &offl, &offc, NULL); pen[1] += tvc->lheight * offl; /* cursor */ UI_GetThemeColor3ubv(TH_CONSOLE_CURSOR, fg); glColor3ubv(fg); glRecti((xy[0] + pen[0]) - 1, (xy[1] + pen[1]), (xy[0] + pen[0]) + 1, (xy[1] + pen[1] + tvc->lheight) ); } console_line_color(fg, cl_iter->type); return TVC_LINE_FG; }
void Canvas::DrawFilledRectangle(int left, int top, int right, int bottom, const Color color) { #ifdef USE_GLSL OpenGL::solid_shader->Use(); #endif color.Set(); #ifdef HAVE_GLES const RasterPoint vertices[] = { { left, top }, { right, top }, { left, bottom }, { right, bottom }, }; const ScopeVertexPointer vp(vertices); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); #else glRecti(left, top, right, bottom); #endif }