Hi there,
Not really sure where to post this, as I don’t feel like I know enough to file a bug report. I looked at the bug reports, and couldn’t really tell if it has been reported yet. This has to do with the way 2D/OrthographicLens is handled in Panda3d. I am trying to plot stuff according to pixel location. It is, of course, possible I am trying to do something I shouldn’t really be able to do, and just got away with it until now. At any rate, I have noticed a difference in the way my code is handled in the latest developers SDK and the latest stable SDK (Windows). If I run the code below on the stable SDK, I get 9 evenly spaced smileys on the screen, but if I run the code on the latest SDK (503), I just get one smiley in the center. This is also true in other recent SDK’s, at least as far back as 496.
from __future__ import division
from direct.showbase.ShowBase import ShowBase
from direct.showbase.DirectObject import DirectObject
from panda3d.core import Point3
from panda3d.core import OrthographicLens
from panda3d.core import WindowProperties
import sys
class World(DirectObject):
def __init__(self):
DirectObject.__init__(self)
self.base = ShowBase()
resolution = (1024, 768)
wp = WindowProperties()
wp.setSize(int(resolution[0]), int(resolution[1]))
wp.setOrigin(0, 0)
self.base.win.requestProperties(wp)
# depth completely doesn't matter for this, since just 2d, and no layers
self.depth = 0
self.base.setBackgroundColor(115/255, 115/255, 115/255)
# set up a 2d camera
camera = self.base.camList[0]
lens = OrthographicLens()
lens.setFilmSize(int(resolution[0]), int(resolution[1]))
lens.setNearFar(-100, 100)
camera.node().setLens(lens)
camera.reparentTo(self.base.render)
self.accept("escape", sys.exit)
# spread out some positions
self.positions = [(-200, 0, -200),
(0, 0, -200),
(200, 0, -200),
(-200, 0, 0),
(0, 0, 0),
(200, 0, 0),
(-200, 0, 200),
(0, 0, 200),
(200, 0, 200)]
self.all_smiles()
def next_smile(self, index):
pos = self.positions[index]
smiley = loader.loadModel('smiley.egg')
smiley.setPos(Point3(pos))
smiley.setScale(20)
smiley.reparentTo(self.base.render)
print smiley.getPos()
def all_smiles(self):
for ind in range(9):
self.next_smile(ind)
if __name__ == "__main__":
W = World()
W.base.run()