NullFunctionError opengl glutInit - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: NullFunctionError opengl glutInit (/thread-2456.html) |
NullFunctionError opengl glutInit - hsunteik - Mar-18-2017 from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * window = 0 # glut window number width, height = 500, 400 # window size def draw(): # ondraw is called all the time glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) # clear the screen glLoadIdentity() # reset position # ToDo draw rectangle glutSwapBuffers() # important for double buffering # initialization glutInit() # initialize glut glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH) glutInitWindowSize(width, height) # set window size glutInitWindowPosition(0, 0) # set window position window = glutCreateWindow("noobtuts.com") # create window with title glutDisplayFunc(draw) # set draw function callback glutIdleFunc(draw) # draw all the time glutMainLoop() # start everything i copied and paste this from the internet to my project,so there should not be any error.I am only 15 years old,so please dont use too much hard to understand or mathematical term in the answer. Why is no one answering me? RE: NullFunctionError opengl glutInit - wavic - Mar-18-2017 Apparently, there is no glutInit in the namespace. There is a hint in the error message to check for glutInit() before calling it. The bottom line. "check for bool(glutInit) before calling" You can do the same calling dir(): if 'glutInit' in dir(): RE: NullFunctionError opengl glutInit - hsunteik - Mar-18-2017 Thanks,let me try it first. I will come back if there is still error. I also heard from another website that glut needs to be downloaded seperately because it does not come with pypl PyOpenGL download. RE: NullFunctionError opengl glutInit - wavic - Mar-18-2017 It's quite possible. This module is big |