[cogl] Fix the GLES 2.0 backend

Update the GLES 2.0 backend to the new COGL API after the breakage
introduced by the journal.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
This commit is contained in:
zhou jiangwei 2009-08-11 14:17:28 +01:00 committed by Emmanuele Bassi
parent dbfd3f0f44
commit 2ab9bef587
5 changed files with 20 additions and 8 deletions

View File

@ -88,6 +88,7 @@ typedef void (*CoglJournalBatchCallback) (CoglJournalEntry *start,
void *data);
typedef gboolean (*CoglJournalBatchTest) (CoglJournalEntry *entry0,
CoglJournalEntry *entry1);
typedef CoglVertexBufferIndices CoglJournalIndices;
typedef struct _CoglJournalFlushState
{
@ -212,8 +213,8 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start,
int indices_offset = (state->vertex_offset / 4) * 6;
GE (glDrawElements (GL_TRIANGLES,
6 * batch_len,
indices->type,
indices_offset * state->indices_type_size));
state->indices->type,
(GLvoid*)(indices_offset * state->indices_type_size)));
}
else
{

View File

@ -28,7 +28,7 @@
#include "cogl-clip-stack.h"
#include "cogl-matrix-stack.h"
#include "cogl-current-matrix.h"
#include "cogl-material-private.h"
#include "cogl-gles2-wrapper.h"
typedef struct
@ -61,6 +61,7 @@ typedef struct
/* Client-side matrix stack or NULL if none */
CoglMatrixMode matrix_mode;
CoglMatrixStack *modelview_stack;
CoglMatrixStack *projection_stack;
/* Cache of inverse projection matrix */
float inverse_projection[16];
@ -81,10 +82,12 @@ typedef struct
GArray *journal;
GArray *logged_vertices;
GArray *polygon_vertices;
GLuint journal_vbo;
/* Some simple caching, to minimize state changes... */
CoglHandle current_material;
gulong current_material_flags;
CoglMaterialFlushOptions current_material_flush_options;
GArray *current_layers;
guint n_texcoord_arrays_enabled;

View File

@ -229,6 +229,11 @@ struct _CoglGles2WrapperShader
#define GL_MODELVIEW 0x1700
#define GL_PROJECTION 0x1701
#ifdef COGL_ENABLE_DEBUG
#define GL_STACK_OVERFLOW 0x0503
#define GL_STACK_UNDERFLOW 0x0504
#endif
#define GL_VERTEX_ARRAY 0x8074
#define GL_TEXTURE_COORD_ARRAY 0x8078
#define GL_COLOR_ARRAY 0x8076

View File

@ -76,17 +76,17 @@ _cogl_path_stroke_nodes ()
{
guint path_start = 0;
gulong enable_flags = COGL_ENABLE_VERTEX_ARRAY;
CoglMaterialFlushOptions options;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
enable_flags |= _cogl_material_get_cogl_enable_flags (ctx->source_material);
cogl_enable (enable_flags);
_cogl_material_flush_gl_state (ctx->source_material,
COGL_MATERIAL_FLUSH_DISABLE_MASK,
(guint32)~0, /* disable all texture layers */
NULL);
_cogl_current_matrix_state_flush ();
options.flags = COGL_MATERIAL_FLUSH_DISABLE_MASK;
options.disable_layers = (guint32)~0;
_cogl_material_flush_gl_state (ctx->source_material,&options);
_cogl_flush_matrix_stacks();
while (path_start < ctx->path_nodes->len)
{

View File

@ -25,6 +25,7 @@
#define __COGL_TEXTURE_H
#include "cogl-bitmap-private.h"
#include "cogl-material-private.h"
#include "cogl-handle.h"
typedef struct _CoglTexture CoglTexture;
@ -103,6 +104,8 @@ typedef struct _CoglJournalEntry
gint n_layers;
guint32 fallback_mask;
GLuint layer0_override_texture;
CoglMatrix model_view;
CoglMaterialFlushOptions flush_options;
} CoglJournalEntry;
CoglTexture*