Example usage for org.lwjgl.opengl GL11 glRasterPos2f

List of usage examples for org.lwjgl.opengl GL11 glRasterPos2f

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glRasterPos2f.

Prototype

public static native void glRasterPos2f(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y);

Source Link

Document

Float version of #glRasterPos2i RasterPos2i .

Usage

From source file:name.martingeisse.ecotools.simulator.ui.console.OpenGlCharacterGenerator.java

License:Open Source License

/**
 * Draws a block using the current OpenGL context and the specified raster position.
 * Implementation issues prevent to just re-use the current raster position.
 * /*  w  w  w.  j av a 2  s  .co  m*/
 * @param x the x raster position to set
 * @param y the y raster position to set
 * @param characterCode the character code
 * @param foreground the foreground color index
 * @param background the background color index
 */
public void drawBlock(float x, float y, int characterCode, int foreground, int background) {

    /**
     * Implementation note: glColor3f(...) only sets the color in a "thin" way -
     * it does not push the new color down the rendering pipeline. Drawing a normal
     * primitive usually then takes the new color with it. Unfortunately, glBitmap(...)
     * is NOT such a primitive, thus the new color would never take effect as long
     * as only bitmaps are drawn. However, glRasterPos2f(...) also takes the new color
     * with it, so we explicitly set the raster position in this method just to
     * set the color.
     */
    OpenGlColors.useColor(background);
    GL11.glRasterPos2f(x, y);
    buffer.position(characterCode * 2 * 16 * 4 + 16 * 4);
    GL11.glBitmap(8, 16, 0.0f, 0.0f, 0.0f, 0.0f, buffer);

    OpenGlColors.useColor(foreground);
    GL11.glRasterPos2f(x, y);
    buffer.position(characterCode * 2 * 16 * 4);
    GL11.glBitmap(8, 16, 0.0f, 0.0f, 0.0f, 0.0f, buffer);

}

From source file:tk.ivybits.engine.gl.GL.java

License:Open Source License

public static void glRasterPos2f(float a, float b) {
    GL11.glRasterPos2f(a, b);
}