EihiS

October 8, 2014

RPI : openGL ES 2.0 functions in C

Filed under: Uncategorized — Tags: , , , , , , , — admin @ 9:11 am

This post will be updated when i have enough time.
// list GL capabilities & Extensions

void show_GLcapabilities(void)
{
	//
      printf("GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
      printf("GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
      printf("GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
      printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
	//
}
// list GLES parameters
void show_GLparameters(void)
{
	GLint myget[256];
	glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT,&myget);printf("GL_IMPLEMENTATION_COLOR_READ_FORMAT=%04x %04x %04x %d \n",myget[0],myget[1],myget[2],myget[3]);
	glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE,&myget);printf("GL_IMPLEMENTATION_COLOR_READ_TYPE=%04x %04x %04x %d \n",myget[0],myget[1],myget[2],myget[3]);
	glGetIntegerv(GL_COLOR_WRITEMASK,&myget);printf("GL_COLOR_WRITE_MASK=%d %d %d %d \n",myget[0],myget[1],myget[2],myget[3]);
	glGetIntegerv(GL_BLEND,&myget);printf("GL_BLEND =%d\n",myget[0]);
	glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE,&myget);printf("GL_MAX_RENDER_BUFFER_SIZE =%d\n",myget[0]);
	glGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS,&myget);printf("GL_MAX_VERTEX_UNIFORM_VECTORS =%d\n",myget[0]);
	glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS,&myget);printf("GL_MAX_FRAGMENT_UNIFORM_VECTORS =%d\n",myget[0]);
	glGetIntegerv(GL_MAX_VERTEX_ATTRIBS,&myget);printf("GL_MAX_VERTEX_ATTRIBS =%d\n",myget[0]);
	//
	glGetIntegerv(GL_MAX_VIEWPORT_DIMS,&myget);printf("GL_MAX_VIEWPORT_DIMS =%dx%d\n",myget[0],myget[1]);
	glGetIntegerv(GL_VIEWPORT,&myget);printf("GL_VIEWPORT =(%d,%d %d,%d)\n",myget[0],myget[1],myget[2],myget[3]);

}
//
// Videocore debugging
in /opt/vc/bin :
sudo vcdbg help
see : https://github.com/nezticle/RaspberryPi-BuildRoot/wiki/VideoCore-Tools
314159265358979323846264338327950288
419716939937510582097494459230781640
628620899862803482534211706798214808

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

314159265358979323846264338327950288
419716939937510582097494459230781640
628620899862803482534211706798214808

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