Ignore:
Timestamp:
Feb 21, 2011, 1:08:46 AM (9 years ago)
Author:
sam
Message:

The engine now builds for GL and GL ES 1.x and 2.x, and runs for each
one except GL ES 2.x for now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/video.cpp

    r673 r674  
    2424#include "lolgl.h"
    2525
    26 #if LOL_EXPERIMENTAL
     26#if defined HAVE_GL_2X || defined HAVE_GLES_2X
    2727Shader *stdshader;
    2828#endif
    2929mat4 proj_matrix, view_matrix, model_matrix;
    3030
    31 #if LOL_EXPERIMENTAL
     31#if defined HAVE_GL_2X || defined HAVE_GLES_2X
    3232static char const *vertexshader =
    3333    "#version 130\n"
     
    6161    //"                           + vec4(pass_Color, 1.0));\n"
    6262    "    gl_FragColor = texture2D(in_Texture, vec2(gl_TexCoord[0]));\n"
     63    //"    gl_FragColor = vec4(0.5, 1.0, 0.0, 0.5);\n"
    6364    "}\n";
    6465#endif
     
    7475
    7576    glEnable(GL_TEXTURE_2D);
     77#if defined HAVE_GL_2X || defined HAVE_GLES_1X
    7678    glShadeModel(GL_SMOOTH);
     79#endif
    7780    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    78     glClearDepth(1.0);
    79 
     81    glClearDepthf(1.0);
     82
     83#if defined HAVE_GL_2X || defined HAVE_GLES_1X
    8084    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
    81 
    82 #if LOL_EXPERIMENTAL
     85#endif
     86
     87#if defined HAVE_GL_2X || defined HAVE_GLES_2X
    8388    stdshader = Shader::Create(vertexshader, fragmentshader);
    8489#endif
     
    127132    view_matrix = mat4(1.0f);
    128133
    129 #if LOL_EXPERIMENTAL
     134#if defined HAVE_GL_2X || defined HAVE_GLES_2X
     135    stdshader->Bind(); /* Required on GLES 2.x? */
    130136    GLuint uni;
    131137    uni = stdshader->GetUniformLocation("proj_matrix");
     
    163169void Video::Destroy()
    164170{
    165 #if LOL_EXPERIMENTAL
     171#if defined HAVE_GL_2X || defined HAVE_GLES_2X
    166172    Shader::Destroy(stdshader);
    167173#endif
     
    174180    int width = v[2], height = v[3];
    175181
     182#if defined HAVE_GL_1X || defined HAVE_GL_2X
    176183    glPixelStorei(GL_PACK_ROW_LENGTH, 0);
     184#endif
    177185    glPixelStorei(GL_PACK_ALIGNMENT, 1);
    178186
Note: See TracChangeset for help on using the changeset viewer.