pyopengl

How to rotate a 2D line in PyOpenGL?

孤者浪人 提交于 2021-02-08 01:20:13
问题 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

Looking for a simple OpenGL (3.2+) Python example that uses GLFW [closed]

僤鯓⒐⒋嵵緔 提交于 2021-02-07 06:25:09
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . Improve this question I am looking for a simple modern OpenGL (3.2+)example in Python. I tried with GLUT and freeGLUT, but I am not able to get a 3.2 context on OS X (Mavericks). (This seems to be a known issue with GLUT/freeGLUT). GLFW seems to be a modern lightweight alternative to

Why is my OpenGL program unable to load the GLUT bitmap fonts?

筅森魡賤 提交于 2021-02-05 08:43:07
问题 I want to display some simple text on the HUD of my 3D environment in OpenGL. All sources say that I should use the bitmap fonts included in GLUT, however, my program can't seem the find/load the fonts. I have included all of the correct libraries and have double checked that the fonts.py file is definitely in the ...\Python37\...\OpenGL\GLUT\ directory, but when I type GLUT_BITMAP_TIMES_ROMAN_24 (or any of the other bitmap fonts), it is highlighted as an error in my code. This is the

Pyopengl reading obj file

て烟熏妆下的殇ゞ 提交于 2021-01-29 01:58:45
问题 I tried to read obj file with pyopengl but error come from glGenList(1) I just want to read the file and display in opengl Pls can you help me with full code; Am tired of stack and error it took me 3hrd to post this from OpenGL.GL import * from tkinter import messagebox import sys filename = input('pls input file path: ') class OBJ: def __init__(self, filename, swapyz=False): """Loads a Wavefront OBJ file. """ self.vertices = [] self.normals = [] self.texcoords = [] self.faces = [] material =

Is there a way to change the location and size of an imported .obj file in Pygame?

北慕城南 提交于 2021-01-28 03:25:54
问题 I created an .obj file using blender and loaded into Pygame using the OBJfileloader as sugested by skrx in: Error in OBJFileLoader Is there an easy way to change the location, height and width of the imported .obj file after importing it into Pygame? As an example, if you create a tree.obj file, to be able to place that same tree in different places with different sizes? Following the code below, maybe something like: object_obj = OBJ("Tree.obj", swapyz=False) object_obj.setX = 0 object_obj

PyOpenGL how do I import an obj file?

北城以北 提交于 2021-01-13 09:59:33
问题 import pygame import OpenGL from pygame.locals import * from OpenGL.GL import * from OpenGL.GLU import * import pywavefront scene = pywavefront.Wavefront('Handgun_obj.obj') vertices =( (1,-1,-1), (1,1,-1), (-1,1,-1), (-1,-1,-1), (1,-1,1), (1,1,1), (-1,-1,1), (-1,1,1), ) edges = ( (0,1), (0,3), (0,4), (2,1), (2,3), (2,7), (6,3), (6,4), (6,7), (5,1), (5,4), (5,7) ) colors = ( (1,0,0), (0,1,0), (0,0,1), (0,1,0), (1,1,1), (0,1,1), (1,0,0), (0,1,0), (0,0,1), (1,0,0), (1,1,1), (0,1,1), ) surfaces =

PyOpenGL how do I import an obj file?

☆樱花仙子☆ 提交于 2021-01-13 09:58:30
问题 import pygame import OpenGL from pygame.locals import * from OpenGL.GL import * from OpenGL.GLU import * import pywavefront scene = pywavefront.Wavefront('Handgun_obj.obj') vertices =( (1,-1,-1), (1,1,-1), (-1,1,-1), (-1,-1,-1), (1,-1,1), (1,1,1), (-1,-1,1), (-1,1,1), ) edges = ( (0,1), (0,3), (0,4), (2,1), (2,3), (2,7), (6,3), (6,4), (6,7), (5,1), (5,4), (5,7) ) colors = ( (1,0,0), (0,1,0), (0,0,1), (0,1,0), (1,1,1), (0,1,1), (1,0,0), (0,1,0), (0,0,1), (1,0,0), (1,1,1), (0,1,1), ) surfaces =

Texture arrays in OpenGL

淺唱寂寞╮ 提交于 2020-12-06 19:44:23
问题 I am working on a project and I need to use texture arrays to apply textures. I have asked many questions about this, none of which I got an answer I was completely satisfied with (Get access to later versions of GLSL , OpenGL: Access Array Texture in GLSL , and OpenGL: How would I implement texture arrays?) so I'm asking a more broad question to hopefully get a response. Anyways, How would I texture an object in OpenGL (PyOpenGL more specifically, but it's fine if you put your answer in C++)