pyopengl

Using gluLookAt() causes the objects to spin

醉酒当歌 提交于 2021-02-19 07:54:18
问题 I am making a game using OpenGL with Pygame. So far I was able to make cubes appear and make a cross hair. When I tried to implement looking around, things got... weird. I would run it and without even moving my mouse it would start spinning the screen everywhere when I used the gluLookAt() function. When I took that out, it worked but I couldn't look around. I was doing some testing and I even put in set data values to the function just to make sure that they were not changing and it still

Pygame OpenGL 3D Cube Lag

无人久伴 提交于 2021-02-17 02:06:24
问题 I am following a tutorial series that is rather old on pyOpenGL and I am doing exactly as he does. However I am experiencing lag - I have AMD FX-6300 with 8gb ram, GTX-1050ti and files are stored on a flashdrive. I have read some places that using glBegin and glEnd cause issues? What should I use instead and how would I do it in this code: import pygame from pygame.locals import * from OpenGL.GL import * from OpenGL.GLU import * import random """ - A Cube has 8 Nodes/Verticies - 12 Lines

Pygame OpenGL 3D Cube Lag

元气小坏坏 提交于 2021-02-17 02:06:24
问题 I am following a tutorial series that is rather old on pyOpenGL and I am doing exactly as he does. However I am experiencing lag - I have AMD FX-6300 with 8gb ram, GTX-1050ti and files are stored on a flashdrive. I have read some places that using glBegin and glEnd cause issues? What should I use instead and how would I do it in this code: import pygame from pygame.locals import * from OpenGL.GL import * from OpenGL.GLU import * import random """ - A Cube has 8 Nodes/Verticies - 12 Lines

Unable to import opengl.gl in python on macos

自作多情 提交于 2021-02-13 12:40:49
问题 I am using OpenGL to render a scene in python. My code works perfectly fine on windows but, for some reason, I'm having issues when importing opengl.gl on MacOS. The issue arises when calling from OpenGL.GL import ... in both python scripts and the python console. More specifically here is the exact call in my script: from OpenGL.GL import glGenBuffers, glBindBuffer, glBufferData, \ glGenVertexArrays, glBindVertexArray, glEnableVertexAttribArray, glVertexAttribPointer, \ glDrawArrays,

Unable to import opengl.gl in python on macos

耗尽温柔 提交于 2021-02-13 12:40:27
问题 I am using OpenGL to render a scene in python. My code works perfectly fine on windows but, for some reason, I'm having issues when importing opengl.gl on MacOS. The issue arises when calling from OpenGL.GL import ... in both python scripts and the python console. More specifically here is the exact call in my script: from OpenGL.GL import glGenBuffers, glBindBuffer, glBufferData, \ glGenVertexArrays, glBindVertexArray, glEnableVertexAttribArray, glVertexAttribPointer, \ glDrawArrays,

How to test if a 2d point in pygame screen is part of a 3d object in PyOpenGL?

99封情书 提交于 2021-02-10 21:38:34
问题 I am making a game (RPG) in PyOpenGL which I have a crosshair. I want to check if a 3d object is in the crosshair (or detect if it is at a point), which is a 2d overlay. How can I do that? I tried to use screen.get_at() function, but it displays an error "Cannot call on OpenGL surfaces". Also, it is not good because it only detects a colour, not an object (although you can use the colour to determine an object, but what if there are several objects that have the same colour?). This is what I

How to test if a 2d point in pygame screen is part of a 3d object in PyOpenGL?

亡梦爱人 提交于 2021-02-10 21:38:06
问题 I am making a game (RPG) in PyOpenGL which I have a crosshair. I want to check if a 3d object is in the crosshair (or detect if it is at a point), which is a 2d overlay. How can I do that? I tried to use screen.get_at() function, but it displays an error "Cannot call on OpenGL surfaces". Also, it is not good because it only detects a colour, not an object (although you can use the colour to determine an object, but what if there are several objects that have the same colour?). This is what I

numpy.float128 doesn't exist in windows, but is called from OpenGL

青春壹個敷衍的年華 提交于 2021-02-10 20:22:49
问题 I decided to try using OpenGL VBO in Python to improve FPS. I found code, that worked perfectly fine in Linux OS (Ubuntu), but when I tried launching in Windows OS, the code resulted in a message: "GLUT Display callback with (),{} failed: returning None module 'numpy' has no attribute 'float128'" So, I can't run the code specifically on Windows, but because I want to create a cross-platform application, I really need to solve this. I've done a lot of research and only found that numpy

How to rotate a 2D line in PyOpenGL?

社会主义新天地 提交于 2021-02-08 01:28:31
问题 I've written a code to draw a line. Here is the function: def drawLines(): r,g,b = 255,30,20 #drawing visible axis glClear(GL_COLOR_BUFFER_BIT) glColor3ub(r,g,b) glBegin(GL_LINES) #glRotate(10,500,-500,0) glVertex2f(0,500) glVertex2f(0,-500) glEnd() glFlush() Now I'm trying to rotate the line. I'm trying to follow this documentation but can't understand. According to the documentation the rotating function is defined as follows: def glRotate( angle , x , y , z ): I've no z-axis. So I'm

How to rotate a 2D line in PyOpenGL?

泄露秘密 提交于 2021-02-08 01:21:10
问题 I've written a code to draw a line. Here is the function: def drawLines(): r,g,b = 255,30,20 #drawing visible axis glClear(GL_COLOR_BUFFER_BIT) glColor3ub(r,g,b) glBegin(GL_LINES) #glRotate(10,500,-500,0) glVertex2f(0,500) glVertex2f(0,-500) glEnd() glFlush() Now I'm trying to rotate the line. I'm trying to follow this documentation but can't understand. According to the documentation the rotating function is defined as follows: def glRotate( angle , x , y , z ): I've no z-axis. So I'm