⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ogl_sdl.c

📁 The source code of Doom legacy for windows
💻 C
字号:
// Emacs style mode select   -*- C++ -*-//-----------------------------------------------------------------------------//// $Id: ogl_sdl.c,v 1.4 2001/03/09 21:53:56 metzgermeister Exp $//// Copyright (C) 1998-2000 by DooM Legacy Team.//// This program is free software; you can redistribute it and/or// modify it under the terms of the GNU General Public License// as published by the Free Software Foundation; either version 2// of the License, or (at your option) any later version.//// This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the// GNU General Public License for more details.////// $Log: ogl_sdl.c,v $// Revision 1.4  2001/03/09 21:53:56  metzgermeister// *** empty log message ***//// Revision 1.3  2000/11/02 19:49:40  bpereira// no message//// Revision 1.2  2000/09/10 10:56:01  metzgermeister// clean up & made it work again//// Revision 1.1  2000/08/21 21:17:32  metzgermeister// Initial import to CVS////// DESCRIPTION://      SDL specific part of the OpenGL API for Doom Legacy////-----------------------------------------------------------------------------#include <SDL/SDL.h>#include <GL/gl.h>#include <GL/glu.h>#include "../hardware/r_opengl/r_opengl.h"#include "v_video.h"#ifdef DEBUG_TO_FILEHANDLE logstream = -1;#endifstatic SDL_Surface *vidSurface = NULL; //use the one from i_video_sdl.c instead?int     oglflags = 0;void HWR_Startup(void);boolean OglSdlSurface(int w, int h, int isFullscreen){    Uint32 surfaceFlags;    if(NULL != vidSurface)    {        SDL_FreeSurface(vidSurface);        vidSurface = NULL;#ifdef VOODOOSAFESWITCHING        SDL_QuitSubSystem(SDL_INIT_VIDEO);        SDL_InitSubSystem(SDL_INIT_VIDEO);#endif    }    if(isFullscreen)    {        surfaceFlags = SDL_OPENGL|SDL_FULLSCREEN;    }    else    {        surfaceFlags = SDL_OPENGL;    }    if((vidSurface = SDL_SetVideoMode(w, h, 16, surfaceFlags)) == NULL) // 16 BPP        return false;    SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 1);    SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 1);    SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 1);    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);    SetModelView(w, h);    SetStates();    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);    HWR_Startup();    textureformatGL = GL_RGB5_A1;    return true;}void OglSdlFinishUpdate(boolean vidwait){    SDL_GL_SwapBuffers();}void OglSdlShutdown(void){    if(NULL != vidSurface)    {        SDL_FreeSurface(vidSurface);        vidSurface = NULL;    }}void OglSdlSetPalette(RGBA_t *palette, RGBA_t *gamma){    int i;    for (i=0; i<256; i++) {        myPaletteData[i].s.red   = MIN((palette[i].s.red   * gamma->s.red)  /127, 255);        myPaletteData[i].s.green = MIN((palette[i].s.green * gamma->s.green)/127, 255);        myPaletteData[i].s.blue  = MIN((palette[i].s.blue  * gamma->s.blue) /127, 255);        myPaletteData[i].s.alpha = palette[i].s.alpha;    }    // on a chang

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -