Changeset 667


Ignore:
Timestamp:
Feb 18, 2011, 4:55:34 PM (9 years ago)
Author:
sam
Message:

Minor GL code reorganisation and simplification.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/video.cpp

    r666 r667  
    3939    "\n"
    4040    "in vec3 in_Position;\n"
    41     "in vec3 in_Color;\n"
     41    //"in vec3 in_Color;\n"
    4242    "in vec2 in_TexCoord;\n"
    43     "out vec3 pass_Color;\n"
     43    //"out vec3 pass_Color;\n"
    4444    "uniform mat4 proj_matrix;\n"
    4545    "uniform mat4 view_matrix;\n"
     
    5151    "                * vec4(in_Position, 1.0f);\n"
    5252    "    gl_TexCoord[0] = vec4(in_TexCoord, 0.0, 0.0);\n"
    53     "    pass_Color = in_Color;\n"
     53    //"    pass_Color = in_Color;\n"
    5454    "}\n";
    5555
     
    5858    "\n"
    5959    "uniform sampler2D in_Texture;\n"
    60     "in vec3 pass_Color;\n"
     60    //"in vec3 pass_Color;\n"
    6161    "out vec4 out_Color;\n"
    6262    "\n"
     
    132132    view_matrix = mat4(1.0f);
    133133
    134 #if !LOL_EXPERIMENTAL
    135     glMatrixMode(GL_PROJECTION);
    136     glLoadIdentity();
    137     glMultMatrixf(&proj_matrix[0][0]);
    138 
    139     /* Reset the model view matrix, just in case */
    140     glMatrixMode(GL_MODELVIEW);
    141     glLoadIdentity();
    142     glMultMatrixf(&view_matrix[0][0]);
    143 #endif
    144 }
    145 
    146 void Video::SetDepth(bool set)
    147 {
    148     if (set)
    149         glEnable(GL_DEPTH_TEST);
    150     else
    151         glDisable(GL_DEPTH_TEST);
    152 }
    153 
    154 void Video::Clear()
    155 {
    156     glViewport(0, 0, GetWidth(), GetHeight());
    157     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
    158 
    159134#if LOL_EXPERIMENTAL
    160135    GLuint uni;
     
    163138    uni = stdshader->GetUniformLocation("view_matrix");
    164139    glUniformMatrix4fv(uni, 1, GL_FALSE, &view_matrix[0][0]);
    165 #endif
     140#else
     141    glMatrixMode(GL_PROJECTION);
     142    glLoadIdentity();
     143    glMultMatrixf(&proj_matrix[0][0]);
     144
     145    /* Reset the model view matrix, just in case */
     146    glMatrixMode(GL_MODELVIEW);
     147    glLoadIdentity();
     148    glMultMatrixf(&view_matrix[0][0]);
     149#endif
     150}
     151
     152void Video::SetDepth(bool set)
     153{
     154    if (set)
     155        glEnable(GL_DEPTH_TEST);
     156    else
     157        glDisable(GL_DEPTH_TEST);
     158}
     159
     160void Video::Clear()
     161{
     162    glViewport(0, 0, GetWidth(), GetHeight());
     163    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
    166164
    167165    SetFov(0.0f);
Note: See TracChangeset for help on using the changeset viewer.