今年5月1日起实施的中华人民共和国政府信息公开条例,我就知道有雷没雨。
狗费门公告
根据今年5月1日起实施的中华人民共和国政府信息公开条例,在节后的第一个工作日5月4日上午向北京市公安局提出信息公开申请并被告知有幸成为该局的第一申请人,除递交了按设定的表格填写的内容外,还补充和出示了相关材料, 经审核,该局确认本人申请符合规定,“本机关予以受理”并开出登记回执,拟于5月23日前作出书面答复。申请的内容如下:
“北京历年所收养犬管理服务费的收入,如分区(派出所)分标准(1000,
500,200元等)犬只的明细汇总;历年支出状况,如提供的服务和费用发 生的分类明细汇总等。公民养犬所缴费用属公共资源,又被限定为养犬管理 服务费,理应接受公众监督”
5月22日市局电话通知决定延长答复期限,并于23日开出延期答复告知书,对此我表示理解,还以为他们是在用心的作准备。
6月13日,延期答复的最后期限(本人三天后收到),北京市公安局寄出了答复:“经查,你申请获取的政府信息不属于本机关的掌握范围,建议向市或区县财政机关咨询”, 一纸“非本机关政府信息告知书”取代了原本期待的审计报告。
本人一生中遇到的无赖不多,但从没碰上过这么无赖的,北京市养犬管理规定指定“公安机关是养犬管理工作的主管机构,全面负责养犬管理工作”既然公安机关被授权为养犬管理主体,养犬缴费又是交给公安系统(请见收据印章),养犬收费加罚款一共收了多少能“不掌握”? 市公安局用于养犬管理诸如打狗、抓狗的人力财力、狂犬疫苗的提供、宣传材料的发放、七里渠的开销是多少岂能“不掌握”,这样简单的算术题连小学低年级的同学都能破解,堂堂的北京市公安局居然称“不掌握”,并以非本机关政府信息为由逃避公众追查,真敢冒天下之大不韪。这不但在挑战公众的良知,以为愚民良知未开,更是在挑战和对抗中央的方针政策。老百姓深知中央推出政府信息公开条例的良苦用心,目的是要遏制各地方、各部门越来越严重的腐败势头。
中国历来就有贪赃枉法一词,贪赃必然枉法,枉法必然贪赃。该局之所以敢不履行政府信息公开的义务,拒绝公众的监督,可能是把赌注押在非法用权上,他们属下有网络警察可以删除、屏蔽一切公正的言论,以保护自己。更是与这样的大气候有关:中国的司法独立只是个美丽的谎言,公检法穿一条裤子是不争的事实。他们不怕守法公民去法院上告,因为可以串通法院不立案不受理,让你告状无门,这就是中国社会的严酷现实,只能请高级党校的高级教授们在理论和实践上去努力破解。
看来狗费门丑闻业已形成,现有体制似难解决,只有启动道德法庭来审议了。
一,北京市公安局该不该掌握每年收取狗费或谓“集中上缴国库”总量的信息;北京市财政局又是怎样如数返还用于养犬管理的,以及拨了多少,用了多少的信息?
二, 2005年7月7日北京市公安局治安总队副总队长唐云利就有媒体报道“北京市养犬登记年检工作收取的管理服务费每年达2.8亿元”一事正式向社会各界澄清,“包括今年在内的历年犬类登记工作年收费总额远未超过1亿元,收取费用全部上交各区财政部门,此部分收入多数用于免费注射狂犬疫苗和安全养犬宣传经费”。唐辩称“今年(2005)虽然年检总数达到了历史最高(45万条)但比去年(2004)8000万元的收费总数不会有大幅增长”唐副总队长如是对晨报记者张涵说。又据北京晚报记者王蔷2006年7月3日报道,从官方的消息来源获悉,自03年登记的13万条到06年6月30日登记的53万条,4年翻了4番。后又有消息称07年63万条,今年春季已有报道达70万条。事实证明该局不是不掌握相关信息,否则唐副总队长怎么能确认2004年收入8000万元,又怎么能说出“多数用于免费注射狂犬疫苗和安全养犬宣传经费呢?!
十七大后中央提出要加强政治文明建设,经济活动的透明,置于公众的监督之下已成了重要的组成部分。多年来公众和媒体一直强调养犬收费要专款专用,要透明公开,市局不改进工作,不加强财经纪律,现在怎么能装傻充愣对抗履行政府信息公开的义务。
三,条例实施一个多月来不少地方和部门都以信息不存在或不掌握为由规避追究,说明中央的指令失灵,遭遇地方和部门的顽强抵抗,并且难以自纠。应该承认十七大文件是个好文件,如果全国上下都能不打折扣的执行,中国就有希望,可惜的是权势部门立了牌坊,但婊子行为不断,这是百姓们的最大忧虑。只有百姓真正有了当家作主人的权力,有了“扫黄打非”的能力—婊子姓黄该扫,“非”指非法使用权力侵害公民正当权益该打。 中国只有扫除政治婊子,打击非法用权才能构建出真正的和谐社会。
四,公安部门是国家机器,应是一个严谨、严肃的机构,不能不负责任说出有脖公理的话,不考虑社会影响,最终把自己推上被告席。皇城根下竟然如此这般,正是让人难以置信。
五,虽然告知书建议去市或区县财政机关咨询,但本人是养犬缴费人,是终端用户,狗费直接交给了公安部门,你们收狗费,以狗的名义花钱,收了多少,花了多少,不问你们问谁?
道德法庭开庭了!请关心此狗费门的朋友广为评论和审议。
特此公告
拉拉爷爷 2008-6-20
都现在这个时候了,居然仍然有人不顾自己的购买力买房,等到房价一跌,就负资产吧。谁让不听劝呢。
最近算了一下,如果是投资的房子,必须赶紧出手了,因为租金根本抵不上卖出房子后存银行定期的利息,而且业主还需要担负物业费、供暖费。在过去,就算租金低,但因为房价有上涨空间,所以可以放着让它涨价,但是现在房价上涨的动力已经没有了,再不出手就砸手里了。
这几天把我们忙坏了,为小乖准备了好多好多的东西,笼子、篮子、粮食、玩具。。。 虽然很辛苦,但是心里还是蛮高兴,看着它以标准的饿死鬼投胎的模样吃饭,然后吃饱了就快乐的围着几个房间转着圈的扑腾,四条小腿儿还颤颤巍巍偶尔跌倒的样子,真是很可爱,我一直跟馒头想象着,等它长大的时候,我们要带它去爬山、郊游、游泳,好多好多事情可做呢。希望它能健康快乐的成长,等长成大乖狗的时候,带给各位朋友认识,嘿嘿。
ps. 它还真是狗如其名,拉不拉? 多!
看看可爱小模样。。。
之前的猪猪计划由于各种各样的原因泡汤了,心里还是挺遗憾的,但在遗憾的同时,同样一个令人兴奋的计划诞生了,那就是,我们要养狗狗啦,这两天大量的信息阅读以及亲身去狗市的体验使我们的选择越来越谨慎,范围上也越来越小了。
看了很多活泼可爱狗儿,我和小馒想法还是比较一致的,希望能养一条比较大一些的乖狗,看中的品种也比较一致,只有那么几种,依次是:拉布拉多、哈士奇和松狮,后面还有金毛和喜乐蒂候补。。。赫赫,刚开始的时候,我们都很喜欢大白熊,无奈它长大了实在太大,我们现在的条件确是不适合的。。。
狗儿很可爱,也需要很多的爱心,不管生老病死都对它不离不弃。象我现在这样的工作情况还是比较宽松的,我希望能拥有一条健康快乐聪明伶俐的大狗,陪伴我、保护我,陪我一起看电视,哈哈,名儿嘛,还是叫花卷吧,纪念我那不知道在哪户人家的小猪猪。。。
等狗儿子进门的时候贴张靓照出来,让大家羡慕羡慕。。。
今天偶然看到一段关于Java性能的评述,看起来挺让人鼓舞的,呵呵。
Up until 1996, Java was very slow. Until 1998, it was slow. Until 2000, it was fast enough for most apps, but still on average only 50%-75% of the speed of C++. Since around 2002, Java on average is less than 5% slower than the best C++ code. For most applications (including games) java is within 1% of the speed of C++ code; many of the improvements of the last few years have concentrated on making up the performance gap, so that now - finally!- Java is a realistic practical alternative even in games development - where RAW SPEED is usually the most important factor.
也许是awt/swing的反应速度实在太慢了,以至于人们一猛子是根本不会相信,原来移植到java上的quake2,竟然也这么快了。
看看这些数据吧。
第6次小程序试验用一个简单体逐步拟合成一个球体。
书中给的例子是用正二十面体拟合的,![]()
![]()
![]()
程序运行时用鼠标双击屏幕即可逐步进行三角形分解。
/**
* Copyright 1993-2008 Agree Tech.
* All rights reserved.
*/
package test.swt.opengl;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.opengl.GLCanvas;
import org.eclipse.swt.opengl.GLData;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GLContext;
/**
* @author PuYun <pu.yun@agree.com.cn>
* @version $Id$
*
*/
public class Test6IcosahedronToGlobe
{
private static GLCanvas canvas;
private static int depth = 0;
private static Display display;
private static int[] indices = { 0, 4, 1, 0, 9, 4, 9, 5, 4, 4, 5, 8, 4, 8,
1, 8, 10, 1, 8, 3, 10, 5, 3, 8, 5, 2, 3, 2, 7, 3, 7, 10, 3, 7, 6,
10, 7, 11, 6, 11, 0, 6, 0, 1, 6, 6, 1, 10, 9, 0, 11, 9, 11, 2, 9,
2, 5, 7, 2, 11 };
private static Shell shell;
private static float[] vertices;
static
{
float x = 0.525731112119133606f;
float z = 0.850650808352039932f;
vertices = new float[] { -x, 0, z, x, 0, z, -x, 0, -z, x, 0, -z, 0, z,
x, 0, z, -x, 0, -z, x, 0, -z, -x, z, x, 0, -z, x, 0, z, -x, 0,
-z, -x, 0 };
}
private static void addNormalListeners()
{
canvas.addListener(SWT.Resize, new Listener()
{
public void handleEvent(Event event)
{
toCanvas();
Rectangle bounds = canvas.getBounds();
GL11.glViewport(0, 0, bounds.width, bounds.height);
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GL11.glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
}
});
canvas.notifyListeners(SWT.Resize, null);
}
/**
* @param args
* String[]
*/
private static void addOtherListeners()
{
canvas.addListener(SWT.MouseDoubleClick, new Listener()
{
public void handleEvent(Event event)
{
if (depth == 6)
{
depth = 0;
} else
{
depth++;
}
}
});
}
private static void displayCanvas()
{
toCanvas();
GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_LINE);
GL11.glPolygonMode(GL11.GL_BACK, GL11.GL_LINE);
float frot = 1;
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
GL11.glRotatef(0.3f * frot, .20f * frot, 1.0f * frot, 0.30f);
GL11.glRotatef(0.03f * frot, .30f * frot, 0.10f * frot, 0.10f);
for (int i = 0; i < indices.length; i += 3)
{
float[] p1 = new float[] { vertices[3 * indices[i]],
vertices[3 * indices[i] + 1], vertices[3 * indices[i] + 2] };
float[] p2 = new float[] { vertices[3 * indices[i + 1]],
vertices[3 * indices[i + 1] + 1],
vertices[3 * indices[i + 1] + 2] };
float[] p3 = new float[] { vertices[3 * indices[i + 2]],
vertices[3 * indices[i + 2] + 1],
vertices[3 * indices[i + 2] + 2] };
subdivide(p1, p2, p3, depth);
}
GL11.glFlush();
canvas.swapBuffers();
}
/**
* @param p1
* float[]
* @param p2
* float[]
* @param p3
* float[]
* @param depth
* int
*/
private static void drawTriangle(float[] p1, float[] p2, float[] p3)
{
GL11.glBegin(GL11.GL_TRIANGLES);
GL11.glNormal3f(p1[0], p1[1], p1[2]);
GL11.glVertex3f(p1[0], p1[1], p1[2]);
GL11.glNormal3f(p2[0], p2[1], p2[2]);
GL11.glVertex3f(p2[0], p2[1], p2[2]);
GL11.glNormal3f(p3[0], p3[1], p3[2]);
GL11.glVertex3f(p3[0], p3[1], p3[2]);
GL11.glEnd();
}
/**
* @param args
* String[]
*/
private static void init()
{
toCanvas();
GL11.glClearColor(0, 0, 0, 0);
GL11.glShadeModel(GL11.GL_FLAT);
}
private static void loop()
{
while (!shell.isDisposed())
{
if (!display.readAndDispatch())
{
displayCanvas();
}
}
}
public static void main(String[] args)
{
display = new Display();
shell = new Shell(display);
shell.setLayout(new FillLayout());
GLData data = new GLData();
data.doubleBuffer = true;
canvas = new GLCanvas(shell, SWT.NONE, data);
shell.setSize(400, 400);
shell.open();
init();
addNormalListeners();
addOtherListeners();
loop();
}
/**
*/
private static void normalize(float[] p)
{
float d = (float) Math.sqrt(p[0] * p[0] + p[1] * p[1] + p[2] * p[2]);
p[0] /= d;
p[1] /= d;
p[2] /= d;
}
/**
*
*/
private static void subdivide(float[] p1, float[] p2, float[] p3, int depth)
{
float p12[] = new float[3];
float p23[] = new float[3];
float p31[] = new float[3];
int i;
if (depth == 0)
{
drawTriangle(p1, p2, p3);
return;
}
for (i = 0; i < 3; i++)
{
p12[i] = p1[i] + p2[i];
p23[i] = p2[i] + p3[i];
p31[i] = p3[i] + p1[i];
}
normalize(p12);
normalize(p23);
normalize(p31);
subdivide(p1, p12, p31, depth - 1);
subdivide(p2, p23, p12, depth - 1);
subdivide(p3, p31, p23, depth - 1);
subdivide(p12, p23, p31, depth - 1);
}
/**
*
*/
private static void toCanvas()
{
canvas.setCurrent();
try
{
GLContext.useContext(canvas);
} catch (LWJGLException e)
{
e.printStackTrace();
}
}
}
/**
* Copyright 1993-2008 Agree Tech.
* All rights reserved.
*/
package test.swt.opengl;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.opengl.GLCanvas;
import org.eclipse.swt.opengl.GLData;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GLContext;
import org.lwjgl.opengl.glu.GLU;
/**
* @author PuYun <pu.yun@agree.com.cn>
* @version $Id$
*
*/
public class Test5VertexArray
{
private static GLCanvas canvas;
private static Display display;
private static Shell shell;
private static void addNormalListeners()
{
canvas.addListener(SWT.Resize, new Listener()
{
public void handleEvent(Event event)
{
toCanvas();
Rectangle bounds = canvas.getBounds();
GL11.glViewport(0, 0, bounds.width, bounds.height);
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GLU.gluOrtho2D(0, bounds.width, 0, bounds.height);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
}
});
canvas.notifyListeners(SWT.Resize, null);
}
/**
* @param args
* String[]
*/
private static void addOtherListeners()
{
}
private static void displayCanvas()
{
toCanvas();
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
/* try this */
GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, 6);
/* or */
// GL11.glDrawElements(GL11.GL_TRIANGLES, (IntBuffer) BufferUtils
// .createIntBuffer(6).put(new int[] { 0, 1, 2, 3, 4, 5 }).flip());
/* or */
// GL11.glBegin(GL11.GL_TRIANGLES);
// for (int i=0; i< 6; i++)
// {
// GL11.glArrayElement (i);
// }
// GL11.glEnd();
GL11.glFlush();
canvas.swapBuffers();
}
/**
* @param args
* String[]
*/
private static void init()
{
toCanvas();
GL11.glClearColor(0, 0, 0, 0);
GL11.glShadeModel(GL11.GL_FLAT);
int[] vertices = { 25, 25, 100, 325, 175, 25, 175, 325, 250, 25, 325,
325 };
float[] colors = { 1.0f, 0.2f, 0.2f, 0.2f, 0.2f, 1.0f, 0.8f, 1.0f,
0.2f, 0.75f, 0.75f, 0.75f, 0.35f, 0.35f, 0.35f, 0.5f, 0.5f,
0.9f };
GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
GL11.glColorPointer(3, 0, BufferTools.createFloatBuffer(colors));
GL11.glVertexPointer(2, 0, BufferTools.createIntBuffer(vertices));
}
private static void loop()
{
while (!shell.isDisposed())
{
if (!display.readAndDispatch())
{
displayCanvas();
}
}
}
public static void main(String[] args)
{
display = new Display();
shell = new Shell(display);
shell.setLayout(new FillLayout());
GLData data = new GLData();
data.doubleBuffer = true;
canvas = new GLCanvas(shell, SWT.NONE, data);
shell.setSize(400, 400);
shell.open();
init();
addNormalListeners();
addOtherListeners();
loop();
}
/**
*
*/
private static void toCanvas()
{
canvas.setCurrent();
try
{
GLContext.useContext(canvas);
} catch (LWJGLException e)
{
e.printStackTrace();
}
}
}
/**
* Copyright 1993-2008 Agree Tech.
* All rights reserved.
*/
package test.swt.opengl;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.opengl.GLCanvas;
import org.eclipse.swt.opengl.GLData;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GLContext;
import org.lwjgl.opengl.glu.GLU;
/**
* @author PuYun <pu.yun@agree.com.cn>
* @version $Id$
*
*/
public class Test4Fly
{
private static GLCanvas canvas;
private static Display display;
private static Shell shell;
private static void addNormalListeners()
{
canvas.addListener(SWT.Resize, new Listener()
{
public void handleEvent(Event event)
{
toCanvas();
Rectangle bounds = canvas.getBounds();
GL11.glViewport(0, 0, bounds.width, bounds.height);
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GLU.gluOrtho2D(0, bounds.width, 0, bounds.height);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
}
});
canvas.notifyListeners(SWT.Resize, null);
}
/**
* @param args
* String[]
*/
private static void addOtherListeners()
{
}
private static void displayCanvas()
{
toCanvas();
int[] flyI = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0x80, 0x01, 0xC0, 0x06, 0xC0, 0x03, 0x60, 0x04, 0x60, 0x06,
0x20, 0x04, 0x30, 0x0C, 0x20, 0x04, 0x18, 0x18, 0x20, 0x04,
0x0C, 0x30, 0x20, 0x04, 0x06, 0x60, 0x20, 0x44, 0x03, 0xC0,
0x22, 0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22, 0x44,
0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80,
0x22, 0x44, 0x01, 0x80, 0x22, 0x66, 0x01, 0x80, 0x66, 0x33,
0x01, 0x80, 0xCC, 0x19, 0x81, 0x81, 0x98, 0x0C, 0xC1, 0x83,
0x30, 0x07, 0xe1, 0x87, 0xe0, 0x03, 0x3f, 0xfc, 0xc0, 0x03,
0x31, 0x8c, 0xc0, 0x03, 0x33, 0xcc, 0xc0, 0x06, 0x64, 0x26,
0x60, 0x0c, 0xcc, 0x33, 0x30, 0x18, 0xcc, 0x33, 0x18, 0x10,
0xc4, 0x23, 0x08, 0x10, 0x63, 0xC6, 0x08, 0x10, 0x30, 0x0c,
0x08, 0x10, 0x18, 0x18, 0x08, 0x10, 0x00, 0x00, 0x08 };
int[] halftoneI = { 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA,
0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA,
0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55,
0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA,
0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA,
0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55,
0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA,
0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA,
0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55,
0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55 };
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
GL11.glColor3f(1.0f, 1.0f, 1.0f);
/* draw one solid, unstippled rectangle, */
/* then two stippled rectangles */
GL11.glRectf(25.0f, 25.0f, 125.0f, 125.0f);
GL11.glEnable(GL11.GL_POLYGON_STIPPLE);
GL11.glPolygonStipple(BufferTools.createByteBuffer(flyI, 1024));
GL11.glRectf(125.0f, 25.0f, 225.0f, 125.0f);
GL11.glPolygonStipple(BufferTools.createByteBuffer(halftoneI, 1024));
GL11.glRectf(225.0f, 25.0f, 325.0f, 125.0f);
GL11.glDisable(GL11.GL_POLYGON_STIPPLE);
GL11.glFlush();
canvas.swapBuffers();
}
/**
* @param args
* String[]
*/
private static void init()
{
toCanvas();
GL11.glClearColor(0, 0, 0, 0);
GL11.glShadeModel(GL11.GL_FLAT);
}
private static void loop()
{
while (!shell.isDisposed())
{
if (!display.readAndDispatch())
{
displayCanvas();
}
}
}
public static void main(String[] args)
{
display = new Display();
shell = new Shell(display);
shell.setLayout(new FillLayout());
GLData data = new GLData();
data.doubleBuffer = true;
canvas = new GLCanvas(shell, SWT.NONE, data);
shell.setSize(400, 200);
shell.open();
init();
addNormalListeners();
addOtherListeners();
loop();
}
/**
*
*/
private static void toCanvas()
{
canvas.setCurrent();
try
{
GLContext.useContext(canvas);
} catch (LWJGLException e)
{
e.printStackTrace();
}
}
}
/**
* Copyright 1993-2008 Agree Tech.
* All rights reserved.
*/
package test.swt.opengl;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.opengl.GLCanvas;
import org.eclipse.swt.opengl.GLData;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GLContext;
import org.lwjgl.opengl.glu.GLU;
/**
* @author PuYun <pu.yun@agree.com.cn>
* @version $Id$
*
*/
public class Test3Line
{
private static GLCanvas canvas;
private static Display display;
private static Shell shell;
private static void addNormalListeners()
{
canvas.addListener(SWT.Resize, new Listener()
{
public void handleEvent(Event event)
{
toCanvas();
Rectangle bounds = canvas.getBounds();
GL11.glViewport(0, 0, bounds.width, bounds.height);
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GLU.gluOrtho2D(0, bounds.width, 0, bounds.height);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
}
});
canvas.notifyListeners(SWT.Resize, null);
}
/**
* @param args
* String[]
*/
private static void addOtherListeners()
{
}
private static void drawOneLine(float x1, float y1, float x2, float y2)
{
GL11.glBegin(GL11.GL_LINES);
GL11.glVertex2f(x1, y1);
GL11.glVertex2f(x2, y2);
GL11.glEnd();
}
private static void displayCanvas()
{
toCanvas();
int i;
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
/* select white for all lines */
GL11.glColor3f(1.0f, 1.0f, 1.0f);
/* in 1st row, 3 lines, each with a different stipple */
GL11.glEnable(GL11.GL_LINE_STIPPLE);
GL11.glLineStipple(1, (short) 0x0101); /* dotted */
drawOneLine(50.0f, 125.0f, 150.0f, 125.0f);
GL11.glLineStipple(1, (short) 0x00FF); /* dashed */
drawOneLine(150.0f, 125.0f, 250.0f, 125.0f);
GL11.glLineStipple(1, (short) 0x1C47); /* dash/dot/dash */
drawOneLine(250.0f, 125.0f, 350.0f, 125.0f);
/* in 2nd row, 3 wide lines, each with different stipple */
GL11.glLineWidth(5.0f);
GL11.glLineStipple(1, (short) 0x0101); /* dotted */
drawOneLine(50.0f, 100.0f, 150.0f, 100.0f);
GL11.glLineStipple(1, (short) 0x00FF); /* dashed */
drawOneLine(150.0f, 100.0f, 250.0f, 100.0f);
GL11.glLineStipple(1, (short) 0x1C47); /* dash/dot/dash */
drawOneLine(250.0f, 100.0f, 350.0f, 100.0f);
GL11.glLineWidth(1.0f);
/* in 3rd row, 6 lines, with dash/dot/dash stipple */
/* as part of a single connected line strip */
GL11.glLineStipple(1, (short) 0x1C47); /* dash/dot/dash */
GL11.glBegin(GL11.GL_LINE_STRIP);
for (i = 0; i < 7; i++)
GL11.glVertex2f((float) (50.0 + (i * 50.0)), 75.0f);
GL11.glEnd();
/* in 4th row, 6 independent lines with same stipple */
for (i = 0; i < 6; i++)
{
drawOneLine(50.0f + i * 50.0f, 50.0f, 50.0f + ((i + 1) * 50.0f),
50.0f);
}
/* in 5th row, 1 line, with dash/dot/dash stipple */
/* and a stipple repeat factor of 5 */
GL11.glLineStipple(5, (short)0x1C47); /* dash/dot/dash */
drawOneLine(50.0f, 25.0f, 350.0f, 25.0f);
GL11.glDisable(GL11.GL_LINE_STIPPLE);
GL11.glFlush();
canvas.swapBuffers();
}
/**
* @param args
* String[]
*/
private static void init()
{
toCanvas();
GL11.glClearColor(0, 0, 0, 0);
GL11.glShadeModel(GL11.GL_FLAT);
}
private static void loop()
{
while (!shell.isDisposed())
{
if (!display.readAndDispatch())
{
displayCanvas();
}
}
}
public static void main(String[] args)
{
display = new Display();
shell = new Shell(display);
shell.setLayout(new FillLayout());
GLData data = new GLData();
data.doubleBuffer = true;
canvas = new GLCanvas(shell, SWT.NONE, data);
shell.setSize(400, 200);
shell.open();
init();
addNormalListeners();
addOtherListeners();
loop();
}
/**
*
*/
private static void toCanvas()
{
canvas.setCurrent();
try
{
GLContext.useContext(canvas);
} catch (LWJGLException e)
{
e.printStackTrace();
}
}
}
[powered by WordPress.]
95. We are waking up and linking to each other. We are watching. But we are not waiting.
— The Cluetrain Manifesto
33 database queries in 1.081 seconds