Updates GLES1 support for CoglMaterial
This updates cogl/gles in line with the integration of CoglMaterial throughout Cogl that has been done for cogl/gl. Note: This is still buggy, but at least it builds again and test-actors works. Some GLES2 specific changes were made, but these haven't been tested yet.
This commit is contained in:
parent
e9a9acd28d
commit
9abf44eac3
@ -886,8 +886,12 @@ _cogl_material_flush_layers_gl_state (CoglMaterial *material,
|
||||
_cogl_material_layer_pointer_from_handle (layer_handle);
|
||||
CoglLayerInfo *gl_layer_info = NULL;
|
||||
CoglLayerInfo new_gl_layer_info;
|
||||
CoglHandle tex_handle;
|
||||
GLuint gl_texture;
|
||||
GLenum gl_target;
|
||||
#ifdef HAVE_COGL_GLES2
|
||||
GLenum gl_internal_format;
|
||||
#endif
|
||||
|
||||
new_gl_layer_info.layer0_overridden =
|
||||
layer0_override_texture ? TRUE : FALSE;
|
||||
@ -912,18 +916,19 @@ _cogl_material_flush_layers_gl_state (CoglMaterial *material,
|
||||
continue;
|
||||
}
|
||||
|
||||
cogl_texture_get_gl_texture (layer->texture, &gl_texture, &gl_target);
|
||||
tex_handle = layer->texture;
|
||||
cogl_texture_get_gl_texture (tex_handle, &gl_texture, &gl_target);
|
||||
|
||||
if (new_gl_layer_info.layer0_overridden)
|
||||
gl_texture = layer0_override_texture;
|
||||
else if (new_gl_layer_info.fallback)
|
||||
{
|
||||
CoglHandle tex_handle;
|
||||
|
||||
if (gl_target == GL_TEXTURE_2D)
|
||||
tex_handle = ctx->default_gl_texture_2d_tex;
|
||||
#ifdef HAVE_COGL_GL
|
||||
else if (gl_target == GL_TEXTURE_RECTANGLE_ARB)
|
||||
tex_handle = ctx->default_gl_texture_rect_tex;
|
||||
#endif
|
||||
else
|
||||
{
|
||||
g_warning ("We don't have a default texture we can use to fill "
|
||||
@ -935,12 +940,28 @@ _cogl_material_flush_layers_gl_state (CoglMaterial *material,
|
||||
cogl_texture_get_gl_texture (tex_handle, &gl_texture, NULL);
|
||||
}
|
||||
|
||||
#ifdef HAVE_COGL_GLES2
|
||||
{
|
||||
CoglTexture *tex =
|
||||
_cogl_texture_pointer_from_handle (tex_handle);
|
||||
gl_internal_format = tex->gl_intformat;
|
||||
}
|
||||
#endif
|
||||
|
||||
GE (glActiveTexture (GL_TEXTURE0 + i));
|
||||
|
||||
if (!gl_layer_info
|
||||
|| gl_layer_info->gl_target != gl_target
|
||||
|| gl_layer_info->gl_texture != gl_texture)
|
||||
{
|
||||
#ifdef HAVE_COGL_GLES2
|
||||
cogl_gles2_wrapper_bind_texture (gl_target,
|
||||
gl_texture,
|
||||
gl_internal_format);
|
||||
#else
|
||||
GE (glBindTexture (gl_target, gl_texture));
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Disable the previous target if it was different */
|
||||
if (gl_layer_info &&
|
||||
@ -1007,7 +1028,11 @@ _cogl_material_flush_base_gl_state (CoglMaterial *material)
|
||||
if (!(ctx->current_material_flags & COGL_MATERIAL_FLAG_DEFAULT_COLOR
|
||||
&& material->flags & COGL_MATERIAL_FLAG_DEFAULT_COLOR))
|
||||
{
|
||||
GE (glColor4fv (material->unlit));
|
||||
/* GLES doesn't have glColor4fv... */
|
||||
GE (glColor4f (material->unlit[0],
|
||||
material->unlit[1],
|
||||
material->unlit[2],
|
||||
material->unlit[3]));
|
||||
}
|
||||
|
||||
if (!(ctx->current_material_flags & COGL_MATERIAL_FLAG_DEFAULT_GL_MATERIAL
|
||||
|
@ -51,6 +51,13 @@
|
||||
printf("err: 0x%x\n", err); \
|
||||
} */
|
||||
|
||||
#ifdef HAVE_COGL_GL
|
||||
#ifdef glDrawRangeElements
|
||||
#undef glDrawRangeElements
|
||||
#endif
|
||||
#define glDrawRangeElements ctx->pf_glDrawRangeElements
|
||||
#endif
|
||||
|
||||
static void _cogl_journal_flush (void);
|
||||
|
||||
static void _cogl_texture_free (CoglTexture *tex);
|
||||
@ -2970,6 +2977,16 @@ cogl_polygon (CoglTextureVertex *vertices,
|
||||
|
||||
if (i == 0 && cogl_texture_is_sliced (tex_handle))
|
||||
{
|
||||
#if defined (HAVE_COGL_GLES) || defined (HAVE_COGL_GLES2)
|
||||
{
|
||||
static gboolean shown_gles_slicing_warning = FALSE;
|
||||
if (!shown_gles_slicing_warning)
|
||||
g_warning ("cogl_polygon does not work for sliced textures "
|
||||
"on GL ES");
|
||||
shown_gles_slicing_warning = TRUE;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (n_layers > 1)
|
||||
{
|
||||
static gboolean shown_slicing_warning = FALSE;
|
||||
|
@ -28,20 +28,24 @@
|
||||
#endif
|
||||
|
||||
#include "cogl.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "cogl-internal.h"
|
||||
#include "cogl-util.h"
|
||||
#include "cogl-context.h"
|
||||
#include "cogl-texture-private.h"
|
||||
#include "cogl-material-private.h"
|
||||
|
||||
#include "cogl-gles2-wrapper.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static CoglContext *_context = NULL;
|
||||
|
||||
gboolean
|
||||
cogl_create_context ()
|
||||
{
|
||||
GLubyte default_texture_data[] = { 0xff, 0xff, 0xff, 0x0 };
|
||||
gulong enable_flags = 0;
|
||||
|
||||
if (_context != NULL)
|
||||
return FALSE;
|
||||
|
||||
@ -55,42 +59,77 @@ cogl_create_context ()
|
||||
_context->enable_flags = 0;
|
||||
_context->color_alpha = 255;
|
||||
|
||||
_context->path_nodes = g_array_new (FALSE, FALSE, sizeof (CoglPathNode));
|
||||
_context->last_path = 0;
|
||||
|
||||
_context->texture_handles = NULL;
|
||||
_context->texture_vertices = g_array_new (FALSE, FALSE,
|
||||
sizeof (CoglTextureGLVertex));
|
||||
_context->texture_indices = g_array_new (FALSE, FALSE,
|
||||
sizeof (GLushort));
|
||||
|
||||
_context->material_handles = NULL;
|
||||
_context->material_layer_handles = NULL;
|
||||
_context->source_material = COGL_INVALID_HANDLE;
|
||||
_context->default_material = cogl_material_new ();
|
||||
_context->source_material = NULL;
|
||||
|
||||
_context->texture_handles = NULL;
|
||||
_context->default_gl_texture_2d_tex = COGL_INVALID_HANDLE;
|
||||
_context->default_gl_texture_rect_tex = COGL_INVALID_HANDLE;
|
||||
_context->texture_download_material = COGL_INVALID_HANDLE;
|
||||
|
||||
_context->journal = g_array_new (FALSE, FALSE, sizeof (CoglJournalEntry));
|
||||
_context->logged_vertices = g_array_new (FALSE, FALSE, sizeof (GLfloat));
|
||||
_context->static_indices = g_array_new (FALSE, FALSE, sizeof (GLushort));
|
||||
_context->polygon_vertices = g_array_new (FALSE, FALSE,
|
||||
sizeof (CoglTextureGLVertex));
|
||||
|
||||
_context->current_material = NULL;
|
||||
_context->current_material_flags = 0;
|
||||
_context->current_layers = g_array_new (FALSE, FALSE,
|
||||
sizeof (CoglLayerInfo));
|
||||
_context->n_texcoord_arrays_enabled = 0;
|
||||
|
||||
_context->fbo_handles = NULL;
|
||||
_context->program_handles = NULL;
|
||||
_context->shader_handles = NULL;
|
||||
_context->draw_buffer = COGL_WINDOW_BUFFER;
|
||||
|
||||
_context->shader_handles = NULL;
|
||||
|
||||
_context->program_handles = NULL;
|
||||
|
||||
_context->vertex_buffer_handles = NULL;
|
||||
|
||||
_context->blend_src_factor = CGL_SRC_ALPHA;
|
||||
_context->blend_dst_factor = CGL_ONE_MINUS_SRC_ALPHA;
|
||||
_context->path_nodes = g_array_new (FALSE, FALSE, sizeof (CoglPathNode));
|
||||
_context->last_path = 0;
|
||||
_context->stencil_material = cogl_material_new ();
|
||||
|
||||
/* Init the GLES2 wrapper */
|
||||
#ifdef HAVE_COGL_GLES2
|
||||
cogl_gles2_wrapper_init (&_context->gles2);
|
||||
#endif
|
||||
|
||||
/* Init OpenGL state */
|
||||
GE( glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE) );
|
||||
GE( glColorMask (TRUE, TRUE, TRUE, FALSE) );
|
||||
GE( glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) );
|
||||
cogl_enable (0);
|
||||
|
||||
/* Initialise the clip stack */
|
||||
_cogl_clip_stack_state_init ();
|
||||
|
||||
/* Create default textures used for fall backs */
|
||||
_context->default_gl_texture_2d_tex =
|
||||
cogl_texture_new_from_data (1, /* width */
|
||||
1, /* height */
|
||||
-1, /* max waste */
|
||||
FALSE, /* auto mipmap */
|
||||
COGL_PIXEL_FORMAT_RGBA_8888, /* data format */
|
||||
/* internal format */
|
||||
COGL_PIXEL_FORMAT_RGBA_8888,
|
||||
0, /* auto calc row stride */
|
||||
&default_texture_data);
|
||||
_context->default_gl_texture_rect_tex =
|
||||
cogl_texture_new_from_data (1, /* width */
|
||||
1, /* height */
|
||||
-1, /* max waste */
|
||||
FALSE, /* auto mipmap */
|
||||
COGL_PIXEL_FORMAT_RGBA_8888, /* data format */
|
||||
/* internal format */
|
||||
COGL_PIXEL_FORMAT_RGBA_8888,
|
||||
0, /* auto calc row stride */
|
||||
&default_texture_data);
|
||||
|
||||
cogl_set_source (_context->default_material);
|
||||
cogl_material_flush_gl_state (_context->source_material, NULL);
|
||||
enable_flags =
|
||||
cogl_material_get_cogl_enable_flags (_context->source_material);
|
||||
cogl_enable (enable_flags);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -105,15 +144,6 @@ cogl_destroy_context ()
|
||||
if (_context->path_nodes)
|
||||
g_array_free (_context->path_nodes, TRUE);
|
||||
|
||||
#ifdef HAVE_COGL_GLES2
|
||||
cogl_gles2_wrapper_deinit (&_context->gles2);
|
||||
#endif
|
||||
|
||||
if (_context->texture_vertices)
|
||||
g_array_free (_context->texture_vertices, TRUE);
|
||||
if (_context->texture_indices)
|
||||
g_array_free (_context->texture_indices, TRUE);
|
||||
|
||||
if (_context->texture_handles)
|
||||
g_array_free (_context->texture_handles, TRUE);
|
||||
if (_context->fbo_handles)
|
||||
@ -123,13 +153,33 @@ cogl_destroy_context ()
|
||||
if (_context->program_handles)
|
||||
g_array_free (_context->program_handles, TRUE);
|
||||
|
||||
if (_context->default_gl_texture_2d_tex)
|
||||
cogl_texture_unref (_context->default_gl_texture_2d_tex);
|
||||
if (_context->default_gl_texture_rect_tex)
|
||||
cogl_texture_unref (_context->default_gl_texture_rect_tex);
|
||||
|
||||
if (_context->default_material)
|
||||
cogl_material_unref (_context->default_material);
|
||||
|
||||
if (_context->journal)
|
||||
g_array_free (_context->journal, TRUE);
|
||||
if (_context->logged_vertices)
|
||||
g_array_free (_context->logged_vertices, TRUE);
|
||||
|
||||
if (_context->static_indices)
|
||||
g_array_free (_context->static_indices, TRUE);
|
||||
if (_context->polygon_vertices)
|
||||
g_array_free (_context->polygon_vertices, TRUE);
|
||||
if (_context->current_layers)
|
||||
g_array_free (_context->current_layers, TRUE);
|
||||
|
||||
g_free (_context);
|
||||
}
|
||||
|
||||
CoglContext *
|
||||
_cogl_context_get_default ()
|
||||
{
|
||||
/* Create if doesn't exists yet */
|
||||
/* Create if doesn't exist yet */
|
||||
if (_context == NULL)
|
||||
cogl_create_context ();
|
||||
|
||||
|
@ -47,11 +47,55 @@ typedef struct
|
||||
/* Enable cache */
|
||||
gulong enable_flags;
|
||||
guint8 color_alpha;
|
||||
COGLenum blend_src_factor;
|
||||
COGLenum blend_dst_factor;
|
||||
|
||||
gboolean enable_backface_culling;
|
||||
|
||||
/* Cache of inverse projection matrix */
|
||||
float inverse_projection[16];
|
||||
|
||||
/* Materials */
|
||||
GArray *material_handles;
|
||||
GArray *material_layer_handles;
|
||||
CoglHandle default_material;
|
||||
CoglHandle source_material;
|
||||
|
||||
/* Textures */
|
||||
GArray *texture_handles;
|
||||
CoglHandle default_gl_texture_2d_tex;
|
||||
CoglHandle default_gl_texture_rect_tex;
|
||||
CoglHandle texture_download_material;
|
||||
|
||||
/* Batching geometry... */
|
||||
/* We journal the texture rectangles we want to submit to OpenGL so
|
||||
* we have an oppertunity to optimise the final order so that we
|
||||
* can batch things together. */
|
||||
GArray *journal;
|
||||
GArray *logged_vertices;
|
||||
GArray *static_indices;
|
||||
GArray *polygon_vertices;
|
||||
|
||||
/* Some simple caching, to minimize state changes... */
|
||||
CoglHandle current_material;
|
||||
gulong current_material_flags;
|
||||
GArray *current_layers;
|
||||
guint n_texcoord_arrays_enabled;
|
||||
|
||||
/* Framebuffer objects */
|
||||
GArray *fbo_handles;
|
||||
CoglBufferTarget draw_buffer;
|
||||
|
||||
/* Shaders */
|
||||
GArray *shader_handles;
|
||||
|
||||
/* Programs */
|
||||
GArray *program_handles;
|
||||
|
||||
/* Clip stack */
|
||||
CoglClipStackState clip;
|
||||
|
||||
/* Vertex buffers */
|
||||
GArray *vertex_buffer_handles;
|
||||
|
||||
/* Primitives */
|
||||
floatVec2 path_start;
|
||||
floatVec2 path_pen;
|
||||
@ -59,39 +103,7 @@ typedef struct
|
||||
guint last_path;
|
||||
floatVec2 path_nodes_min;
|
||||
floatVec2 path_nodes_max;
|
||||
|
||||
/* Cache of inverse projection matrix */
|
||||
float inverse_projection[16];
|
||||
|
||||
/* Textures */
|
||||
GArray *texture_handles;
|
||||
GArray *texture_vertices;
|
||||
GArray *texture_indices;
|
||||
/* The gl texture number that the above vertices apply to. This to
|
||||
detect when a different slice is encountered so that the vertices
|
||||
can be flushed */
|
||||
GLuint texture_current;
|
||||
GLenum texture_target;
|
||||
GLenum texture_format;
|
||||
|
||||
/* Materials */
|
||||
GArray *material_handles;
|
||||
GArray *material_layer_handles;
|
||||
CoglHandle source_material;
|
||||
|
||||
/* Framebuffer objects */
|
||||
GArray *fbo_handles;
|
||||
CoglBufferTarget draw_buffer;
|
||||
|
||||
/* Shaders */
|
||||
GArray *program_handles;
|
||||
GArray *shader_handles;
|
||||
|
||||
/* Vertex buffers */
|
||||
GArray *vertex_buffer_handles;
|
||||
|
||||
/* Clip stack */
|
||||
CoglClipStackState clip;
|
||||
CoglHandle stencil_material;
|
||||
|
||||
#ifdef HAVE_COGL_GLES2
|
||||
CoglGles2Wrapper gles2;
|
||||
|
@ -369,6 +369,11 @@ void _cogl_gles2_clear_cache_for_program (CoglHandle program);
|
||||
glGenerateMipmap doesn't need to do anything */
|
||||
#define cogl_wrap_glGenerateMipmap(x) ((void) 0)
|
||||
|
||||
/* GLES doesn't have glDrawRangeElements, so we simply pretend it does
|
||||
* but that it makes no use of the start, end constraints: */
|
||||
#define glDrawRangeElements(mode, start, end, count, type, indices) \
|
||||
glDrawElements (mode, count, type, indices)
|
||||
|
||||
#endif /* HAVE_COGL_GLES2 */
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -75,13 +75,10 @@ const char *_cogl_error_string(GLenum errorCode);
|
||||
#endif /* COGL_DEBUG */
|
||||
|
||||
#define COGL_ENABLE_BLEND (1<<1)
|
||||
#define COGL_ENABLE_TEXTURE_2D (1<<2)
|
||||
#define COGL_ENABLE_ALPHA_TEST (1<<3)
|
||||
#define COGL_ENABLE_TEXTURE_RECT (1<<4)
|
||||
#define COGL_ENABLE_VERTEX_ARRAY (1<<5)
|
||||
#define COGL_ENABLE_TEXCOORD_ARRAY (1<<6)
|
||||
#define COGL_ENABLE_COLOR_ARRAY (1<<7)
|
||||
#define COGL_ENABLE_BACKFACE_CULLING (1<<8)
|
||||
#define COGL_ENABLE_ALPHA_TEST (1<<2)
|
||||
#define COGL_ENABLE_VERTEX_ARRAY (1<<3)
|
||||
#define COGL_ENABLE_COLOR_ARRAY (1<<4)
|
||||
#define COGL_ENABLE_BACKFACE_CULLING (1<<5)
|
||||
|
||||
gint
|
||||
_cogl_get_format_bpp (CoglPixelFormat format);
|
||||
|
@ -38,27 +38,6 @@
|
||||
|
||||
#define _COGL_MAX_BEZ_RECURSE_DEPTH 16
|
||||
|
||||
void
|
||||
_cogl_rectangle (float x,
|
||||
float y,
|
||||
float width,
|
||||
float height)
|
||||
{
|
||||
GLfloat rect_verts[8] = {
|
||||
(GLfloat) x, (GLfloat) y,
|
||||
(GLfloat) (x + width), (GLfloat) y,
|
||||
(GLfloat) x, (GLfloat) (y + height),
|
||||
(GLfloat) (x + width), (GLfloat) (y + height)
|
||||
};
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
cogl_enable (COGL_ENABLE_VERTEX_ARRAY
|
||||
| (ctx->color_alpha < 255 ? COGL_ENABLE_BLEND : 0));
|
||||
GE ( glVertexPointer (2, GL_FLOAT, 0, rect_verts ) );
|
||||
GE ( glDrawArrays (GL_TRIANGLE_STRIP, 0, 4) );
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_path_add_node (gboolean new_sub_path,
|
||||
float x,
|
||||
@ -97,19 +76,24 @@ void
|
||||
_cogl_path_stroke_nodes ()
|
||||
{
|
||||
guint path_start = 0;
|
||||
gulong enable_flags = COGL_ENABLE_VERTEX_ARRAY;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
cogl_enable (COGL_ENABLE_VERTEX_ARRAY
|
||||
| (ctx->color_alpha < 255
|
||||
? COGL_ENABLE_BLEND : 0));
|
||||
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);
|
||||
|
||||
while (path_start < ctx->path_nodes->len)
|
||||
{
|
||||
CoglPathNode *path = &g_array_index (ctx->path_nodes, CoglPathNode,
|
||||
path_start);
|
||||
|
||||
GE( glVertexPointer (2, GL_FIXED, sizeof (CoglPathNode),
|
||||
GE( glVertexPointer (2, GL_FLOAT, sizeof (CoglPathNode),
|
||||
(guchar *) path
|
||||
+ G_STRUCT_OFFSET (CoglPathNode, x)) );
|
||||
GE( glDrawArrays (GL_LINE_STRIP, 0, path->path_size) );
|
||||
@ -151,6 +135,16 @@ _cogl_add_path_to_stencil_buffer (floatVec2 nodes_min,
|
||||
float bounds_y;
|
||||
float bounds_w;
|
||||
float bounds_h;
|
||||
gulong enable_flags = COGL_ENABLE_VERTEX_ARRAY;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
/* Just setup a simple material that doesn't use texturing... */
|
||||
cogl_material_flush_gl_state (ctx->stencil_material, NULL);
|
||||
|
||||
enable_flags |=
|
||||
cogl_material_get_cogl_enable_flags (ctx->source_material);
|
||||
cogl_enable (enable_flags);
|
||||
|
||||
_cogl_path_get_bounds (nodes_min, nodes_max,
|
||||
&bounds_x, &bounds_y, &bounds_w, &bounds_h);
|
||||
@ -175,9 +169,7 @@ _cogl_add_path_to_stencil_buffer (floatVec2 nodes_min,
|
||||
|
||||
while (path_start < path_size)
|
||||
{
|
||||
cogl_enable (COGL_ENABLE_VERTEX_ARRAY);
|
||||
|
||||
GE( glVertexPointer (2, GL_FIXED, sizeof (CoglPathNode),
|
||||
GE( glVertexPointer (2, GL_FLOAT, sizeof (CoglPathNode),
|
||||
(guchar *) path
|
||||
+ G_STRUCT_OFFSET (CoglPathNode, x)) );
|
||||
GE( glDrawArrays (GL_TRIANGLE_FAN, 0, path->path_size) );
|
||||
@ -444,4 +436,3 @@ _cogl_path_fill_nodes ()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,6 @@
|
||||
typedef struct _CoglTexture CoglTexture;
|
||||
typedef struct _CoglTexSliceSpan CoglTexSliceSpan;
|
||||
typedef struct _CoglSpanIter CoglSpanIter;
|
||||
typedef struct _CoglMultiTexture CoglMultiTexture;
|
||||
typedef struct _CoglMultiTextureLayer CoglMultiTextureLayer;
|
||||
|
||||
struct _CoglTexSliceSpan
|
||||
{
|
||||
@ -61,26 +59,23 @@ struct _CoglTexture
|
||||
gboolean auto_mipmap;
|
||||
};
|
||||
|
||||
struct _CoglMultiTextureLayer
|
||||
/* To improve batching of geometry when submitting vertices to OpenGL we
|
||||
* log the texture rectangles we want to draw to a journal, so when we
|
||||
* later flush the journal we aim to batch data, and gl draw calls. */
|
||||
typedef struct _CoglJournalEntry
|
||||
{
|
||||
guint ref_count;
|
||||
guint index; /*!< lowest index is blended first then others
|
||||
on top */
|
||||
CoglTexture *tex; /*!< The texture for this layer, or NULL
|
||||
for an empty layer */
|
||||
|
||||
/* TODO: Add more control over the texture environment for each texture
|
||||
* unit. For example we should support dot3 normal mapping. */
|
||||
};
|
||||
|
||||
struct _CoglMultiTexture
|
||||
{
|
||||
guint ref_count;
|
||||
GList *layers;
|
||||
};
|
||||
CoglHandle material;
|
||||
gint n_layers;
|
||||
guint32 fallback_mask;
|
||||
GLuint layer0_override_texture;
|
||||
} CoglJournalEntry;
|
||||
|
||||
CoglTexture*
|
||||
_cogl_texture_pointer_from_handle (CoglHandle handle);
|
||||
|
||||
#endif /* __COGL_TEXTURE_H */
|
||||
gboolean
|
||||
_cogl_texture_span_has_waste (CoglTexture *tex,
|
||||
gint x_span_index,
|
||||
gint y_span_index);
|
||||
|
||||
#endif /* __COGL_TEXTURE_H */
|
||||
|
1450
gles/cogl-texture.c
1450
gles/cogl-texture.c
File diff suppressed because it is too large
Load Diff
49
gles/cogl.c
49
gles/cogl.c
@ -92,10 +92,10 @@ cogl_paint_init (const CoglColor *color)
|
||||
fprintf(stderr, "\n ============== Paint Start ================ \n");
|
||||
#endif
|
||||
|
||||
glClearColor (cogl_color_get_red (color),
|
||||
cogl_color_get_green (color),
|
||||
cogl_color_get_blue (color),
|
||||
0);
|
||||
GE( glClearColor (cogl_color_get_red_float (color),
|
||||
cogl_color_get_green_float (color),
|
||||
cogl_color_get_blue_float (color),
|
||||
0.0) );
|
||||
|
||||
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
glDisable (GL_LIGHTING);
|
||||
@ -213,10 +213,6 @@ cogl_enable (gulong flags)
|
||||
COGL_ENABLE_BLEND,
|
||||
GL_BLEND);
|
||||
|
||||
cogl_toggle_flag (ctx, flags,
|
||||
COGL_ENABLE_TEXTURE_2D,
|
||||
GL_TEXTURE_2D);
|
||||
|
||||
cogl_toggle_flag (ctx, flags,
|
||||
COGL_ENABLE_BACKFACE_CULLING,
|
||||
GL_CULL_FACE);
|
||||
@ -225,10 +221,6 @@ cogl_enable (gulong flags)
|
||||
COGL_ENABLE_VERTEX_ARRAY,
|
||||
GL_VERTEX_ARRAY);
|
||||
|
||||
cogl_toggle_client_flag (ctx, flags,
|
||||
COGL_ENABLE_TEXCOORD_ARRAY,
|
||||
GL_TEXTURE_COORD_ARRAY);
|
||||
|
||||
cogl_toggle_client_flag (ctx, flags,
|
||||
COGL_ENABLE_COLOR_ARRAY,
|
||||
GL_COLOR_ARRAY);
|
||||
@ -272,34 +264,11 @@ cogl_set_source_color (const CoglColor *color)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
#if 0 /*HAVE_GLES_COLOR4UB*/
|
||||
/* In case cogl_set_source_texture was previously used... */
|
||||
cogl_material_remove_layer (ctx->default_material, 0);
|
||||
|
||||
/* NOTE: seems SDK_OGLES-1.1_LINUX_PCEMULATION_2.02.22.0756 has this call
|
||||
* but is broken - see #857. Therefor disabling.
|
||||
*/
|
||||
|
||||
/*
|
||||
* GLES 1.1 does actually have this function, it's in the header file but
|
||||
* missing in the reference manual (and SDK):
|
||||
*
|
||||
* http://www.khronos.org/egl/headers/1_1/gl.h
|
||||
*/
|
||||
GE( glColor4ub (color->red,
|
||||
color->green,
|
||||
color->blue,
|
||||
color->alpha) );
|
||||
|
||||
|
||||
#else
|
||||
/* conversion can cause issues with picking on some gles implementations */
|
||||
GE( glColor4f (cogl_color_get_red (color),
|
||||
cogl_color_get_green (color),
|
||||
cogl_color_get_blue (color),
|
||||
cogl_color_get_alpha (color)) );
|
||||
#endif
|
||||
|
||||
/* Store alpha for proper blending enables */
|
||||
ctx->color_alpha = cogl_color_get_alpha_byte (color);
|
||||
cogl_material_set_color (ctx->default_material, color);
|
||||
cogl_set_source (ctx->default_material);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -421,6 +390,8 @@ _cogl_add_stencil_clip (float x_offset,
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
cogl_material_flush_gl_state (ctx->stencil_material);
|
||||
|
||||
if (first)
|
||||
{
|
||||
GE( glEnable (GL_STENCIL_TEST) );
|
||||
|
Loading…
Reference in New Issue
Block a user