[PyOpenGL-Users] What is wrong ?
Brought to you by:
mcfletch
From: Cata <cat...@gm...> - 2010-03-01 08:13:40
|
I try to use gluQuadricTexture(g, GL_TRUE) . This is my code : import os import sys import pygame from pygame import * from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * import Image import numpy g= None texture=None def init_display(w, h): pygame.display.set_mode( (w,h) , pygame.OPENGL | pygame.DOUBLEBUF ) glViewport(0, 0, w, h) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glEnable(GL_LIGHTING) glEnable(GL_LIGHT0) glLight(GL_LIGHT0, GL_POSITION,(0.5,0.5,-1.5, 0)) glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(-1, 1, -1, 1); glMatrixMode(GL_MODELVIEW); def draw(): glClearColor(0.0, 0.0, 0.0, 1.0) glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) glColor(0,1,0) try: img = Image.open('13.jpg') except NameError: print "Error load texture" img_data = numpy.array(list(img.getdata()), numpy.int8) texture=glGenTextures(1); glBindTexture(GL_TEXTURE_CUBE_MAP, texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, img.size[0], img.size[1], 0, GL_RGB, GL_UNSIGNED_BYTE, img_data) glPushMatrix(); glEnable(GL_TEXTURE_2D) g=gluNewQuadric() gluQuadricNormals(g, GLU_SMOOTH) gluQuadricTexture(g, GL_TRUE) gluQuadricOrientation(g,GLU_OUTSIDE) gluCylinder(g,0.1,0.1,0.2,8,1) glPopMatrix(); pygame.display.flip() def main(): pygame.init() glutInit() init_display(800, 600) while 1: event=pygame.event.poll () draw() if event.type is KEYDOWN: if event.key is K_ESCAPE: sys.exit(0) main() Is nothing in my scene ... What is wrong with my code ? Thank you . -- My sites: http://tv.free-tutorials.org - video tutorials http://python-catalin.blogspot.com - my python blog |