Changeset 683


Ignore:
Timestamp:
Feb 22, 2011, 2:17:48 AM (11 years ago)
Author:
sam
Message:

Try to fix GLES 2 rendering. No luck so far.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/eglapp.cpp

    r682 r683  
    2525
    2626#include "core.h"
     27#include "lolgl.h"
    2728#include "eglapp.h"
    2829
  • trunk/src/scene.cpp

    r675 r683  
    155155
    156156#if defined HAVE_GL_2X || defined HAVE_GLES_2X
    157     GLuint uni, attr_pos, attr_tex;
    158     uni = stdshader->GetUniformLocation("model_matrix");
     157    GLuint uni_mat, uni_tex, attr_pos, attr_tex;
    159158    attr_pos = stdshader->GetAttribLocation("in_Position");
    160159    attr_tex = stdshader->GetAttribLocation("in_TexCoord");
    161160
    162161    stdshader->Bind();
    163     glUniformMatrix4fv(uni, 1, GL_FALSE, &model_matrix[0][0]);
     162    uni_mat = stdshader->GetUniformLocation("model_matrix");
     163    glUniformMatrix4fv(uni_mat, 1, GL_FALSE, &model_matrix[0][0]);
     164    uni_tex = stdshader->GetUniformLocation("in_Texture");
     165    glUniform1i(uni_tex, 0);
    164166
    165167    glEnable(GL_DEPTH_TEST);
     
    210212
    211213#if defined HAVE_GL_2X || defined HAVE_GLES_2X
     214        stdshader->Bind();
     215#endif
     216        glActiveTexture(GL_TEXTURE0);
     217        Tiler::Bind(data->tiles[i].code);
     218
     219#if defined HAVE_GL_2X || defined HAVE_GLES_2X
    212220#   if !defined HAVE_GLES_2X
    213221        glBindVertexArray(data->vao);
     
    248256#endif
    249257
    250 #if defined HAVE_GL_2X || defined HAVE_GLES_2X
    251         stdshader->Bind();
    252 #endif
    253 
    254         Tiler::Bind(data->tiles[i].code);
    255258        glDrawArrays(GL_TRIANGLES, 0, (n - i) * 6);
    256259
  • trunk/src/video.cpp

    r682 r683  
    3131#if defined HAVE_GL_2X || defined HAVE_GLES_2X
    3232static char const *vertexshader =
     33#if !defined HAVE_GLES_2X
     34    "#version 130\n"
     35#endif
     36    "\n"
    3337#if defined HAVE_GLES_2X
    3438    "attribute vec3 in_Position;\n"
     
    3640    "varying vec2 pass_TexCoord;\n"
    3741#else
    38     "#version 130\n"
    39     "\n"
    4042    "in vec3 in_Position;\n"
    4143    "in vec2 in_TexCoord;\n"
     
    6062
    6163static char const *fragmentshader =
     64#if !defined HAVE_GLES_2X
    6265    "#version 130\n"
     66#endif
    6367    "\n"
    6468    "uniform sampler2D in_Texture;\n"
     
    7175    "void main()\n"
    7276    "{\n"
    73     //"    gl_FragColor = 0.5 * (texture2D(in_Texture, vec2(gl_TexCoord[0]))\n"
    74     //"                           + vec4(pass_Color, 1.0));\n"
    75 #if defined HAVE_GLES_2X
    76     "    gl_FragColor = vec4(0.5, 1.0, 0.0, 0.5);\n"
     77#if defined HAVE_GLES_2X
     78    "    gl_FragColor = texture2D(in_Texture, pass_TexCoord);\n"
     79    //"    gl_FragColor = vec4(0.5, 1.0, 0.0, 0.5);\n"
     80    //"    gl_FragColor = vec4(pass_TexCoord * 4.0, 0.0, 0.25);\n"
    7781#else
    7882    "    gl_FragColor = texture2D(in_Texture, vec2(gl_TexCoord[0]));\n"
    7983#endif
    80     //"    gl_FragColor = texture2D(in_Texture, pass_TexCoord);\n"
    8184    "}\n";
    8285#endif
Note: See TracChangeset for help on using the changeset viewer.