es.davy.ai

Preguntas y respuestas de programación confiables

¿Tienes una pregunta?

Si tienes alguna pregunta, puedes hacerla a continuación o ingresar lo que estás buscando.

Tag: PYOPENGL

Fuga de memoria con PyOpenGL y Pygame

Quizás alguien me ilumine. Tengo este fragmento de código: import pygame from OpenGL.GL import glClear, GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_STENCIL_BUFFER_BIT from pygame.constants import DOUBLEBUF, OPENGL pygame.init() clock = pygame.time.Clock() pygame.display.set_mode((640,480), DOUBLEBUF|OPENGL) while 1: glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT) pygame.display.flip() clock.tick(50) Ejecutar esto causa un consumo de memoria lento pero molesto cuando lo compruebo con el administrador . . . Read more

OpenGL VBO puede ejecutarse sin errores pero no se muestra ninguna gráfica.

El siguiente código debería dibujar un cubo cada vez que se llame: código de error: draw=False block_VBO=0 block_EBO=0 block_VAO=0 block_EBO_buffer_len=0 def print_blocks(sx:int,sy:int,sz:int): global draw,block_VAO,block_EBO,block_VBO,block_EBO_buffer_len if not draw: block_point_buffer=[] block_color_buffer=[] block_EBO_buffer=[] block_point_buffer+=[x-0.5,y+0.5,z-0.5,#V0 x+0.5,y+0.5,z-0.5,#V1 x+0.5,y-0.5,z-0.5,#V2 x-0.5,y-0.5,z-0.5,#V3 x-0.5,y+0.5,z+0.5,#V4 x+0.5,y+0.5,z+0.5,#V5 x+0.5,y-0.5,z+0.5,#V6 x-0.5,y-0.5,z+0.5]#V7 block_EBO_buffer+=[0,1,5,4, 3,2,6,7, 0,3,7,4, 1,2,6,5, 0,1,2,3, 4,5,6,7] block_VBO=glGenBuffers(1) glBindBuffer(GL_ARRAY_BUFFER,block_VBO) a=numpy.array(block_point_buffer,dtype='float32') glBufferData(GL_ARRAY_BUFFER,sys.getsizeof(a),a,GL_STATIC_DRAW) block_EBO=glGenBuffers(1) glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,block_EBO) . . . Read more

Cómo reemplazar un Widget de OpenGL en un diseño QT?

Creé una ventana en Qt Designer y agregué un widget de OpenGL como widget principal de visualización. En mi código principal, ahora quiero intercambiar este widget de OpenGL con un pyqtgraph.OpenGl.GlViewWidget, pero el comportamiento original se pierde cuando lo hago de esta manera: “`html <h1>Código generado por Qt Designer</h1> class . . . Read more