Well, I have little knowledge about OpenGL. Please help me understand why the error show up and what could be the possible ways to solve the error.
Here is my code:
from ursina import *
import pyvista as pv
from pyvista import examples
# Starting an ursina app
app = Ursina()
# Define a parent entity of ursina
prnt = Entity()
# Defne a button entity which calls the method pyvista_display on click
Button("click", parent=prnt, scale=1, on_click=lambda: pyvista_display())
def pyvista_display(): # Method to display a simple pyvista mesh
# Load an interesting example of geometry
mesh = examples.load_random_hills()
# Establish geometry within a pv.Plotter()
p = pv.Plotter()
# Add mesh to the plotter
p.add_mesh(mesh, color=True)
# Show the plotter
p.show()
p.close()
# Run ursina app
app.run()
Description of the module:
- Module imports ursina, pyvista and pyvista example package
- I run an ursina application. In the application, only a functional button is there with label "click"
- While I click the button, the function pyvista_display() is called.
- Function pyvista_display() simple opens a pyvista window and display a mesh from inbuilt pyvista example package (which I have imported above)
Error Showing Moment: Till now the code is running perfectly fine. I click the "click" button and the pyvista window shows up and display the simple example mesh. Problem arises when I close the pyvista window. When I close the pyvista window, below error message is showing on my terminal. And the message is showing in an infinite loop like we are printing something in a loop without limit.
Error
:display:gsg:glgsg(error): GL error 0x502 : invalid operation
Error message meaning from ChatGPT
The error message :display:gsg:glgsg(error): GL error 0x502 : invalid operation is an OpenGL error message that indicates an invalid operation was attempted within an OpenGL context. The error code 0x502 corresponds to the OpenGL constant GL_INVALID_OPERATION.
Expectation:
- Expected to close the pyvista window properly and continue to run the application without any error.
- Like after I close the pyvista window, ursina window with "click" button still continue to run. And the pyvista window again shows up when I again click the "click" window
Request: As I have already mentioned above that I have very little knowledge about OpenGL, if you identify the error and solve me the problem, it would be a blessing for me. Or if you provide me an alternative way to reach the expectation, I am ready to listen to your suggestions.