[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: pcb.git: branch: master updated (600676f9b5a293724c5499e9e276e8678a438bd6)
The branch, master has been updated
via 600676f9b5a293724c5499e9e276e8678a438bd6 (commit)
from 81c9e2b71b621cebc070624e84397eef4af1598f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
=========
Summary
=========
src/hid/gtk/gtkhid-gl.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
=================
Commit Messages
=================
commit 600676f9b5a293724c5499e9e276e8678a438bd6
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
GTK/GL: Sub-composite objects on each layer using the stencil buffer
This avoids the highlight where translucent objects on a given layer
are drawn over each other. It enables us to have a translucent silk
screen layer and still be able to read the text.
:100644 100644 910fd2d... a7278df... M src/hid/gtk/gtkhid-gl.c
=========
Changes
=========
commit 600676f9b5a293724c5499e9e276e8678a438bd6
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
GTK/GL: Sub-composite objects on each layer using the stencil buffer
This avoids the highlight where translucent objects on a given layer
are drawn over each other. It enables us to have a translucent silk
screen layer and still be able to read the text.
diff --git a/src/hid/gtk/gtkhid-gl.c b/src/hid/gtk/gtkhid-gl.c
index 910fd2d..a7278df 100644
--- a/src/hid/gtk/gtkhid-gl.c
+++ b/src/hid/gtk/gtkhid-gl.c
@@ -44,6 +44,7 @@ typedef struct render_priv {
GdkGLConfig *glconfig;
bool trans_lines;
bool in_context;
+ int subcomposite_stencil_bit;
} render_priv;
@@ -64,6 +65,7 @@ int
ghid_set_layer (const char *name, int group, int empty)
{
render_priv *priv = gport->render_priv;
+ int stencil_bit;
int idx = group;
if (idx >= 0 && idx < max_group)
{
@@ -78,6 +80,18 @@ ghid_set_layer (const char *name, int group, int empty)
idx = PCB->LayerGroups.Entries[group][idx];
}
+ /* Flush out any existing geoemtry to be rendered */
+ hidgl_flush_triangles (&buffer);
+
+ glEnable (GL_STENCIL_TEST); /* Enable Stencil test */
+ glStencilOp (GL_KEEP, GL_KEEP, GL_REPLACE); /* Stencil pass => replace stencil value (with 1) */
+
+ hidgl_return_stencil_bit (priv->subcomposite_stencil_bit); /* Relinquish any bitplane we previously used */
+ stencil_bit = hidgl_assign_clear_stencil_bit(); /* Get a new (clean) bitplane to stencil with */
+ glStencilFunc (GL_GREATER, stencil_bit, stencil_bit); /* Pass stencil test if our assigned bit is clear */
+ glStencilMask (stencil_bit); /* Only write to our subcompositing stencil bitplane */
+ priv->subcomposite_stencil_bit = stencil_bit;
+
if (idx >= 0 && idx < max_copper_layer + 2)
{
priv->trans_lines = true;
@@ -112,6 +126,23 @@ ghid_set_layer (const char *name, int group, int empty)
return 0;
}
+static void
+ghid_end_layer (void)
+{
+ render_priv *priv = gport->render_priv;
+
+ /* Flush out any existing geoemtry to be rendered */
+ hidgl_flush_triangles (&buffer);
+
+ /* Relinquish any bitplane we previously used */
+ hidgl_return_stencil_bit (priv->subcomposite_stencil_bit);
+ priv->subcomposite_stencil_bit = 0;
+
+ /* Always pass stencil test */
+ glStencilMask (0);
+ glStencilFunc (GL_ALWAYS, 0, 0);
+}
+
void
ghid_destroy_gc (hidGC gc)
{
@@ -751,6 +782,9 @@ ghid_init_renderer (int *argc, char ***argv, GHidPort *port)
printf ("Could not setup GL-context!\n");
return; /* Should we abort? */
}
+
+ /* Setup HID function pointers specific to the GL renderer*/
+ ghid_hid.end_layer = ghid_end_layer;
}
void
@@ -1169,6 +1203,9 @@ ghid_request_debug_draw (void)
hidgl_init_triangle_array (&buffer);
ghid_invalidate_current_gc ();
+ /* Setup stenciling */
+ glDisable (GL_STENCIL_TEST);
+
glPushMatrix ();
glScalef ((ghid_flip_x ? -1. : 1.) / port->zoom,
(ghid_flip_y ? -1. : 1.) / port->zoom,
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs