2
Is my code right? I’m using Python and Pyglet, as I know if Shader is running, why did I get Shader’s code on the internet:
import pyglet
from pyglet.gl import *
import pyshaders as ps
t = pyglet.window.Window()
v = """
#version 330 core
layout (location = 0) in vec3 aPos;
out vec4 vertexColor;
void main()
{
gl_Position = vec4(aPos, 1.0);
vertexColor = vec4(0.5, 0.0, 0.0, 1.0);
}
"""
f = """
#version 330 core
out vec4 FragColor;
in vec4 vertexColor;
void main()
{
FragColor = vertexColor;
}
"""
shader = ps.from_string(v,f)
@t.event
def on_draw():
glClearColor(1,0,0,1)
glClear(GL_COLOR_BUFFER_BIT)
shader.use()
glBegin(GL_POLYGON)
glColor3f(1,1,1)
glVertex2f(10,10)
glVertex2f(10,50)
glVertex2f(60,70)
glEnd()
def SRO(dt):
on_draw()
pyglet.clock.schedule_interval(SRO, 1/60)
pyglet.app.run()
And yes I know Opengl but I am a beginner in GLSL, I have tested other codes of Shader on the internet but they always give the same thing.
Why was there this change of dimensions that I could draw? Before Shader they worked
– Arthur Sally