pyglet.gl使用整数而不是浮点数

问题描述 投票:0回答:1
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使用整数值而不是浮点数我试图做地形噪音的事情,https://www.youtube.com/watch?v=IKB1hWWedMk但在python中。 Idk如果它可能,但如果是的话会很好。如果有人知道你能告诉我怎么做以及把它放在哪里

python pyglet
1个回答
0
投票
def inter(x,h):
    return x/h

忽略它的名称,因为我想不出它叫什么。这是有效的,我是一个白痴就是那么简单

© www.soinside.com 2019 - 2024. All rights reserved.