Beispiel #1
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;
  }
  /** @see com.googlecode.gwtquake.shared.client.Renderer#Init() */
  public boolean Init(int vid_xpos, int vid_ypos) {
    // pre init
    assert (GlConstants.SIN.length == 256) : "warpsin table bug";

    Window.Printf(Constants.PRINT_ALL, "ref_gl version: " + GlConstants.REF_VERSION + '\n');
    Images.Draw_GetPalette();
    GlConfig.init();

    Commands.addCommand(
        "imagelist",
        new ExecutableCommand() {
          public void execute() {
            Images.GL_ImageList_f();
          }
        });

    Commands.addCommand(
        "screenshot",
        new ExecutableCommand() {
          public void execute() {
            Misc.GL_ScreenShot_f();
          }
        });
    Commands.addCommand(
        "modellist",
        new ExecutableCommand() {
          public void execute() {
            Models.Mod_Modellist_f();
          }
        });
    Commands.addCommand(
        "gl_strings",
        new ExecutableCommand() {
          public void execute() {
            Misc.GL_Strings_f();
          }
        });

    // set our "safe" modes
    GlState.prev_mode = 3;

    // create the window and set up the context
    if (!R_SetMode()) {
      Window.Printf(Constants.PRINT_ALL, "ref_gl::R_Init() - could not R_SetMode()\n");
      return false;
    }

    // post init
    GlState.qglPointParameterfEXT = true;

    Misc.GL_SetDefaultState();

    Images.GL_InitImages();
    Models.Mod_Init();
    Particles.R_InitParticleTexture();
    Drawing.Draw_InitLocal();

    int err = GlState.gl.glGetError();
    if (err != Gl1Context.GL_NO_ERROR) {
      Window.Printf(
          Constants.PRINT_ALL,
          "glGetError() = 0x%x\n\t%s\n",
          new Vargs(2).add(err).add("" + GlState.gl.glGetString(err)));
      //	return false;
    }
    return true;
  }