Ignore:
Timestamp:
Mar 19, 2011, 12:52:14 PM (9 years ago)
Author:
sam
Message:

video: enforce shader-enabled GL implementations, getting rid of a lot
of code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/video.cpp

    r742 r745  
    3030#endif
    3131
    32 #if defined HAVE_GL_2X || defined HAVE_GLES_2X
    3332Shader *stdshader;
    34 #endif
    3533mat4 proj_matrix, view_matrix, model_matrix;
    3634
    37 #if defined HAVE_GL_2X || defined HAVE_GLES_2X
    3835static char const *vertexshader =
    39 #if !defined HAVE_GLES_2X
     36#if defined HAVE_GL_2X
    4037    "#version 130\n"
    4138#endif
     
    8885    "    vec4 col = texture2D(in_Texture, vec2(gl_TexCoord[0]));\n"
    8986#endif
    90 #if 1
     87#if 0
    9188    "    float mul = 2.0;\n"
    92     "    float dx1 = mod(gl_FragCoord.x, 2.0);\n"
    93     "    float dy1 = mod(gl_FragCoord.y, 2.0);\n"
    94     "    float t1 = mod(3.0 * dx1 + 2.0 * dy1, 4.0);\n"
     89    "    vec2 d1 = mod(vec2(gl_FragCoord), vec2(2.0, 2.0));\n"
     90    "    float t1 = mod(3.0 * d1.x + 2.0 * d1.y, 4.0);\n"
    9591    "    float dx2 = mod(floor(gl_FragCoord.x * 0.5), 2.0);\n"
    9692    "    float dy2 = mod(floor(gl_FragCoord.y * 0.5), 2.0);\n"
     
    112108    "    gl_FragColor = col;\n"
    113109    "}\n";
    114 #endif
    115110
    116111/*
     
    130125    glClearDepthf(1.0);
    131126
    132 #if defined HAVE_GL_2X || defined HAVE_GLES_1X
     127#if defined HAVE_GL_2X
    133128    glShadeModel(GL_SMOOTH);
    134 #endif
    135 #if defined HAVE_GL_2X || defined HAVE_GLES_1X
    136129    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
    137130#endif
    138131
    139 #if defined HAVE_GL_2X || defined HAVE_GLES_2X
    140132    stdshader = Shader::Create(vertexshader, fragmentshader);
    141 #endif
    142133}
    143134
     
    189180    view_matrix = mat4(1.0f);
    190181
    191 #if defined HAVE_GL_2X || defined HAVE_GLES_2X
    192182    stdshader->Bind(); /* Required on GLES 2.x? */
    193183    GLuint uni;
     
    196186    uni = stdshader->GetUniformLocation("view_matrix");
    197187    glUniformMatrix4fv(uni, 1, GL_FALSE, &view_matrix[0][0]);
    198 #else
    199     glMatrixMode(GL_PROJECTION);
    200     glLoadIdentity();
    201     glMultMatrixf(&proj_matrix[0][0]);
    202 
    203     /* Reset the model view matrix, just in case */
    204     glMatrixMode(GL_MODELVIEW);
    205     glLoadIdentity();
    206     glMultMatrixf(&view_matrix[0][0]);
    207 #endif
    208188}
    209189
     
    226206void Video::Destroy()
    227207{
    228 #if defined HAVE_GL_2X || defined HAVE_GLES_2X
    229208    Shader::Destroy(stdshader);
    230 #endif
    231209}
    232210
     
    237215    int width = v[2], height = v[3];
    238216
    239 #if defined HAVE_GL_1X || defined HAVE_GL_2X
     217#if defined HAVE_GL_2X
    240218    glPixelStorei(GL_PACK_ROW_LENGTH, 0);
    241219#endif
Note: See TracChangeset for help on using the changeset viewer.