Permalink
Browse files

Fixed Shuttering

  • Loading branch information...
1 parent 8c2a57a commit ff4c1133544ce155625be9f00e06bde9d6ed8eb9 Fabián Heredia Montiel committed Apr 25, 2012
Showing with 21 additions and 6 deletions.
  1. +5 −3 Engine/__main__.py
  2. +11 −1 Engine/object.py
  3. BIN Engine/object.pyc
  4. +3 −0 shaders/frag.glsl
  5. +2 −2 shaders/vertex.glsl
View
@@ -18,7 +18,6 @@
##########
# Engine
-print path
print "=== Cargando Engine ==="
if path[0].split("/")[-1] == "Engine": chdir("../")
path.append("./")
@@ -35,6 +34,8 @@
##########
# Funciones Globales
+
+# Initialization of GLUT, GL and Engine
def init():
# Init de GLUT
glutInit(argv)
@@ -70,7 +71,6 @@ def init():
object.create("resources/models/Pejuang_Final.obj", {"id": "player", "pos": [0, 0, 0, 100]})
object.create("resources/models/Pejuang_Final.obj", {"pos": [randint(0,360), randint(0,360), randint(0,360), 100]})
object.create("resources/models/Pejuang_Final.obj", {"pos": [randint(0,360), randint(0,360), randint(0,360), 100]})
- object.create("resources/models/Pejuang_Final.obj", {"pos": [randint(0,360), randint(0,360), randint(0,360), 100]})
# Control de flujo
global nRun, nTime, tick
@@ -83,7 +83,8 @@ def init():
# Main Loop
glutMainLoop()
-
+
+# OpenGL Drawing
def display():
# Clear
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
@@ -111,6 +112,7 @@ def display():
# Pasar a pantalla
glutSwapBuffers()
+# Looping and Scheduling
def idle():
global nRun, nTime, tick
# Scheduling
View
@@ -1,3 +1,4 @@
+# coding=utf-8
from math import *
from random import *
from OpenGL.GL import *
@@ -29,8 +30,9 @@ def __init__(self, resource):
self._prop = {}
self._prop["pos"] = [0.0,0.0,0.0,0.0]
self._prop["vec"] = [0.0,0.0,0.0,0.0]
- self._prop["mass"] = 1.0
+ self._prop["rot"] = [0.0,0.0,0.0]
self._prop["scale"] = 1.0
+ self._prop["mass"] = 1.0
self._prop["health"] = float("inf")
self._prop["forces"] = []
self._prop["res"] = resource
@@ -88,11 +90,19 @@ def getCart(self):
def draw(self):
glPushMatrix()
+ # Posición
glRotatef(self._prop["pos"][0], 1, 0, 0) # phi
glRotatef(self._prop["pos"][1], 0, 1, 0) # theta
glRotatef(self._prop["pos"][2], 0, 0, 1) # gao
glTranslatef(0, 0, self._prop["pos"][3]) # rho
+ # Rotación
+ glRotatef(self._prop["rot"][0], 1, 0, 0)
+ glRotatef(self._prop["rot"][1], 0, 1, 0)
+ glRotatef(self._prop["rot"][2], 0, 0, 1)
+
+ # Escala
+
resourcemanager.get(self._prop["res"]).draw()
glPopMatrix()
View
Binary file not shown.
View
@@ -1,4 +1,7 @@
void main()
{
gl_FragColor = gl_Color;
+
+ // Tone Mapping
+ gl_FragColor *= vec4(1.0, 0.9, 1.0, 1.0);
}
View
@@ -5,11 +5,11 @@ void main()
// Componente Diffuso = Md * Ld * cos(theta)
vec3 nC = normalize(gl_NormalMatrix * gl_Normal);
- vec3 pL = vec3(gl_LightSource[0].position);
+ vec3 pL = gl_ModelViewProjectionMatrix * gl_LightSource[0].position;
vec4 eCL= dot(nC, normalize(pL));
vec4 cD = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse * eCL;
gl_FrontColor = cA + cD;
- gl_Position = ftransform();
+ gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

0 comments on commit ff4c113

Please sign in to comment.