[Bf-viewport] OpenGL low level shader API proposal

Brecht Van Lommel brechtvanlommel at pandora.be
Sat Dec 5 15:44:00 CET 2015


UI code could still be simple. I don't have the design for that worked
out, but you'd have a set of simple shaders that you could use like
this.

GPUShader *shader = GPU_simple_color_shader();
GPUShaderParams *params = GPU_simple_color_params(1.0f, 0.5f, 0.0f);

No need to inspect vertex attributes because there aren't any, just
pass these to a draw function. It can be made more compact, for
example with a utility function like this:

UI_theme_color_draw(TH_NODE_COLOR, vertex_buffers, transformation);

The purpose of this proposal is to provide the  GPUShader /
GPUShaderParams that these things can be built on. I have some code
for simple shaders but wanted to get the underlying mechanism worked
out first.
https://developer.blender.org/D1645

On Sat, Dec 5, 2015 at 10:13 AM, Ton Roosendaal <ton at blender.org> wrote:
> Hi,
>
> Thanks for the writeup. For the more complex (3d viewport) case this would be fine I guess.
>
> How would then the case for "simple constant color" work? We can probably ditch most of the hardcoded glColor cases, but the theme color api should preferably stay very simple and quick to use.
>
> Maybe each editor (spacetype) can prepare a set of per-editor callbacks for it?
>
> -Ton-
>
> --------------------------------------------------------
> Ton Roosendaal  -  ton at blender.org   -   www.blender.org
> Chairman Blender Foundation - Producer Blender Institute
> Entrepotdok 57A  -  1018AD Amsterdam  -  The Netherlands
>
>
>
>> On 5 Dec, 2015, at 3:02, Brecht Van Lommel <brechtvanlommel at gmail.com> wrote:
>>
>> Hi all,
>>
>> I've written a rough proposal for the low level shader API that all
>> OpenGL shaders would use, both for mesh and UI drawing.
>> http://wiki.blender.org/index.php/Dev:2.8/Source/OpenGL/Shaders
>>
>> It builds on data structures and APIs that are already there, moving
>> information about required vertex attributes from GPUMaterial to
>> GPUShader, while moving uniform and texture values into a new
>> GPUShaderParams. Nothing radical really.
>>
>> What do you think?
>>
>> Thanks,
>> Brecht.
>> _______________________________________________
>> Bf-viewport mailing list
>> Bf-viewport at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-viewport
>
> _______________________________________________
> Bf-viewport mailing list
> Bf-viewport at blender.org
> http://lists.blender.org/mailman/listinfo/bf-viewport


More information about the Bf-viewport mailing list