After doing some testing it seems like one of my other shaders is interffering with it and its then modifying it back. It seems like all the data is being sent through the geometry shader instead of just the data that I would like, here is the shader code and the initialization of the variables.
shader class
public class Shaderclass {
public int programID;
int vertexShaderID;
int fragmentShaderID;
int geometryShaderID = -1;
public Shaderclass()
{
programID = glCreateProgram();
}
public void attachVertexShader(String name)
{
String vertexShaderSource = FileBuilder.gettext(name);
vertexShaderID = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vertexShaderID, vertexShaderSource);
glCompileShader(vertexShaderID);
if (glGetShaderi(vertexShaderID, GL_COMPILE_STATUS) == GL_FALSE)
{
System.err.println("Unable to create vertex shader:");
dispose();
}
glAttachShader(programID, vertexShaderID);
}
public void attachFragmentShader(String name)
{
String fragmentShaderSource = FileBuilder.gettext(name);
fragmentShaderID = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fragmentShaderID, fragmentShaderSource);
glCompileShader(fragmentShaderID);
if (glGetShaderi(fragmentShaderID, GL_COMPILE_STATUS) == GL_FALSE)
{
System.err.println("Unable to create fragment shader:");
dispose();
}
glAttachShader(programID, fragmentShaderID);
}
public void attachGeometryShader(String name)
{
String geometryShaderSource = FileBuilder.gettext(name);
geometryShaderID = glCreateShader(GL_GEOMETRY_SHADER);
glShaderSource(geometryShaderID, geometryShaderSource);
glCompileShader(geometryShaderID);
if (glGetShaderi(geometryShaderID, GL_COMPILE_STATUS) == GL_FALSE)
{
System.err.println("Unable to create Geometry shader:");
dispose();
}
glAttachShader(programID, geometryShaderID);
}
public void link()
{
glLinkProgram(programID);
if (glGetProgrami(programID, GL_LINK_STATUS) == GL_FALSE)
{
System.err.println("Unable to link shader program:");
dispose();
}
}
public void bind()
{
glUseProgram(programID);
}
public static void unbind()
{
glUseProgram(0);
}
public void dispose()
{
unbind();
glDetachShader(programID, vertexShaderID);
glDetachShader(programID, fragmentShaderID);
glDeleteShader(vertexShaderID);
glDeleteShader(fragmentShaderID);
if(geometryShaderID != -1){
glDeleteShader(geometryShaderID);
}
glDeleteProgram(programID);
}
}
and the coreVBO class
package com.lcass.graphics;
import org.lwjgl.opengl.GL20;
public class CoreVBO {
public static int locationtime,locationbloom,locationtransform, locationzoom, locationrotatepos,locationdimension,locationrotate;
public static int shader_id,vert_id,tex_id,particle_shader,particle_vert,particle_tex,particle_geom;
public static int locationattribtex, locationattribvertex;
public static int location_color;
public static int particle_dimension,particle_time,particleattribvert,particleattribtex,particle_spawn,particle_decay,particle_alpha,particle_size;
private Shaderclass shaderclass,line_shader_class,particle_shader_class;
public CoreVBO(){
shaderclass = new Shaderclass();
shaderclass.attachFragmentShader("./src/shaders/default_frag.frag");
shaderclass.attachVertexShader("./src/shaders/default_vert.vert");
line_shader_class = new Shaderclass();
line_shader_class.attachFragmentShader("./src/shaders/line_frag.frag");
line_shader_class.attachVertexShader("./src/shaders/default_vert.vert");
particle_shader_class = new Shaderclass();
particle_shader_class.attachFragmentShader("./src/shaders/particle_frag.frag");
particle_shader_class.attachVertexShader("./src/shaders/particle_vert.vert");
particle_shader_class.attachGeometryShader("./src/shaders/particle_geom.geom");
particle_shader_class.link();
shaderclass.link();
line_shader_class.link();
shader_id = shaderclass.programID;
vert_id = shaderclass.vertexShaderID;
tex_id = shaderclass.fragmentShaderID;
particle_shader = particle_shader_class.programID;
particle_vert = particle_shader_class.vertexShaderID;
particle_tex = particle_shader_class.fragmentShaderID;
particle_geom = particle_shader_class.geometryShaderID;
locationrotatepos = GL20.glGetUniformLocation(shader_id, "rotpos");
locationtime = GL20.glGetUniformLocation(shader_id, "timein");
locationbloom = GL20.glGetUniformLocation(shader_id, "bloomval");
locationtransform = GL20.glGetUniformLocation(shader_id, "transform");
locationzoom = GL20.glGetUniformLocation(shader_id,"zoom");
locationdimension = GL20.glGetUniformLocation(shader_id,"dimension");
locationrotate = GL20.glGetUniformLocation(shader_id,"rotation");
locationattribtex = GL20.glGetAttribLocation(shader_id,"texin");
locationattribvertex = GL20.glGetAttribLocation(shader_id, "position");
particle_size = GL20.glGetUniformLocation(particle_shader, "size");
particle_dimension = GL20.glGetUniformLocation(particle_shader,"dimension");
particle_time = GL20.glGetUniformLocation(particle_shader,"time");
particle_spawn = GL20.glGetUniformLocation(particle_shader, "spawn");
particle_decay = GL20.glGetUniformLocation(particle_shader, "decay");
particle_alpha = GL20.glGetUniformLocation(particle_shader,"alpha");
particleattribvert = GL20.glGetAttribLocation(particle_shader, "vecin");
particleattribtex = GL20.glGetAttribLocation(particle_shader, "texin");
System.out.println(particle_size);
}
public void bind_shader(){
shaderclass.bind();
}
public void un_bind_shader(){
shaderclass.unbind();
}
public void bind_particle(){
particle_shader_class.bind();
}
public void un_bind_particle(){
particle_shader_class.unbind();
}
public void dispose(){
particle_shader_class.dispose();
line_shader_class.dispose();
shaderclass.dispose();
}
}