Ejemplo n.º 1
0
  /** R_BeginFrame */
  public final void BeginFrame(float camera_separation) {

    GlConfig.gl_state.camera_separation = camera_separation;

    /*
     * * change modes if necessary
     */
    if (GlConfig.gl_mode.modified || GlConfig.vid_fullscreen.modified) {
      // FIXME: only restart if CDS is required
      ConsoleVariable ref;

      ref = ConsoleVariables.Get("vid_ref", "lwjgl", 0);
      ref.modified = true;
    }

    if (GlConfig.gl_log.modified) {
      // GlBase.GLimp_EnableLogging((GlState.gl_log.value != 0.0f));
      GlConfig.gl_log.modified = false;
    }

    if (GlConfig.gl_log.value != 0.0f) {
      // GlBase.GLimp_LogNewFrame();
    }

    /*
     * * update 3Dfx gamma -- it is expected that a user will do a vid_restart*
     * after tweaking this value
     */
    if (GlConfig.vid_gamma.modified) {
      GlConfig.vid_gamma.modified = false;
    }

    /*
     * * go into 2D mode
     */
    GlState.gl.glViewport(0, 0, GlState.vid.width, GlState.vid.height);
    GlState.gl.glMatrixMode(Gl1Context.GL_PROJECTION);
    GlState.gl.glLoadIdentity();
    GlState.gl.glOrtho(0, GlState.vid.width, GlState.vid.height, 0, -99999, 99999);
    GlState.gl.glMatrixMode(Gl1Context.GL_MODELVIEW);
    GlState.gl.glLoadIdentity();
    GlState.gl.glDisable(Gl1Context.GL_DEPTH_TEST);
    GlState.gl.glDisable(Gl1Context.GL_CULL_FACE);
    GlState.gl.glDisable(Gl1Context.GL_BLEND);
    // gl.glEnable(GLAdapter.GL_ALPHA_TEST);
    GlState.gl.glColor4f(1, 1, 1, 1);

    /*
     * * draw buffer stuff
     */
    if (GlConfig.gl_drawbuffer.modified) {
      GlConfig.gl_drawbuffer.modified = false;

      if (GlState.camera_separation == 0 || !GlState.stereo_enabled) {
        if (GlConfig.gl_drawbuffer.string.equalsIgnoreCase("GL_FRONT"))
          GlState.gl.glDrawBuffer(Gl1Context.GL_FRONT);
        else GlState.gl.glDrawBuffer(Gl1Context.GL_BACK);
      }
    }

    /*
     * * texturemode stuff
     */
    if (GlConfig.gl_texturemode.modified) {
      Images.GL_TextureMode(GlConfig.gl_texturemode.string);
      GlConfig.gl_texturemode.modified = false;
    }

    if (GlConfig.gl_texturealphamode.modified) {
      Images.GL_TextureAlphaMode(GlConfig.gl_texturealphamode.string);
      GlConfig.gl_texturealphamode.modified = false;
    }

    if (GlConfig.gl_texturesolidmode.modified) {
      Images.GL_TextureSolidMode(GlConfig.gl_texturesolidmode.string);
      GlConfig.gl_texturesolidmode.modified = false;
    }

    /*
     * * swapinterval stuff
     */
    Misc.GL_UpdateSwapInterval();

    //
    // clear screen if desired
    //
    Entities.R_Clear();
  }
Ejemplo n.º 2
0
  /*
   * ================== SCR_Init ==================
   */
  static void Init() {
    scr_viewsize = ConsoleVariables.Get("viewsize", "100", CVAR_ARCHIVE);
    scr_conspeed = ConsoleVariables.Get("scr_conspeed", "3", 0);
    scr_showturtle = ConsoleVariables.Get("scr_showturtle", "0", 0);
    scr_showpause = ConsoleVariables.Get("scr_showpause", "1", 0);
    scr_centertime = ConsoleVariables.Get("scr_centertime", "2.5", 0);
    scr_printspeed = ConsoleVariables.Get("scr_printspeed", "8", 0);
    scr_netgraph = ConsoleVariables.Get("netgraph", "1", 0);
    scr_timegraph = ConsoleVariables.Get("timegraph", "1", 0);
    scr_debuggraph = ConsoleVariables.Get("debuggraph", "1", 0);
    scr_graphheight = ConsoleVariables.Get("graphheight", "32", 0);
    scr_graphscale = ConsoleVariables.Get("graphscale", "1", 0);
    scr_graphshift = ConsoleVariables.Get("graphshift", "0", 0);
    scr_drawall = ConsoleVariables.Get("scr_drawall", "1", 0);
    fps = ConsoleVariables.Get("fps", "1", 0);

    //
    // register our commands
    //
    Commands.addCommand(
        "timerefresh",
        new ExecutableCommand() {
          public void execute() {
            TimeRefresh_f();
          }
        });
    Commands.addCommand(
        "loading",
        new ExecutableCommand() {
          public void execute() {
            Loading_f();
          }
        });
    Commands.addCommand(
        "sizeup",
        new ExecutableCommand() {
          public void execute() {
            SizeUp_f();
          }
        });
    Commands.addCommand(
        "sizedown",
        new ExecutableCommand() {
          public void execute() {
            SizeDown_f();
          }
        });
    Commands.addCommand(
        "sky",
        new ExecutableCommand() {
          public void execute() {
            Sky_f();
          }
        });

    scr_initialized = true;
  }