GLES2

Check-in [d0c312bca6]
Login

Check-in [d0c312bca6]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:fixes for 3D displaying of borders
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d0c312bca64b102501875172234596fb5c8821b6
User & Date: arnulf 2013-08-31 11:11:23.924
Context
2013-08-31
22:32
removed Draw*Border functions with sub functions, now implemented in Tcl. check-in: ef2f9791d8 user: arnulf tags: trunk
11:11
fixes for 3D displaying of borders check-in: d0c312bca6 user: arnulf tags: trunk
2013-08-30
21:09
fixes for doing real 3D borders for buttons check-in: d76bff8039 user: arnulf tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to generic/gles2Builtin.c.
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
}

void VerticalBevel(Tcl_Interp *interp, int x, int y, int z, int width, int height, int depth, int leftBevel, char *relief, shadowColors shadow_colors, int side) {
    Tcl_Obj *obj;
    Tcl_Obj *cmd_obj;
    Tcl_Obj *cmd_objv[1];

fprintf(stderr, "VerticalBevel!x!%d!y!%d!z!%d!width!%d!height!%d!depth!%d!relief!%s!\n", x, y, z, width, height, depth, relief);
    if (strcmp(relief, "raised") == 0) {
	if (leftBevel) {
            obj = BuildVertexInfo(interp, x, y, z, width, height, depth, shadow_colors.light_red,
                shadow_colors.light_green, shadow_colors.light_blue, shadow_colors.light_alpha, side);  
	} else {
            obj = BuildVertexInfo(interp, x, y, z, width, height, depth, shadow_colors.dark_red,
                shadow_colors.dark_green, shadow_colors.dark_blue, shadow_colors.dark_alpha, side);  
	}
        cmd_obj = Tcl_NewStringObj("::gles2::builtin::fillrectangle", -1);
	cmd_objv[0] = cmd_obj;
	if (Tcl_ListObjReplace(interp, obj, 0, 0, 1, cmd_objv) != TCL_OK) {
//fprintf(stderr, "VerticalBevel: cannot insert command in front of vertex info\n");
            exit(1);
	}
fprintf(stderr, "obj!%s!\n", Tcl_GetString(obj));
        if (Tcl_EvalObjEx(interp, obj, 0) != TCL_OK) {
//fprintf(stderr, "VerticalBevel: error in executing fillrectangle command:%s\n", Tcl_GetStringResult(interp));
            exit(1);
	}
//        XFillRectangle(display, drawable,
//            (leftBevel) ? borderPtr->lightGC : borderPtr->darkGC,
//            x, y, (unsigned) width, (unsigned) height);







|














|







714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
}

void VerticalBevel(Tcl_Interp *interp, int x, int y, int z, int width, int height, int depth, int leftBevel, char *relief, shadowColors shadow_colors, int side) {
    Tcl_Obj *obj;
    Tcl_Obj *cmd_obj;
    Tcl_Obj *cmd_objv[1];

//fprintf(stderr, "VerticalBevel!x!%d!y!%d!z!%d!width!%d!height!%d!depth!%d!relief!%s!\n", x, y, z, width, height, depth, relief);
    if (strcmp(relief, "raised") == 0) {
	if (leftBevel) {
            obj = BuildVertexInfo(interp, x, y, z, width, height, depth, shadow_colors.light_red,
                shadow_colors.light_green, shadow_colors.light_blue, shadow_colors.light_alpha, side);  
	} else {
            obj = BuildVertexInfo(interp, x, y, z, width, height, depth, shadow_colors.dark_red,
                shadow_colors.dark_green, shadow_colors.dark_blue, shadow_colors.dark_alpha, side);  
	}
        cmd_obj = Tcl_NewStringObj("::gles2::builtin::fillrectangle", -1);
	cmd_objv[0] = cmd_obj;
	if (Tcl_ListObjReplace(interp, obj, 0, 0, 1, cmd_objv) != TCL_OK) {
//fprintf(stderr, "VerticalBevel: cannot insert command in front of vertex info\n");
            exit(1);
	}
//fprintf(stderr, "obj!%s!\n", Tcl_GetString(obj));
        if (Tcl_EvalObjEx(interp, obj, 0) != TCL_OK) {
//fprintf(stderr, "VerticalBevel: error in executing fillrectangle command:%s\n", Tcl_GetStringResult(interp));
            exit(1);
	}
//        XFillRectangle(display, drawable,
//            (leftBevel) ? borderPtr->lightGC : borderPtr->darkGC,
//            x, y, (unsigned) width, (unsigned) height);
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
    int bottomGC;
    int myGC;
#define GC_DARK 1
#define GC_LITE 2
#define GC_BRDR 3
#define GC_BLAK 4

fprintf(stderr, "HorizontalBevel!x!%d!y!%d!z!%d!width!%d!height!%d!depth!%d!relief!%s!leftIn!%d!rightIn!%d!\n", x, y, z, width, height, depth, relief, leftIn, rightIn);
    topGC = GC_BLAK;
    bottomGC = GC_BLAK;
    if (strcmp(relief, "raised") == 0) {
        if (topBevel) {
            topGC = GC_LITE;
            bottomGC = GC_LITE;
	} else {







|







822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
    int bottomGC;
    int myGC;
#define GC_DARK 1
#define GC_LITE 2
#define GC_BRDR 3
#define GC_BLAK 4

//fprintf(stderr, "HorizontalBevel!x!%d!y!%d!z!%d!width!%d!height!%d!depth!%d!relief!%s!leftIn!%d!rightIn!%d!\n", x, y, z, width, height, depth, relief, leftIn, rightIn);
    topGC = GC_BLAK;
    bottomGC = GC_BLAK;
    if (strcmp(relief, "raised") == 0) {
        if (topBevel) {
            topGC = GC_LITE;
            bottomGC = GC_LITE;
	} else {
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
        return TCL_ERROR;
    }
    /* depth */
    if (Tcl_GetIntFromObj(interp, boxObjv[5], &position_box.depth) != TCL_OK) {
fprintf(stderr, "bad value for depth!%s!\n", Tcl_GetString(boxObjv[5]));
        return TCL_ERROR;
    }
fprintf(stderr, "POS!%d!%d!%d %d!%d!%d!\n", position_box.x, position_box.y, position_box.z, position_box.width, position_box.height, position_box.depth);
    /* borderWidth */
    if (Tcl_GetIntFromObj(interp, objv[2], &borderWidth) != TCL_OK) {
fprintf(stderr, "bad value for borderWidth!%s!\n", Tcl_GetString(objv[2]));
        return TCL_ERROR;
    }
    relief = Tcl_GetString(objv[3]);








|







1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
        return TCL_ERROR;
    }
    /* depth */
    if (Tcl_GetIntFromObj(interp, boxObjv[5], &position_box.depth) != TCL_OK) {
fprintf(stderr, "bad value for depth!%s!\n", Tcl_GetString(boxObjv[5]));
        return TCL_ERROR;
    }
//fprintf(stderr, "POS!%d!%d!%d %d!%d!%d!\n", position_box.x, position_box.y, position_box.z, position_box.width, position_box.height, position_box.depth);
    /* borderWidth */
    if (Tcl_GetIntFromObj(interp, objv[2], &borderWidth) != TCL_OK) {
fprintf(stderr, "bad value for borderWidth!%s!\n", Tcl_GetString(objv[2]));
        return TCL_ERROR;
    }
    relief = Tcl_GetString(objv[3]);

1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
        VerticalBevel(interp, position_box.x, position_box.y, position_box.z, borderWidth, position_box.height, position_box.depth, 1, relief, shadow_colors, LEFT_SIDE);
    }
    VerticalBevel(interp, position_box.x+position_box.width-borderWidth, position_box.y, position_box.z, borderWidth, position_box.height, position_box.depth, 0, relief, shadow_colors, FRONT_SIDE);
    if (position_box.depth > 0) {
        VerticalBevel(interp, position_box.x+position_box.width-borderWidth, position_box.y, position_box.z, borderWidth, position_box.height, position_box.depth, 0, relief, shadow_colors, RIGHT_SIDE);
        VerticalBevel(interp, position_box.x+position_box.width-borderWidth, position_box.y, position_box.z, borderWidth, position_box.height, position_box.depth, 0, relief, shadow_colors, LEFT_SIDE);
    }
fprintf(stderr, "1\n");
    HorizontalBevel(interp, position_box.x, position_box.y+position_box.height-borderWidth, position_box.z, position_box.width, borderWidth, position_box.depth, 1, 1, 1, relief, shadow_colors, FRONT_SIDE);
    if (position_box.depth > 0) {
fprintf(stderr, "2\n");
        HorizontalBevel(interp, position_box.x, position_box.y+position_box.height-borderWidth, position_box.z, position_box.width, borderWidth, position_box.depth, 1, 1, 1, relief, shadow_colors, TOP_SIDE);
        HorizontalBevel(interp, position_box.x, position_box.y+position_box.height-borderWidth, position_box.z, position_box.width, borderWidth, position_box.depth, 1, 1, 1, relief, shadow_colors, BOTTOM_SIDE);
        HorizontalBevel(interp, position_box.x, position_box.y+position_box.height-borderWidth, position_box.z, position_box.width, borderWidth, position_box.depth, 1, 1, 1, relief, shadow_colors, BACK_SIDE);
    }
fprintf(stderr, "3\n");
    HorizontalBevel(interp, position_box.x, position_box.y, position_box.z, position_box.width, borderWidth, position_box.depth, 0, 0, 0, relief, shadow_colors, FRONT_SIDE);
    if (position_box.depth > 0) {
fprintf(stderr, "4\n");
        HorizontalBevel(interp, position_box.x, position_box.y, position_box.z, position_box.width, borderWidth, position_box.depth, 0, 0, 0, relief, shadow_colors, TOP_SIDE);
        HorizontalBevel(interp, position_box.x, position_box.y, position_box.z, position_box.width, borderWidth, position_box.depth, 0, 0, 0, relief, shadow_colors, BOTTOM_SIDE);
        HorizontalBevel(interp, position_box.x, position_box.y, position_box.z, position_box.width, borderWidth, position_box.depth, 0, 0, 0, relief, shadow_colors, BACK_SIDE);
    }

    return result;
}







<


<




<


<







1681
1682
1683
1684
1685
1686
1687

1688
1689

1690
1691
1692
1693

1694
1695

1696
1697
1698
1699
1700
1701
1702
        VerticalBevel(interp, position_box.x, position_box.y, position_box.z, borderWidth, position_box.height, position_box.depth, 1, relief, shadow_colors, LEFT_SIDE);
    }
    VerticalBevel(interp, position_box.x+position_box.width-borderWidth, position_box.y, position_box.z, borderWidth, position_box.height, position_box.depth, 0, relief, shadow_colors, FRONT_SIDE);
    if (position_box.depth > 0) {
        VerticalBevel(interp, position_box.x+position_box.width-borderWidth, position_box.y, position_box.z, borderWidth, position_box.height, position_box.depth, 0, relief, shadow_colors, RIGHT_SIDE);
        VerticalBevel(interp, position_box.x+position_box.width-borderWidth, position_box.y, position_box.z, borderWidth, position_box.height, position_box.depth, 0, relief, shadow_colors, LEFT_SIDE);
    }

    HorizontalBevel(interp, position_box.x, position_box.y+position_box.height-borderWidth, position_box.z, position_box.width, borderWidth, position_box.depth, 1, 1, 1, relief, shadow_colors, FRONT_SIDE);
    if (position_box.depth > 0) {

        HorizontalBevel(interp, position_box.x, position_box.y+position_box.height-borderWidth, position_box.z, position_box.width, borderWidth, position_box.depth, 1, 1, 1, relief, shadow_colors, TOP_SIDE);
        HorizontalBevel(interp, position_box.x, position_box.y+position_box.height-borderWidth, position_box.z, position_box.width, borderWidth, position_box.depth, 1, 1, 1, relief, shadow_colors, BOTTOM_SIDE);
        HorizontalBevel(interp, position_box.x, position_box.y+position_box.height-borderWidth, position_box.z, position_box.width, borderWidth, position_box.depth, 1, 1, 1, relief, shadow_colors, BACK_SIDE);
    }

    HorizontalBevel(interp, position_box.x, position_box.y, position_box.z, position_box.width, borderWidth, position_box.depth, 0, 0, 0, relief, shadow_colors, FRONT_SIDE);
    if (position_box.depth > 0) {

        HorizontalBevel(interp, position_box.x, position_box.y, position_box.z, position_box.width, borderWidth, position_box.depth, 0, 0, 0, relief, shadow_colors, TOP_SIDE);
        HorizontalBevel(interp, position_box.x, position_box.y, position_box.z, position_box.width, borderWidth, position_box.depth, 0, 0, 0, relief, shadow_colors, BOTTOM_SIDE);
        HorizontalBevel(interp, position_box.x, position_box.y, position_box.z, position_box.width, borderWidth, position_box.depth, 0, 0, 0, relief, shadow_colors, BACK_SIDE);
    }

    return result;
}
Changes to generic/gles2Helpers.c.
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
    Tcl_Obj *blueObj,        /* blue part */
    Tcl_Obj *alphaObj,       /* alpha part */
    Tcl_Obj *obj)            /* Tcl_Obj to appen to */
{
    Tcl_Obj *listObj;
    Tcl_Obj *list1Obj;

fprintf(stderr, "AppendVertexPos!%f!%f!%f!\n", x, y, z);
    listObj = Tcl_NewListObj(0, NULL); /* the pos obj */

    list1Obj = Tcl_NewListObj(0, NULL); /* the position obj */
    if (Tcl_ListObjAppendElement(interp, list1Obj, Tcl_NewDoubleObj(x)) != TCL_OK) {
fprintf(stderr, "BuildVertexInfoPos could not append x value: %s\n", Tcl_GetString(listObj));
        return NULL;
    }







|







1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
    Tcl_Obj *blueObj,        /* blue part */
    Tcl_Obj *alphaObj,       /* alpha part */
    Tcl_Obj *obj)            /* Tcl_Obj to appen to */
{
    Tcl_Obj *listObj;
    Tcl_Obj *list1Obj;

//fprintf(stderr, "AppendVertexPos!%f!%f!%f!\n", x, y, z);
    listObj = Tcl_NewListObj(0, NULL); /* the pos obj */

    list1Obj = Tcl_NewListObj(0, NULL); /* the position obj */
    if (Tcl_ListObjAppendElement(interp, list1Obj, Tcl_NewDoubleObj(x)) != TCL_OK) {
fprintf(stderr, "BuildVertexInfoPos could not append x value: %s\n", Tcl_GetString(listObj));
        return NULL;
    }
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
//green = 0.0;
//blue = 0.0;
    redObj = Tcl_NewDoubleObj(red);
    greenObj = Tcl_NewDoubleObj(green);
    blueObj = Tcl_NewDoubleObj(blue);
    alphaObj = Tcl_NewDoubleObj(alpha);

fprintf(stderr, "BuildVertexInfo!%d! %d!%d!%d! %d!%d!%d!\n", side, x, y, z, width, height, depth);
    obj = Tcl_NewListObj(0, NULL); /* the return obj */
    switch(side) {
    case FRONT_SIDE:
        /* position1 */
        f_x = -1+Pixel2Coord(interp,x, 1);
        f_y = -1+Pixel2Coord(interp, y, 0);
        f_z = -1+Pixel2Coord(interp, z, -1);







|







1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
//green = 0.0;
//blue = 0.0;
    redObj = Tcl_NewDoubleObj(red);
    greenObj = Tcl_NewDoubleObj(green);
    blueObj = Tcl_NewDoubleObj(blue);
    alphaObj = Tcl_NewDoubleObj(alpha);

//fprintf(stderr, "BuildVertexInfo!%d! %d!%d!%d! %d!%d!%d!\n", side, x, y, z, width, height, depth);
    obj = Tcl_NewListObj(0, NULL); /* the return obj */
    switch(side) {
    case FRONT_SIDE:
        /* position1 */
        f_x = -1+Pixel2Coord(interp,x, 1);
        f_y = -1+Pixel2Coord(interp, y, 0);
        f_z = -1+Pixel2Coord(interp, z, -1);