from opensimplex import OpenSimplex
from pyglet.gl import *
gen = OpenSimplex()
def noise(nx, ny):
return gen.noise2d(nx, ny) / 2.0 + 0.5
value = []
height = 10
width = 10
scl = 10
offsetx = -10
offsety = -10
class windowed(pyglet.window.Window):
def __init__(self,*args,**kwargs):
super().__init__(*args,**kwargs)
self.set_minimum_size(400,300)
def on_draw(self):
glClear(GL_COLOR_BUFFER_BIT)
#batch = pyglet.graphics.Batch()
for y in range(10):
#print("y")
glBegin(GL_LINE_LOOP)
for x in range(10):
#print("x")
#glColor3f( 1, 1, 1 )
glVertex3f(float((x+offsetx)*scl),float((y+offsety)*scl),0.0)
glVertex3f(float((x+offsetx)*scl),float((y+1+offsety)*scl),0.0)
glEnd()
#batch.draw()
def on_resize(self,w,h):
glViewport(0,0,w,h)
window = windowed(720,720,"yeet",resizable = True)
pyglet.clock.tick()
pyglet.app.run()
如何将glVertex3f更改为使用整数值而不是浮点数 我试图做地形噪声的事情,但是用python。Idk,如果可能的话,但如果是的话,那就太好了。如果你们中有人知道,你能告诉我怎么做,把它放在哪里吗
忽略它的名字,因为我想不起它叫什么。这很有效,我是个白痴就这么简单
相关问题 更多 >
编程相关推荐