Skip to main content
fix typo
Source Link
Kylotan
  • 24.3k
  • 3
  • 52
  • 94

Ended up figuring out the answer myself through trial and error, solution follows.

You need to import openGL to get access to the scaling function:

from pgyletpyglet.gl import *

Next, toss in the following code after your game's window has been initialized:

#These arguments are x, y and z respectively. This scales your window.
glScalef(2.0, 2.0, 2.0)

At this point your resolution will double, but your window will stay the same size. You can correct this easily by doubling your window's width and height. Furthermore, your textures will appear blurry, so we need to fix that. We need to set parameters for the textures in your on_draw() function:

def on_draw(self):
        self.clear() #clears the screen
        #The following two lines will change how textures are scaled.
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) 
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
        self.label.draw() #blits the label to the screen

You should now have pixels displaying at double their original size.

Ended up figuring out the answer myself through trial and error, solution follows.

You need to import openGL to get access to the scaling function:

from pgylet.gl import *

Next, toss in the following code after your game's window has been initialized:

#These arguments are x, y and z respectively. This scales your window.
glScalef(2.0, 2.0, 2.0)

At this point your resolution will double, but your window will stay the same size. You can correct this easily by doubling your window's width and height. Furthermore, your textures will appear blurry, so we need to fix that. We need to set parameters for the textures in your on_draw() function:

def on_draw(self):
        self.clear() #clears the screen
        #The following two lines will change how textures are scaled.
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) 
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
        self.label.draw() #blits the label to the screen

You should now have pixels displaying at double their original size.

Ended up figuring out the answer myself through trial and error, solution follows.

You need to import openGL to get access to the scaling function:

from pyglet.gl import *

Next, toss in the following code after your game's window has been initialized:

#These arguments are x, y and z respectively. This scales your window.
glScalef(2.0, 2.0, 2.0)

At this point your resolution will double, but your window will stay the same size. You can correct this easily by doubling your window's width and height. Furthermore, your textures will appear blurry, so we need to fix that. We need to set parameters for the textures in your on_draw() function:

def on_draw(self):
        self.clear() #clears the screen
        #The following two lines will change how textures are scaled.
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) 
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
        self.label.draw() #blits the label to the screen

You should now have pixels displaying at double their original size.

Source Link
Vine
  • 173
  • 3
  • 9

Ended up figuring out the answer myself through trial and error, solution follows.

You need to import openGL to get access to the scaling function:

from pgylet.gl import *

Next, toss in the following code after your game's window has been initialized:

#These arguments are x, y and z respectively. This scales your window.
glScalef(2.0, 2.0, 2.0)

At this point your resolution will double, but your window will stay the same size. You can correct this easily by doubling your window's width and height. Furthermore, your textures will appear blurry, so we need to fix that. We need to set parameters for the textures in your on_draw() function:

def on_draw(self):
        self.clear() #clears the screen
        #The following two lines will change how textures are scaled.
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) 
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
        self.label.draw() #blits the label to the screen

You should now have pixels displaying at double their original size.