/* * ============= Draw_Pic ============= */ public void DrawPic(int x, int y, String pic) { Image image; image = Images.findPicture(pic); if (image == null) { Window.Printf(Constants.PRINT_ALL, "Can't find pic: " + pic + '\n'); return; } // if (scrap_dirty) // Scrap_Upload(); // if ( ( ( gl_config.renderer == GL_RENDERER_MCD ) || ( (gl_config.renderer // & GL_RENDERER_RENDITION) != 0 ) ) && !image.has_alpha) // gl.glDisable (GLAdapter.GL_ALPHA_TEST); Images.GL_Bind(image.texnum); GlState.gl.glBegin(Gl1Context.SIMPLE_TEXUTRED_QUAD); GlState.gl.glVertex2f(x, y); GlState.gl.glVertex2f(x + image.width, y); GlState.gl.glVertex2f(x + image.width, y + image.height); GlState.gl.glVertex2f(x, y + image.height); GlState.gl.glEnd(); // if ( ( ( gl_config.renderer == GL_RENDERER_MCD ) || ( (gl_config.renderer // & GL_RENDERER_RENDITION) != 0 ) ) && !image.has_alpha) // gl.glEnable (GLAdapter.GL_ALPHA_TEST); }
/* * ============= Draw_TileClear * * This repeats a 64*64 tile graphic to fill the screen around a sized down * refresh window. ============= */ public final void DrawTileClear(int x, int y, int w, int h, String pic) { Image image; image = Images.findPicture(pic); if (image == null) { Window.Printf(Constants.PRINT_ALL, "Can't find pic: " + pic + '\n'); return; } // if ( ( ( gl_config.renderer == GL_RENDERER_MCD ) || ( (gl_config.renderer // & GL_RENDERER_RENDITION) != 0 ) ) && !image.has_alpha) // gl.glDisable(GLAdapter.GL_ALPHA_TEST); Images.GL_Bind(image.texnum); GlState.gl.glBegin(Gl1Context._GL_QUADS); GlState.gl.glTexCoord2f(x / 64.0f, y / 64.0f); GlState.gl.glVertex2f(x, y); GlState.gl.glTexCoord2f((x + w) / 64.0f, y / 64.0f); GlState.gl.glVertex2f(x + w, y); GlState.gl.glTexCoord2f((x + w) / 64.0f, (y + h) / 64.0f); GlState.gl.glVertex2f(x + w, y + h); GlState.gl.glTexCoord2f(x / 64.0f, (y + h) / 64.0f); GlState.gl.glVertex2f(x, y + h); GlState.gl.glEnd(); // if ( ( ( gl_config.renderer == GL_RENDERER_MCD ) || ( (gl_config.renderer // & GL_RENDERER_RENDITION) != 0 ) ) && !image.has_alpha) // gl.glEnable(GLAdapter.GL_ALPHA_TEST); }
public void DrawString(int x, int y, byte[] str, int ofs, int len) { Images.GL_Bind(Images.draw_chars.texnum); GlState.gl.glBegin(Gl1Context._GL_QUADS); for (int i = 0; i < len; ++i) { DrawChar_(x, y, str[ofs + i]); x += 8; } GlState.gl.glEnd(); }
public void DrawString(int x, int y, String str, int ofs, int len, boolean alt) { Images.GL_Bind(Images.draw_chars.texnum); GlState.gl.glBegin(Gl1Context._GL_QUADS); for (int i = 0; i < len; ++i) { DrawChar_(x, y, str.charAt(ofs + i) + (alt ? 128 : 0)); x += 8; } GlState.gl.glEnd(); }
/* * ============= Draw_StretchRaw ============= */ public final void DrawStretchRaw(int x, int y, int w, int h, int cols, int rows, byte[] data) { int i, j, trows; int sourceIndex; int frac, fracstep; float hscale; int row; float t; Images.GL_Bind(0); if (rows <= 256) { hscale = 1; trows = rows; } else { hscale = rows / 256.0f; trows = 256; } t = rows * hscale / 256; // if ( !qglColorTableEXT ) // { // int[] image32 = new int[256*256]; Drawing.image32.clear(); int destIndex = 0; for (i = 0; i < trows; i++) { row = (int) (i * hscale); if (row > rows) break; sourceIndex = cols * row; destIndex = i * 256; fracstep = cols * 0x10000 / 256; frac = fracstep >> 1; for (j = 0; j < 256; j++) { Drawing.image32.put( destIndex + j, GlState.r_rawpalette[data[sourceIndex + (frac >> 16)] & 0xff]); frac += fracstep; } } GlState.gl.glTexImage2D( Gl1Context.GL_TEXTURE_2D, 0, Gl1Context.GL_RGBA /* gl_tex_solid_format */, 256, 256, 0, Gl1Context.GL_RGBA, Gl1Context.GL_UNSIGNED_BYTE, Drawing.image32); // } // else // { // //byte[] image8 = new byte[256*256]; // image8.clear(); // int destIndex = 0;; // // for (i=0 ; i<trows ; i++) // { // row = (int)(i*hscale); // if (row > rows) // break; // sourceIndex = cols*row; // destIndex = i*256; // fracstep = cols*0x10000/256; // frac = fracstep >> 1; // for (j=0 ; j<256 ; j++) // { // image8.put(destIndex + j, data[sourceIndex + (frac>>16)]); // frac += fracstep; // } // } // // gl.glTexImage2D( GLAdapter.GL_TEXTURE_2D, // 0, // GL_COLOR_INDEX8_EXT, // 256, 256, // 0, // GLAdapter._GL_COLOR_INDEX, // GLAdapter.GL_UNSIGNED_BYTE, // image8 ); // } GlState.gl.glTexParameterf( Gl1Context.GL_TEXTURE_2D, Gl1Context.GL_TEXTURE_MIN_FILTER, Gl1Context.GL_LINEAR); GlState.gl.glTexParameterf( Gl1Context.GL_TEXTURE_2D, Gl1Context.GL_TEXTURE_MAG_FILTER, Gl1Context.GL_LINEAR); // if ( ( gl_config.renderer == GL_RENDERER_MCD ) || ( (gl_config.renderer & // GL_RENDERER_RENDITION) != 0 ) ) // gl.glDisable (GLAdapter.GL_ALPHA_TEST); GlState.gl.glBegin(Gl1Context._GL_QUADS); GlState.gl.glTexCoord2f(0, 0); GlState.gl.glVertex2f(x, y); GlState.gl.glTexCoord2f(1, 0); GlState.gl.glVertex2f(x + w, y); GlState.gl.glTexCoord2f(1, t); GlState.gl.glVertex2f(x + w, y + h); GlState.gl.glTexCoord2f(0, t); GlState.gl.glVertex2f(x, y + h); GlState.gl.glEnd(); // if ( ( gl_config.renderer == GL_RENDERER_MCD ) || ( (gl_config.renderer & // GL_RENDERER_RENDITION) != 0 ) ) // gl.glEnable (GLAdapter.GL_ALPHA_TEST); }
public void DrawChar(int x, int y, int ch) { Images.GL_Bind(Images.draw_chars.texnum); GlState.gl.glBegin(Gl1Context._GL_QUADS); DrawChar_(x, y, ch); GlState.gl.glEnd(); }