<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to GL Shapes</title><link>https://sourceforge.net/p/snowmix/wiki/GL%2520Shapes/</link><description>Recent changes to GL Shapes</description><atom:link href="https://sourceforge.net/p/snowmix/wiki/GL%20Shapes/feed" rel="self"/><language>en</language><lastBuildDate>Sun, 02 Aug 2015 23:13:40 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/snowmix/wiki/GL%20Shapes/feed" rel="self" type="application/rss+xml"/><item><title>GL Shapes modified by Peter Maersk-Moller</title><link>https://sourceforge.net/p/snowmix/wiki/GL%2520Shapes/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v12
+++ v13
@@ -1,5 +1,7 @@
 GL Shapes \(Snowmix-0.5.x)
 ===
+####This page has been obsoleted by the [Snowmix GL Shape Guide](http://snowmix.sourceforge.net/Documentation/guide-glshapes.html) on the [new Snowmix website](http://snowmix.sourceforge.net/).####
+

 Introduction
 ---
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Maersk-Moller</dc:creator><pubDate>Sun, 02 Aug 2015 23:13:40 -0000</pubDate><guid>https://sourceforge.netb66f74fecf8ddaa15c8ff1ed4487a366b384f128</guid></item><item><title>GL Shapes modified by Peter Maersk-Moller</title><link>https://sourceforge.net/p/snowmix/wiki/GL%2520Shapes/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v11
+++ v12
@@ -56,7 +56,7 @@
 ---
 Textures in Snowmix are images the shader can use as a surface on 2D and 3D objects. Snowmix supports 2D and Cube textures. The source of textures in Snowmix are images, video feed frames and the main mixer frame. Textures are used to move image data from CPU memory into the graphical context or GPU.

-**Defining a texture** To use a texture in Snowmix, a place holder within Snowmix has to be created. This is done using the command *glshape texture add*. Each texture place holder is identified by its unique texture Id, which is an integer number starting from 0. In the following example, 3 textures are created:
+**Defining a texture** To use a texture in Snowmix, a place holder within Snowmix has to be created. This is done using the command *glshape texture add*. Each texture place holder is identified by its unique texture Id, which is an integer number starting from 0. In the following example, 3 textures are created. First the place holders for the textures are created:

         glshape texture add 1 Texture for Mixer Frame
         glshape texture add 2 Texture for Video Feed #1
@@ -66,9 +66,9 @@

         glshape texture add [&amp;lt;texture id=""&amp;gt; [&amp;lt;texture name=""&amp;gt;]]

-The command *texture add* can not be added to a glshape command list although it is possible to workaround this limitation.
-
-A texture place holder is deleted using the command with the *texture id* argument, but without the name.
+The command *texture add* can not be added to a glshape command list although technically it is possible to workaround this limitation.
+
+A texture place holder is deleted using the command *glshape texture add* with only the *texture id* argument.

 **Setting the source for a texture** Before using a texture, the source of the texture must be defined. This is done using the command *glshape texture source*. In the example below, the source is set for the 3 texture place holder we just defined above:

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Maersk-Moller</dc:creator><pubDate>Sat, 18 Apr 2015 00:39:57 -0000</pubDate><guid>https://sourceforge.net4f8e881b520786ffd578b9243672b46d7de0a750</guid></item><item><title>GL Shapes modified by Peter Maersk-Moller</title><link>https://sourceforge.net/p/snowmix/wiki/GL%2520Shapes/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v10
+++ v11
@@ -60,7 +60,7 @@

         glshape texture add 1 Texture for Mixer Frame
         glshape texture add 2 Texture for Video Feed #1
-        glshape texture add 1 Texture for Loaded Image #5
+        glshape texture add 3 Texture for Loaded Image #5

 The syntax for the command is as follows:

@@ -136,6 +136,26 @@

 Finally the command list ends by disabling the feature TEXTURE_2D.

+The above defined shape can be listed using the command *gl list 1*:
+
+        gl list 1
+        STAT:  shape 1 ops 13 name This is a list of shape commands
+        STAT:  -  1 enable mode texture_2d
+        STAT:  -  2 texture bind id 3 min linear mag nearest type 2d : Texture 3 Texture for Loaded Image #5, image 5
+        STAT:  -  3 begin quads
+        STAT:  -  4  texcoord2 0.0000,0.0000
+        STAT:  -  5  vertex3 -0.5000,-0.5000,0.0000
+        STAT:  -  6  texcoord2 1.0000,0.0000
+        STAT:  -  7  vertex3 0.5000,-0.5000,0.0000
+        STAT:  -  8  texcoord2 1.0000,1.0000
+        STAT:  -  9  vertex3 0.5000,0.5000,0.0000
+        STAT:  - 10  texcoord2 0.0000,1.0000
+        STAT:  - 11  vertex3 -0.5000,0.5000,0.0000
+        STAT:  - 12 end
+        STAT:  - 13 disable mode texture_2d
+        STAT:   
+
+
 The above example can be rewritten into two shapes adding flexibility:

         1  glshape add This a Quad shape with texcoords
