Hey everybody im currently rewriting my game from an engine into opengl and pygame and im not sure how to use opengl with pygame
here is what i have done so far =)

from sys import path,exit,argv ; path += ['.']
import wave, pymedia.audio.sound as sound
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
from os import environ
import pygame, frk
pygame.init()

class Gui:
    def __init__(self,bg,f_caption,icon):
        self.bg = pygame.image.load(bg)
        environ["SDL_VIDEO_CENTERED"] = "1"
        self.screen = pygame.display.set_mode(self.bg.get_size())
        pygame.display.set_caption(f_caption,"hello")
        pygame.display.set_icon(pygame.image.load(icon))
        self.res = self.bg.get_rect()
        bsnd = wave.open('data/bsnd.wav', 'rb')
        scroll = wave.open('data/scroll1.wav', 'rb')
        self.bsnd = sound.Output(bsnd.getframerate(),bsnd.getnchannels(),sound.AFMT_S16_BE) ; #self.bsnd.setVolume(3500)
        self.bsnd_n = bsnd.readframes(-1) ; self.play_sound = [1,None]
        self.scroll = sound.Output(scroll.getframerate(),scroll.getnchannels(),sound.AFMT_S16_BE)
        self.scroll_n = scroll.readframes(-1)

        self.wait = 1 ; self.moves = 0
        self.yextra = 0
        ##
        self.font = pygame.font.Font("data/font.ttf", 40)
        self.exit = self.font.render("Exit", 0,(255,255,255))
        self.exit_over = self.font.render("Exit",0,(255,127,80))
        self.start = self.font.render("Start",0,(255,255,255))
        self.start_over = self.font.render("Start",0,(255,127,80))
        self.credit = self.font.render("Credits and info",0,(255,255,255))
        self.credit_over = self.font.render("Credits and info",0,(255,127,80))
        ##
    def draw(self):
        self.screen.blit(self.bg,self.res)
        self.screen.blit(self.exit,(25,self.res[3]-75))
        self.screen.blit(self.credit,(25,self.res[3]-150))
        self.screen.blit(self.start,(25,self.res[3]-225-self.yextra))
    def print_credits(self):
        pygame.display.update(self.screen.blit(pygame.font.Font("data/font.ttf", 27).render("This is a fps game that is fully",0,(255,255,255)),(25,self.res[3]-360)))
        pygame.display.update(self.screen.blit(pygame.font.Font("data/font.ttf", 27).render("coded by me using pygame and opengl",0,(255,255,255)),(25,self.res[3]-320)))
        pygame.display.update(self.screen.blit(pygame.font.Font("data/font.ttf", 27).render("thanks Friktion/me for the coding =)",0,(255,255,255)),(25,self.res[3]-280)))
        pygame.display.update(self.screen.blit(pygame.font.Font("data/font.ttf", 27).render("Bulldozza for some of the graphics",0,(255,255,255)),(25,self.res[3]-240)))
        pygame.display.update(self.screen.blit(pygame.font.Font("data/font.ttf", 27).render("and Benii/wavegraphics for the graphics!",0,(255,255,255)),(25,self.res[3]-200)))
    def init_col(self,event):
        exit = self.exit.get_rect() ; self.col(exit,75,pygame.mouse.get_pos(),self.exit,self.exit_over,0,event)
        credit = self.credit.get_rect() ; self.col(credit,150,pygame.mouse.get_pos(),self.credit,self.credit_over,1,event)
        if self.moves:
            self.yextra = frk.nr.increase(-100,-10,self.yextra)
            self.draw()
            if self.yextra > 187:
                self.moves = 0
                self.wait = 1
                self.print_credits()
        start = self.start.get_rect() ; self.col(start,225+self.yextra,pygame.mouse.get_pos(),self.start,self.start_over,2,event)
    def col(self,rect,ypos,mpos,normal,over,snum,events=0):
        press = pygame.mouse.get_pressed()
        if mpos[0] > 25 and  mpos[0] < 25+rect[2] and mpos[1] > self.res[3]-ypos and mpos[1] < rect[3]+self.res[3]-ypos:
            self.screen.blit(over,(25,self.res[3]-ypos))
            if self.play_sound[0]:
                self.play_sound[1] = snum
                self.play_sound[0] = 0
                self.bsnd.stop() ; self.bsnd.play(self.bsnd_n)
            if events.type == pygame.MOUSEBUTTONDOWN and normal == self.exit:
               " Gui.bsnd.setVolume(-1) "; pygame.quit() ; exit()
            elif events.type == pygame.MOUSEBUTTONDOWN and normal == self.start:
                # here is the start thingy this executes when start is pushed
                # as you can se im initalizing fpsgame class that is currently empty -.-
                Game = fpsGame()
            elif events.type == pygame.MOUSEBUTTONDOWN and normal == self.credit:
                if self.yextra == 0 and self.moves == 0:
                    self.moves = 1
                    self.wait = 0
                    self.scroll.play(self.scroll_n)
                elif self.moves == 0 and self.yextra >= 187:
                    self.yextra = 0
                    self.moves = 0
                    self.wait = 1
                    self.draw()
        else:
            self.screen.blit(normal,(25,self.res[3]-ypos))
            if self.play_sound[1] == snum:
                self.play_sound[0] = 1



class fpsGame:
    def __init__(self):
        # the opengl game should be here =)
        pass
            

if __name__ == "__main__":
    Gui = Gui("data/back/back.png","Everproof Gui","data/icon.png")
    clock = pygame.time.Clock()
    Gui_running = 1 ; Game_running = 0 ; load = 1
    Gui.draw()
    while Gui_running:
        if Gui.wait:
            events = pygame.event.wait()
        else:
            events = pygame.event.poll()
            clock.tick()
        if events.type == pygame.QUIT:
            pygame.quit() ; exit()
        Gui.init_col(events)
        pygame.display.flip()

here is the game source with the sound file and the bg
http://dl.getdropbox.com/u/1536427/game.zip
and well could soembody just make it work with opengl and coment it for me just make somehting like simple shapes come up when start is pushed
im really sorry for the comment less code -.- just ask me and ill answer as fast as possible
thanks for u that is going to help me =)

someone please i need help on this =/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.