This project has moved. For the latest updates, please go here.

弄个一个opengl拉伸提升下效果

Mar 25, 2015 at 4:24 PM
Edited Mar 25, 2015 at 4:51 PM
感觉画面像素感很强,所以自己弄了个用opengl输出,代码比较粗糙。
其实用sdl2更简单,但是里面的CD的东西相关太多了,没弄。
Image
Mar 25, 2015 at 4:27 PM
主要是加了个这个,然后输出的地方都换掉。

怎么上传完整文件……

VIDEO_UpdateScreenGL()
{
    uint TextureID;
    glGenTextures(1, &TextureID);
    glBindTexture(GL_TEXTURE_2D, TextureID);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, gpScreenReal->w, gpScreenReal->h, 0, GL_BGRA, GL_UNSIGNED_BYTE, gpScreenReal->pixels);
    
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    
    glEnable(GL_TEXTURE_2D);
    glBegin(GL_QUADS);
    glTexCoord2f(0.0, 0.0);
    glVertex3f(-1.0, 1.0, 0.0);
    glTexCoord2f(1.0, 0.0);
    glVertex3f(1.0, 1.0, 0.0);
    glTexCoord2f(1.0, 1.0);
    glVertex3f(1.0, -1.0, 0.0);
    glTexCoord2f(0.0, 1.0);
    glVertex3f(-1.0, -1.0, 0.0);
    glEnd();
    glDisable(GL_TEXTURE_2D);
    SDL_GL_SwapBuffers();
    glDeleteTextures(1, &TextureID);

}