EihiS

June 13, 2014

Pi 3D reference files ( GLSL language, example shaders )

Filed under: Raspberry 3.14 — Tags: , , , , — admin @ 8:39 am

The files listed here are hosted on eihis.com’s website.
Reference for openGL ES 2.0 shader language aka ‘GLSL’ on the raspberry PI :

GL_shader_language_specifications_1-0-17 ( language specifications for OPENGL ES 2.0  )

Using this specifications, the ‘vertex’ and ‘fragment’ shader programs starts with preprocessor directive:

#version 100

Example vertex shader program using this specification’s syntax and types :

#version 100
attribute vec4 vPosition;
uniform mat4 viewMatrix, projMatrix,modelMatrix;
varying vec4 tcoord;
varying vec4 my_norm;
uniform float Scale;
void main(void)
{
lowp vec4 my_vector,my_test;
my_test=vPosition;
/* */
gl_Position = projMatrix * viewMatrix * modelMatrix * vPosition ;
my_vector=modelMatrix * vPosition;
my_norm=normalize(my_vector);
tcoord.x=my_norm.x;
tcoord.y=0.5;
tcoord.z=Scale;
}

Example fragment shader program, to be linked with the vertex’s one :

#version 100
precision mediump float;
varying vec4 tcoord;
/*out vec4 vOUTFragColor;*/
void main()
{
gl_FragColor = vec4(tcoord.x, tcoord.y , tcoord.z, 1.0);
}

Raspberry PI OpenGL es extensions :

GL_EXT_blend_minmax
GL_EXT_multi_draw_arrays
GL_EXT_texture_format_BGRA8888
GL_OES_compressed_ETC1_RGB8_texture
GL_OES_depth24
GL_OES_element_index_uint
GL_OES_fbo_render_mipmap
GL_OES_mapbuffer
GL_OES_rgb8_rgba8
GL_OES_standard_derivatives
GL_OES_stencil8
GL_OES_texture_3D
GL_OES_texture_npot
GL_OES_EGL_image
GL_OES_depth_texture
GL_OES_packed_depth_stencil
GL_EXT_texture_type_2_10_10_10_REV
GL_OES_get_program_binary
GL_APPLE_texture_max_level
GL_EXT_discard_framebuffer
GL_EXT_read_format_bgra
GL_NV_fbo_color_attachments
GL_OES_EGL_image_external
GL_OES_vertex_array_object
GL_EXT_texture_rg
GL_EXT_unpack_subimage
GL_NV_draw_buffers
GL_NV_read_buffer
GL_EXT_map_buffer_range
GL_OES_depth_texture_cube_map
GL_OES_surfaceless_context
GL_EXT_color_buffer_float

OpenGL ES 2.0 is very close to the CORE profile of OpenGL.
Forget about all built-in commands of the COMPATIBILITY profiles…

The Quick reference card for OPENGL ES 2.0 is here :  opengl-es-2_0-reference-card

You can also check this usefull link(s) :
http://en.wikibooks.org/wiki/GLSL_Programming/Vector_and_Matrix_Operations

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

314159265358979323846264338327950288
419716939937510582097494459230781640
628620899862803482534211706798214808

cat{ } { post_562 } { } 2009-2015 EIhIS Powered by WordPress