@@ -187,7 +207,7 @@
 ---
 Vertex Buffer Objects
 ---
-The OpenGL commands glBegin and glEnd are deprecated in OpenGL 3.1 while still supported in OpenGL 3.0. So far they are supported by Snowmix. Instead of glBegin/glEnd a [Vertex Buffer Objects](http://en.wikipedia.org/wiki/Vertex_Buffer_Object) or VBO for short must be used. The benefit of VBO over the older glBegin/glEnd method is that the data points for Vertex only has to be sent once to the GPU. Obviously the data points have to be sent again, if the Vertex is changing. An additional benefit of using a VBO over glBegin/glEnd can be reusing data points thus lowering the number of data points needed to be send from CPU to GPU.
+The OpenGL commands glBegin and glEnd are deprecated in OpenGL 3.0 though still supported. In OpenGL 3.1 the commands has been removed. For now the commands will stay in Snowmix. Instead of glBegin/glEnd a [Vertex Buffer Objects](http://en.wikipedia.org/wiki/Vertex_Buffer_Object) or VBO for short must be created and used. The benefit of VBO over the older glBegin/glEnd method is that the data points for Vertex only has to be sent to the GPU once and whenever they change if ever. An additional benefit of using a VBO over the glBegin/glEnd commands is that in a VBO the data points can be reused thus lowering the number of data points needed to be send from CPU to GPU. Reusing datapoints is possible when a VBO defines more than one polygon and at least two polygons share one or more datapoints.

 Previous a Quad Vertex with texture was defined using the glBegin/glEnd equivalent. Here the same quad is being defined as a VBO:

@@ -196,16 +216,22 @@
         glshape vbo data 5 0.0 0.0 -0.5 -0.5 0.0  1.0 0.0 0.5 -0.5 0.0  1.0 1.0 0.5 0.5 0.0  0.0 1.0  -0.5 0.5 0.0
         glshape vbo indices 5 0 1 2 3

-The first line adds/creates a VBO place holder with the id 5 and the name "Quad with texture".
-The second line sets up the VBO 1 as a *static* VBO as a [quad](https://www.opengl.org/wiki/Primitive) with the elements *t2* and *v3* meaning a 2-dimensional texture or glTexCoord on a 3-dimensional vertex or glVertex3. This means that each dataset in the VBO consist of 5 data points. The first two data points are the texture data points and the next 3 are the vertex data points.
-The third line defines for VBO 1 four datapoint sets.
-The fifth line defines defines how to use the datapoint sets using indexing. What is says is that when drawing/executing the VBO, the GPU should use the datasets in the order 0, 1, 2, 3. In this case, there is no benefit using indexing as there is only defined one quad, but if the dataset had two more datasets 4 and 5 identifying another quad using the dataset 1 and 2 as the two other parts of the quad, then the command would be:
-
-        glshape vbo indices 5 0 1 2 3   1 4 5 2
-
-This way two quads with a common side are described using only 6 data points and not 8. Admittedly, the savings are not great, but when drawing more complicated structures with many smaller adjacent slices to imitating and arc or alike, savings rises.
-
-In a glshape a defined VBO can be referenced as shown in the following reusing the example in GL texture part:
+The first line adds/creates a VBO place holder with the vbo_id 5 and the name "Quad with texture".
+
+The second line sets up the VBO 5 as a *static* VBO containing [quad](https://www.opengl.org/wiki/Primitive) polygon or polygns with the elements *t2* and *v3* meaning a 2-dimensional texture \( glTexCoord) on a 3-dimensional vertex \(glVertex3). This means that each dataset in the VBO consist of 5 data points. The first two datapoints are the texture datapoints and the next 3 are the vertex datapoints.
+
+The third line defines for VBO 5 four datapoint sets.
+
+The fifth line defines defines how the VBO should use the datapoint sets by defining an indexing. What is says is that when drawing/executing the VBO, the GPU should use the datasets in the order 0, 1, 2, 3. In this case, there is no benefit using indexing as there is only defined one quad. However if we add a second plane into the z-plane that share the right side of the first quad, we can add extra index points:
+
+    glshape vbo data 5 0.0 0.0 0.5 -0.5 1.0  0.0 1.0 0.5 0.5 1.0
+    glshape vbo indices 5 1 4 5 2
+
+Now when the VBO is used, two four-sided polygons sharing two points are drawn. First the datasets 0,1,2,3 are used for the first quad and then the datasets 1,4,5,2 are used for the second polygon. In this case we saved 2 data sets at the expense of extra index information. The benefit will increase with the number of adjacent polygons sharing datapoints.
+
+
+
+In a glshape a defined VBO can be referenced as shown in the following reusing the example in GL texture section \(see the GL Texture section):

         13 glshape add 2 This is a glshape including another shape
         14 glshape enable 2 texture_2d           # Enable 2D textures.
@@ -213,14 +239,16 @@
         16 glshape vbo 2 5                       # include VBO 5
         17 glshape disable 2 texture_2d          # Disabling the 2D Texture feature

-The first time glshape 2 is overlayed, it will reference VBO 5. If this is the first time, VBO's data points will be sent to the GPU. In future references when overlaying a glshape containing VBO 5, less data is needed to be sent to the GPU.
+The first time glshape 2 is overlayed, it will reference VBO 5. If this is the first time the VBO is referenced, the VBO's datapoints will be sent to the GPU. In future references when overlaying a glshape containing VBO 5, fewer OpenGL calls are needed and less data has to be sent from CPU to GPU.

 ---
 Vertex Array Objects
 ---

-VBOs in Snowmix are automatically wrapped in a Vertex Array Object or VAO so when overlaying a glshape Snowmix containing a VBO, all Snowmix has to do is binding the VAO containing the VBO. However the first time the VBO is referenced in a placed glshape, the VBO is first defined for the VAO sending the VBO info is sent to the GPU. It all happens automatically. Adding a functionality to combine several VBOs in one VAO is under consideration.
+VBOs in Snowmix are automatically wrapped in a Vertex Array Object or VAO so when overlaying a glshape Snowmix containing a VBO, all Snowmix has to do is binding the VAO containing the VBO. However the first time the VBO is referenced in a placed glshape, the VBO is first defined for the VAO sending the VBO data is sent to the GPU. It all happens automatically and is done with only a couple of OpenGL calls minimizing CPU load significantly.
+
+Adding a functionality to combine several VBOs in one VAO is under consideration.

 ---
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Maersk-Moller</dc:creator><pubDate>Fri, 27 Mar 2015 10:01:10 -0000</pubDate><guid>https://sourceforge.net7522b0e5eb8f8daf8b5a57f303e1b9ae2743207b</guid></item><item><title>GL Shapes modified by Peter Maersk-Moller</title><link>https://sourceforge.net/p/snowmix/wiki/GL%2520Shapes/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v9
+++ v10
@@ -187,6 +187,40 @@
 ---
 Vertex Buffer Objects
 ---
+The OpenGL commands glBegin and glEnd are deprecated in OpenGL 3.1 while still supported in OpenGL 3.0. So far they are supported by Snowmix. Instead of glBegin/glEnd a [Vertex Buffer Objects](http://en.wikipedia.org/wiki/Vertex_Buffer_Object) or VBO for short must be used. The benefit of VBO over the older glBegin/glEnd method is that the data points for Vertex only has to be sent once to the GPU. Obviously the data points have to be sent again, if the Vertex is changing. An additional benefit of using a VBO over glBegin/glEnd can be reusing data points thus lowering the number of data points needed to be send from CPU to GPU.
+
+Previous a Quad Vertex with texture was defined using the glBegin/glEnd equivalent. Here the same quad is being defined as a VBO:
+
+        glshape vbo add 5 Quad with texture
+        glshape vbo config 5 static quads t2 v3
+        glshape vbo data 5 0.0 0.0 -0.5 -0.5 0.0  1.0 0.0 0.5 -0.5 0.0  1.0 1.0 0.5 0.5 0.0  0.0 1.0  -0.5 0.5 0.0
+        glshape vbo indices 5 0 1 2 3
+
+The first line adds/creates a VBO place holder with the id 5 and the name "Quad with texture".
+The second line sets up the VBO 1 as a *static* VBO as a [quad](https://www.opengl.org/wiki/Primitive) with the elements *t2* and *v3* meaning a 2-dimensional texture or glTexCoord on a 3-dimensional vertex or glVertex3. This means that each dataset in the VBO consist of 5 data points. The first two data points are the texture data points and the next 3 are the vertex data points.
+The third line defines for VBO 1 four datapoint sets.
+The fifth line defines defines how to use the datapoint sets using indexing. What is says is that when drawing/executing the VBO, the GPU should use the datasets in the order 0, 1, 2, 3. In this case, there is no benefit using indexing as there is only defined one quad, but if the dataset had two more datasets 4 and 5 identifying another quad using the dataset 1 and 2 as the two other parts of the quad, then the command would be:
+
+        glshape vbo indices 5 0 1 2 3   1 4 5 2
+
+This way two quads with a common side are described using only 6 data points and not 8. Admittedly, the savings are not great, but when drawing more complicated structures with many smaller adjacent slices to imitating and arc or alike, savings rises.
+
+In a glshape a defined VBO can be referenced as shown in the following reusing the example in GL texture part:
+
+        13 glshape add 2 This is a glshape including another shape
+        14 glshape enable 2 texture_2d           # Enable 2D textures.
+        15 glshape texture bind 2 3 linear nearest  # Bind texture 3 as current texture
+        16 glshape vbo 2 5                       # include VBO 5
+        17 glshape disable 2 texture_2d          # Disabling the 2D Texture feature
+
+The first time glshape 2 is overlayed, it will reference VBO 5. If this is the first time, VBO's data points will be sent to the GPU. In future references when overlaying a glshape containing VBO 5, less data is needed to be sent to the GPU.
+
+
+---
+Vertex Array Objects
+---
+
+VBOs in Snowmix are automatically wrapped in a Vertex Array Object or VAO so when overlaying a glshape Snowmix containing a VBO, all Snowmix has to do is binding the VAO containing the VBO. However the first time the VBO is referenced in a placed glshape, the VBO is first defined for the VAO sending the VBO info is sent to the GPU. It all happens automatically. Adding a functionality to combine several VBOs in one VAO is under consideration.

 ---
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Maersk-Moller</dc:creator><pubDate>Thu, 26 Mar 2015 17:08:33 -0000</pubDate><guid>https://sourceforge.net823568577487c457ee153d5f247eebb24c59a447</guid></item><item><title>GL Shapes modified by Peter Maersk-Moller</title><link>https://sourceforge.net/p/snowmix/wiki/GL%2520Shapes/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v8
+++ v9
@@ -42,7 +42,7 @@

 The command *glshape modify* can be used to change numbers and setting of some commands in a glshape command list.

-If the glshape 1 later is executed, that is if the glshape is placed and overlayed, the following OpenGL C/C++ commands are excuted in whatever context is active at that moment:
+If the glshape 1 is later executed, that is if the glshape is placed and overlayed, the following OpenGL C/C++ commands are excuted in whatever context is active at that moment:

  - [glLoadIdentity\();](https://www.opengl.org/sdk/docs/man2/xhtml/glLoadIdentity.xml)
  - [glMatrixMode\(GL_PROJECTION);](https://www.opengl.org/sdk/docs/man2/xhtml/glMatrixMode.xml)
@@ -106,7 +106,7 @@
         2  glshape enable 1 texture_2d           # Enable 2D textures.
         3  glshape texture bind 1 3 linear nearest  # Bind texture 3 as current texture
         4  glshape begin 1 quads                 # Begin a 4 point polygon
-        5  #glshape normal 1 0 0 1               # Setting the normal for the quad
+        5    #glshape normal 1 0 0 1               # Setting the normal for the quad
         6    glshape texcoord 1 0 0              # Using current texture lower left
         7    glshape vertex 1 -0.5 -0.5 0        # Setting Lower left corner
         8    glshape texcoord 1 1 0              # Using current texture lower right
@@ -136,6 +136,30 @@

 Finally the command list ends by disabling the feature TEXTURE_2D.

+The above example can be rewritten into two shapes adding flexibility:
+
+        1  glshape add This a Quad shape with texcoords
+        2  glshape begin 1 quads                 # Begin a 4 point polygon
+        3    #glshape normal 1 0 0 1             # Setting the normal for the quad
+        4    glshape texcoord 1 0 0              # Using current texture lower left
+        5    glshape vertex 1 -0.5 -0.5 0        # Setting Lower left corner
+        6    glshape texcoord 1 1 0              # Using current texture lower right
+        7    glshape vertex 1 0.5 -0.5 0         # Setting Lower right corner
+        8    glshape texcoord 1 1 1              # Using current texture upper right
+        9    glshape vertex 1 0.5 0.5 0          # Setting Upper right corner
+        10   glshape texcoord 1 0 1              # Using current texture upper left
+        11   glshape vertex 1 -0.5 0.5 0         # Setting Upper left corner
+        12 glshape end 1                         # Ends the definition of the quad polygon
+
+        13 glshape add 2 This is a glshape including another shape
+        14 glshape enable 2 texture_2d           # Enable 2D textures.
+        15 glshape texture bind 2 3 linear nearest  # Bind texture 3 as current texture
+        16 glshape inshape 2 1                   # include glshape 1
+        17 glshape disable 2 texture_2d          # Disabling the 2D Texture feature
+
+The benefit is that it is quite easy to change the glshape included in line 16 to another glshape with another outline or otherwise other settings.
+
+

 ---
 GL Vectors
@@ -161,6 +185,11 @@

 ---
+Vertex Buffer Objects
+---
+
+
+---
 Placed GL Shapes
 ---

@@ -175,6 +204,7 @@
 ---

  - [OpenGL Tutorial](http://www.videotutorialsrock.com/index.php) with video and examples.
+ - [OpenGL Tutorial](http://www.opengl-tutorial.org/).
  - [OpenGL.org](https://www.opengl.org/).
  - [OpenGL at Khronos](https://www.khronos.org/opengl/).
  - [Learning Modern 3D Graphics Programming](http://www.arcsynthesis.org/gltut/index.html)
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Maersk-Moller</dc:creator><pubDate>Fri, 20 Mar 2015 20:45:44 -0000</pubDate><guid>https://sourceforge.netb01ffccbb223aed11dbf53b9f4885ebf1f7f560a</guid></item><item><title>GL Shapes modified by Peter Maersk-Moller</title><link>https://sourceforge.net/p/snowmix/wiki/GL%2520Shapes/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v7
+++ v8
@@ -138,7 +138,21 @@

 ---
-GL Lights
+GL Vectors
+---
+
+In Snowmix Vector constants can be created \(and changed) using the commands *glshape vector add* and glshape *vector value*. The evctors can have 2, 3 and 4 dimensions. Internally the vectors are saved as either integers, floats or doubles depending on the settings for compiling Snowmix. The vectors are needed when defining light and materials. The syntax for the two vector commands are:
+
+        glshape vector add [&amp;lt;vector id=""&amp;gt; [&amp;lt;vector name=""&amp;gt;]]
+        glshape vector value [&amp;lt;vector id=""&amp;gt; &amp;lt;x&amp;gt; &amp;lt;y&amp;gt; [&amp;lt;z&amp;gt; &amp;lt;w&amp;gt;]]]
+
+Both the add and the value commands when used without argument, will listed created vectors name and values respectively. If the add command is used with the vector id argument, but no name is given, the vector with that id will be deleted. The maximum number of vectors Snowmix can have, is currently fixed and set in the file src/opengl_video.h.
+
+The GL vectors have no direct equivalent in OpenGL, but several OpenGL commands are taking an array of values as arguments, which is what we are doing in Snowmix too.
+
+
+---
+GL Lights and materials
 ---

 **Defining light constants**
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Maersk-Moller</dc:creator><pubDate>Sun, 15 Mar 2015 15:47:04 -0000</pubDate><guid>https://sourceforge.neta029f77eb544763b6d0629ac6643ba35b9011063</guid></item><item><title>GL Shapes modified by Peter Maersk-Moller</title><link>https://sourceforge.net/p/snowmix/wiki/GL%2520Shapes/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v6
+++ v7
@@ -18,11 +18,11 @@

         glshape add 1 My first glshape

-Here the glshape place holder 1 is defined and given the name 'My first glshape'. After the glshape is created, it can now be added commands to its list. The commands are primarily OpenGL primtives with only a few exceptions. The commands all have the form:
+Here the glshape place holder 1 is defined and given the name 'My first glshape'. After the glshape has been created, it can now be added commands to its list. The commands are primarily OpenGL primtives with only a few exceptions. The commands all have the form:

         glshape COMMAND_NAME &amp;lt;shape id=""&amp;gt; ......

-Such commands will add the command to end of the glshape command list identified by the *shape id*. Below is an example:
+Such commands will add the command to end of the glshape command list identified by the *shape id*. It is important to understand that commands added to a glshape are parsed and added to a glshape command list, but they are not executed at that moment. For the commands in a glshapes command list to be executed, a glshape has to be placed **and** overlayed. Below is an example of creating a glshape command list with commands:

         glshape add 1 My first glshape
         glshape loadidentity 1
@@ -36,9 +36,13 @@
         STAT:  -  1 loadidentity
         STAT:  -  2 matrixmode projection 
         STAT:  -  3 enable mode blend  
-        STAT: 
+        STAT:

-If the glshape 1 later is executed, the following OpenGL C/C++ commands are excuted in whatever context is active at that moment:
+The command *glshape entry* can be used to move commands within a glshape command list as well as used for deleting a specific command in a glshape command list.
+
+The command *glshape modify* can be used to change numbers and setting of some commands in a glshape command list.
+
+If the glshape 1 later is executed, that is if the glshape is placed and overlayed, the following OpenGL C/C++ commands are excuted in whatever context is active at that moment:

  - [glLoadIdentity\();](https://www.opengl.org/sdk/docs/man2/xhtml/glLoadIdentity.xml)
  - [glMatrixMode\(GL_PROJECTION);](https://www.opengl.org/sdk/docs/man2/xhtml/glMatrixMode.xml)
@@ -83,53 +87,52 @@
 There is no OpenGL equivalent to the commands. The command *texture source* can not be added to a glshape command list although it is possible to workaround this limitation.

-**Binding a texture** The actual moving of image data from CPU to the context or GPU is not taking place until a texture is bound. This is done using the command *glshape texture bind*. The command needs to part of a glshape list of commands and be used as a glshape when overlaying glshapes. When a glshape is executed and it reaches the *texture bind* command, it will allocate a an internal texture in the context or GPU. Such a ressource is limited by the amount of RAM available for the context/GPU. When an internal texture is generated, the texture is loaded the data from the source. The context allocation is equivalent to the glTexture() command;
+**Binding a texture** The actual moving of image data from CPU to the context or GPU is not taking place until a texture is bound. This is done using the command *glshape texture bind*. The command needs to part of a glshape command list and that glshape has to be placed and overlayed. Below is shown the full syntax for the *glshape texture bind* command:

-The following example glshape 1 is set to create a texture, source it, bind it and use it on a four sided polygon, a quad. This glshape can then later be placed and overlayed. When a placed glshape is overlayed, its command list is executed line by line.
+    glshape texture bind &amp;lt;glshape id=""&amp;gt; &amp;lt;texture id=""&amp;gt; [&amp;lt;min&amp;gt; &amp;lt;mag&amp;gt;] [2d | cube]

-        glshape add 1 This is a list of shape commands
-        glshape enable 1 texture_2d           # Enable 2D textures.
-        glshape texture bind 1 3              # Bind texture 3 as current texture
-        glshape texfilter2d 1 nearest nearest # Set filter method
-        glshape begin 1 quads                 # Begin a 4 point polygon
-          #glshape normal 1 0 0 1             # Setting the normal for the quad
-          glshape texcoord 1 0 0              # Using current texture lower left
-          glshape vertex 1 -0.5 -0.5 0        # Setting Lower left corner
-          glshape texcoord 1 1 0              # Using current texture lower right
-          glshape vertex 1 0.5 -0.5 0         # Setting Lower right corner
-          glshape texcoord 1 1 1              # Using current texture upper right
-          glshape vertex 1 0.5 0.5 0          # Setting Upper right corner
-          glshape texcoord 1 0 1              # Using current texture upper left
-          glshape vertex 1 -0.5 0.5 0         # Setting Upper left corner
-        glshape end 1                         # Ends the definition of the quad polygon
-        glshape disable 1 texture_2d          # Disabling the 2D Texture feature
+
+When a glshape is executed and it reaches the *texture bind* command, it will allocate a an internal texture in the context or GPU. Such a ressource is limited by the amount of RAM available for the context/GPU. After an internal texture has been generated, the image data is loaded to the texture in the context or GPU. The texture bind allocation is equivalent to the the following OpenGl commands:
+
+ - [glGenTexture\();](https://www.khronos.org/opengles/sdk/docs/man/xhtml/glGenTextures.xml)
+ - [glBindTexture\();](https://www.khronos.org/opengles/sdk/docs/man/xhtml/glBindTexture.xml)
+ - [glTexImage2D\();](https://www.khronos.org/opengles/sdk/docs/man/xhtml/glTexImage2D.xml) or [gluBuild2DMipmaps\(GL_TEXTURE_2D...);](https://www.opengl.org/sdk/docs/man2/xhtml/gluBuild2DMipmaps.xml)
+ - [glTexParameter\(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min);](https://www.khronos.org/opengles/sdk/docs/man/xhtml/glTexParameter.xml)
+ - [glTexParameter\(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag);](https://www.khronos.org/opengles/sdk/docs/man/xhtml/glTexParameter.xml)
+
+In the following example glshape 1 is set to create a texture, source it, bind it and use it on a four sided polygon, a quad. This glshape can then later be placed and overlayed. When a placed glshape is overlayed, its command list is executed line by line.
+
+        1  glshape add 1 This is a list of shape commands
+        2  glshape enable 1 texture_2d           # Enable 2D textures.
+        3  glshape texture bind 1 3 linear nearest  # Bind texture 3 as current texture
+        4  glshape begin 1 quads                 # Begin a 4 point polygon
+        5  #glshape normal 1 0 0 1               # Setting the normal for the quad
+        6    glshape texcoord 1 0 0              # Using current texture lower left
+        7    glshape vertex 1 -0.5 -0.5 0        # Setting Lower left corner
+        8    glshape texcoord 1 1 0              # Using current texture lower right
+        9    glshape vertex 1 0.5 -0.5 0         # Setting Lower right corner
+        10   glshape texcoord 1 1 1              # Using current texture upper right
+        11   glshape vertex 1 0.5 0.5 0          # Setting Upper right corner
+        12   glshape texcoord 1 0 1              # Using current texture upper left
+        13   glshape vertex 1 -0.5 0.5 0         # Setting Upper left corner
+        14 glshape end 1                         # Ends the definition of the quad polygon
+        15 glshape disable 1 texture_2d          # Disabling the 2D Texture feature

 The first line defines a glshape place holder with the Id 1 and the name 'This is a list of shape commands'.

 The second line enables the OpenGL feature TEXTURE_2D using [glEnable\(GL_TEXTURE_2D);](https://www.opengl.org/sdk/docs/man2/xhtml/glEnable.xml).

-The third line defines texture 3 to be bound as the current texture. When the shape list is executed, this is the line that will initiate image data to e send from the CPU memory to the context or GPU. The *texture bind* command is equivalent to executing the following OpenGL commands:
+The third line defines texture 3 to be bound as the current texture. When the shape list is executed, this is the line that will initiate image data to e send from the CPU memory to the context or GPU. See above for the relation between the *texture bind* command and OpenGL commands.

- - [glGenTextures\(1, &amp;amp;textureId);](https://www.khronos.org/opengles/sdk/docs/man/xhtml/glGenTextures.xml) // Generate a texture in the GPU
- - [glBindTexture\(GL_TEXTURE_2D, textureId);](https://www.khronos.org/opengles/sdk/docs/man/xhtml/glBindTexture.xml)  //Tell OpenGL which texture to edit
- - [glTexImage2D\(GL_TEXTURE_2D,...);](https://www.khronos.org/opengles/sdk/docs/man/xhtml/glTexImage2D.xml)     //Map the image to the texture
+In the 4th line a definition of a *quad* polygons is defined. In this case we only define one, but it could contain definition of more than one. A valid *begin* definition must later end with an *end* definition. The command is equivalent to the OpenGL command [glBegin\(GL_QUADS)](https://www.opengl.org/sdk/docs/man2/xhtml/glBegin.xml).

-For the last command we use the source defined earlier.
-        
-The fourth line defines the filter method for using the texture with the image is to be 'nearest' and 'nearest' for near and mag filter. The OpenGL equivalent is the following:
-
- - [glTexParameteri\(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);](https://www.khronos.org/opengles/sdk/docs/man/xhtml/glTexParameter.xml)
- - [glTexParameteri\(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);](https://www.khronos.org/opengles/sdk/docs/man/xhtml/glTexParameter.xml)
-
-In the 5th line a definition of a *quad* polygons is defined. In this case we only define one, but it could contain definition of more than one. A valid *begin* definition must later end with an *end* definition. The command is equivalent to the OpenGL command [glBegin\(GL_QUADS)](https://www.opengl.org/sdk/docs/man2/xhtml/glBegin.xml).
-
-The 6th line is defining the normal of the quad defined. The normal is a vector usually perpendicular to plane of the quad. In this case, the normal definition is commented out. The command is equivalent to the OpenGL command [glNormal\(x,y,z)](https://www.opengl.org/sdk/docs/man2/xhtml/glNormal.xml).
+The 5th line is defining the normal of the quad defined. The normal is a vector usually perpendicular to plane of the quad. In this case, the normal definition is commented out. The command is equivalent to the OpenGL command [glNormal\(x,y,z)](https://www.opengl.org/sdk/docs/man2/xhtml/glNormal.xml).

  The next four *vertex* commands defines the four 3D \(x,y,z) coordinates of the quad. Note that the points are defined counter clockwise. The commands are equivalent to [glVertex\(x,y,..)](https://www.opengl.org/sdk/docs/man2/xhtml/glVertex.xml).

 Before each *vertex* command is a *texcoord* command defining how the texture is intended to be merged onto the quad. Each *texcoord* commands takes a set of 2d coordinates *s* and *r*, where s=0 means the left side of the image and r=0 means the bottom of the image. These values are fraction of the image and must be between 0 and 1. The OpenGL equivalent is [glTexCoord\(s,r,..)](https://www.opengl.org/sdk/docs/man2/xhtml/glTexCoord.xml).

-In the 15th line we have the corresponding *end* command to the previous *begin* command. The OpenGL equivalent is [glEnd\()](https://www.opengl.org/sdk/docs/man2/xhtml/glBegin.xml).
+In the 14th line we have the corresponding *end* command to the previous *begin* command. The OpenGL equivalent is [glEnd\()](https://www.opengl.org/sdk/docs/man2/xhtml/glBegin.xml).

 Finally the command list ends by disabling the feature TEXTURE_2D.

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Maersk-Moller</dc:creator><pubDate>Sun, 15 Mar 2015 04:11:53 -0000</pubDate><guid>https://sourceforge.net42b000dd67a98d057a38941da10a8a94eecc3ff1</guid></item><item><title>GL Shapes modified by Peter Maersk-Moller</title><link>https://sourceforge.net/p/snowmix/wiki/GL%2520Shapes/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v5
+++ v6
@@ -151,3 +151,15 @@
 ---
 Copying back from Graphic Adapter.
 ---
+
+
+---
+OpenGL Ressources
+---
+
+ - [OpenGL Tutorial](http://www.videotutorialsrock.com/index.php) with video and examples.
+ - [OpenGL.org](https://www.opengl.org/).
+ - [OpenGL at Khronos](https://www.khronos.org/opengl/).
+ - [Learning Modern 3D Graphics Programming](http://www.arcsynthesis.org/gltut/index.html)
+ - [OpenGL® on Silicon Graphics® Systems](http://www.polarhome.com:823/doc/library/SGI_bookshelves/SGI_Developer/books/OpenGLonSGI/sgi_html/index.html)
+
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Maersk-Moller</dc:creator><pubDate>Fri, 13 Mar 2015 22:09:33 -0000</pubDate><guid>https://sourceforge.netff0c3c2e530d9b96094f0f51229259de10ddce24</guid></item><item><title>GL Shapes modified by Peter Maersk-Moller</title><link>https://sourceforge.net/p/snowmix/wiki/GL%2520Shapes/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v4
+++ v5
@@ -85,7 +85,7 @@

 **Binding a texture** The actual moving of image data from CPU to the context or GPU is not taking place until a texture is bound. This is done using the command *glshape texture bind*. The command needs to part of a glshape list of commands and be used as a glshape when overlaying glshapes. When a glshape is executed and it reaches the *texture bind* command, it will allocate a an internal texture in the context or GPU. Such a ressource is limited by the amount of RAM available for the context/GPU. When an internal texture is generated, the texture is loaded the data from the source. The context allocation is equivalent to the glTexture() command;

-The following example defines glshape 1 to do this:
+The following example glshape 1 is set to create a texture, source it, bind it and use it on a four sided polygon, a quad. This glshape can then later be placed and overlayed. When a placed glshape is overlayed, its command list is executed line by line.

         glshape add 1 This is a list of shape commands
         glshape enable 1 texture_2d           # Enable 2D textures.
@@ -143,6 +143,10 @@
 **Light commands**

+---
+Placed GL Shapes
+---
+

 ---
 Copying back from Graphic Adapter.
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Maersk-Moller</dc:creator><pubDate>Fri, 13 Mar 2015 21:39:25 -0000</pubDate><guid>https://sourceforge.net15f84fb93fdd19f77e06cf74294dd9fd7136d942</guid></item><item><title>GL Shapes modified by Peter Maersk-Moller</title><link>https://sourceforge.net/p/snowmix/wiki/GL%2520Shapes/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v3
+++ v4
@@ -8,7 +8,7 @@
 ---
 GL Context
 ---
-The GL Context is an OpenGL context within Snowmix enabling OpenGL graphics. Snowmix supports the Off Screen Mesa \([OSMesa](http://www.mesa3d.org/osmesa.html)) and the GLX/X-Windows ([GLX](http://en.wikipedia.org/wiki/GLX)) context. The [OSMesa](http://www.mesa3d.org/osmesa.html) context is CPU based. The GLX context is [GPU based](http://en.wikipedia.org/wiki/Graphics_processing_unit) and requires a local graphic adapter supporting OpenGL. Further more the local machine has to support and run [X-Windows](http://en.wikipedia.org/wiki/X_Window_System) as well as allowing Snowmix to open a window within its X-Window session.
+The GL Context is an OpenGL context within Snowmix enabling OpenGL graphics. Snowmix supports the Off Screen Mesa \([OSMesa](http://www.mesa3d.org/osmesa.html)) and the GLX/X-Windows ([GLX](http://en.wikipedia.org/wiki/GLX)) context. The [OSMesa](http://www.mesa3d.org/osmesa.html) context is CPU based. The GLX context is [GPU based](http://en.wikipedia.org/wiki/Graphics_processing_unit) and requires a local graphic adapter supporting OpenGL. Further more the local machine has to support and run [X-Windows](http://en.wikipedia.org/wiki/X_Window_System) as well as allowing Snowmix to open a window within its X-Window session. Using a GPU can offer great performance, not only because a GPU can have a very high performance executing otherwise complicated heavy load CPU tasks, but also because it can do so in parallel with the CPU perhaps doing other tasks. However it comes at a cost of not only complexicity and the cost of learning a new skill being OpenGL programming, but it also usually require transferring large amount of data from CPU memory to GPU and back again. While the transfer to the GPU is DMA and queue based, transferring from GPU to CPU memory is currently CPU intensive.

 ---
@@ -28,6 +28,15 @@
         glshape loadidentity 1
         glshape matrixmode 1 projection
         glshape enable 1 blend
+
+The glshape command list can be inspected using the command *glshape list &amp;lt;glshape id&amp;gt;* as shown below:
+
+        gl list 1
+        STAT:  shape 1 ops 3 name My first glshape
+        STAT:  -  1 loadidentity
+        STAT:  -  2 matrixmode projection 
+        STAT:  -  3 enable mode blend  
+        STAT: 

 If the glshape 1 later is executed, the following OpenGL C/C++ commands are excuted in whatever context is active at that moment:

@@ -136,10 +145,5 @@

 ---
-GL Shape Macros
----
-
-
----
 Copying back from Graphic Adapter.
 ---
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Maersk-Moller</dc:creator><pubDate>Fri, 13 Mar 2015 21:33:14 -0000</pubDate><guid>https://sourceforge.net9db7d806db9fd8f1c813c55181c8af61cc196f9c</guid></item></channel></rss>