[Cogl] [PATCH] gl: bind position attribute to location 0

Neil Roberts neil at linux.intel.com
Mon Aug 19 03:39:10 PDT 2013


I think this patch makes sense to land but it does highlight the issue
that we are effectively requiring applications to use cogl_position_in
if they want to work on GL2 because if they were to entirely use their
own attributes then they would have no way to force a non-constant
attribute into position zero. I don't suppose there's any particular
reason not to use cogl_position_in in practice unless you are converting
existing code that uses a custom attribute. However I wonder if we
should consider documenting that and maybe even make
_cogl_flush_attributes_state give a warning if there is no non-constant
binding for cogl_position_in.

> +      /* XXX: OpenGL as a special case requires the vertex position to
> +       * be bound to generic attribute 0 so for simplicity we
> +       * unconditionally bind the cogl_position_in attribute here...
> +       */
> +      GE( ctx, glBindAttribLocation (program_state->program, 0,
> "cogl_position_in"));

It would be nice if you could make this line fit in 80 characters.

> +  snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX,
> +                              "attribute vec4 color;",
> +                              "cogl_color_out = vec4 (0.0, 1.0, 0, 1.0);");
> +  cogl_pipeline_add_snippet (pipeline2, snippet);

That 0 should probably be 0.0 or it might not compile on fussy drivers.

Reviewed-by: Neil Roberts <neil at linux.intel.com>

Regards,
- Neil
---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



More information about the Cogl mailing list