這個glreadpixels()的印度函式跟e哥研究了一下午感覺有毒,至於藍色的值為什麼是那個數字,說實話我也沒搞明白,哪位大佬知道了告訴我一下貼一下執行結果
賊醜的夢字,我快醜哭了
下面貼**
from opengl.gl import *
from opengl.glu import *
from opengl.glut import *
import sys
point = 0
sys.setrecursionlimit(1000000)
defdrawmeng
(): glclear(gl_color_buffer_bit)
glbegin(gl_line_loop)
glcolor3f(0.0, 0.0, 1.0)
glvertex2i(-5, 15)
glvertex2i(-15, 15)
glvertex2i(-15, 25)
glvertex2i(-20, 25)
glvertex2i(-20, 15)
glvertex2i(-30, 15)
glvertex2i(-30, 10)
glvertex2i(-25, 10)
glvertex2i(-30, 5)
glvertex2i(-30, 0)
glvertex2i(-20, 5)
glvertex2i(-20, 0)
glvertex2i(-15, 0)
glvertex2i(-15, 5)
glvertex2i(-5, 0)
glvertex2i(-5, 5)
glvertex2i(-10, 10)
glvertex2i(-5, 10)
glend()
glbegin(gl_line_loop)
glcolor3f(0.0, 0.0, 1.0)
glvertex2i(5, 15)
glvertex2i(15, 15)
glvertex2i(15, 25)
glvertex2i(20, 25)
glvertex2i(20, 15)
glvertex2i(30, 15)
glvertex2i(30, 10)
glvertex2i(25, 10)
glvertex2i(30, 5)
glvertex2i(30, 0)
glvertex2i(20, 5)
glvertex2i(20, 0)
glvertex2i(15, 0)
glvertex2i(15, 5)
glvertex2i(5, 0)
glvertex2i(5, 5)
glvertex2i(10, 10)
glvertex2i(5, 10)
glend()
glbegin(gl_line_loop)
glcolor3f(0.0, 0.0, 1.0)
glvertex2i(-15, -5)
glvertex2i(-20, -20)
glvertex2i(-15, -20)
glvertex2i(-10, -10)
glvertex2i(0, -20)
glvertex2i(-8, -30)
glvertex2i(0, -30)
glvertex2i(15, -5)
glend()
glbegin(gl_line_loop)
glcolor3f(0.0, 0.0, 1.0)
glvertex2i(-8, -8)
glvertex2i(8, -8)
glvertex2i(2, -18)
glend()
fill(-17, 15, 16711680)
fill(17, 15, 16711680)
fill(8, -7, 16711680)
deffill
(x, y, bordercolor):
global point
point = point + 1
if getpixel(x, y) != bordercolor:
setpixel(x, y)
fill(x, y-1, bordercolor)
fill(x, y+1, bordercolor)
fill(x-1, y, bordercolor)
fill(x+1, y, bordercolor)
defsetpixel
(x, y):
glbegin(gl_points)
glcolor3f(0.0, 0.0, 1.0)
glvertex2i(x, y)
glend()
glflush()
defgetpixel
(x, y):
a = (gluint * 1)(0)
glreadpixels(x+100, y+100, 1, 1, gl_rgb, gl_unsigned_byte, a)
return int(a[0])
if __name__ == '__main__':
glutinit()
glutinitdisplaymode(glut_single | glut_rgb)
glutinitwindowsize(200, 200)
glutcreatewindow("homeworktwo")
glloadidentity()
gluortho2d(-100, 100, -100, 100)
glutdisplayfunc(drawmeng)
glutmainloop()
python opengl顯示三維模型小程式
在win7 python3.5環境下配置opengl,並顯示三維模型 首先安裝opengl 已經安裝python的系統會自動安裝pip,所以只需要一句pip命令就可以安裝opengl了,命令如下 pip install pyopengl pyopengl accelerate然後在python 中i...
何時採用SOA,何時不採用SOA
不可輕易決定實現soa。這與改變生活方式有些類似,因為開發和操作團隊遵循的 it 控制模式將完全不同。holt adams soa 能夠優化業務需求與 it 的一致性,能夠將業務流程活動從服務實現中分離出來,還能夠降低操作成本。只有在不固定 商的情況下才能真正實現這些功能,此時面向 soa 實現的技...
CAS採用http方式不採用https方式配置
cas3一下的版本網上介紹說比較複雜,本人未測試。本文是在cas server3.4版本上測試成功的,記錄在此以供以後查詢 主要有以下步驟 1.web inf spring configuration ticketgrantingticketcookiegenerator.xml中將p cookie...