Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Jun 2009
Offline Last Active Oct 30 2015 07:00 PM

Posts I've Made

In Topic: GLSL frag shader position not set

19 September 2015 - 02:47 PM

Thank you guys


I was having the hardest time figuring out why the newer shaders with in and outs wasnt working at all then I found a few lines I missed that I didnt think were important

GLuint VertexArrayID;
glGenVertexArrays(1, &VertexArrayID);

Once I got that and set the uvcoordinates I got it working better but my coordinates are off shown in picture

How do I get the correct coordinates?

In Topic: GLSL frag shader position not set

19 September 2015 - 11:14 AM

It seems like I need something like this

    glTexCoord2f(0, 0);glVertex2f(0, 0);
    glTexCoord2f(1, 0);glVertex2f(100, 0);
    glTexCoord2f(1, 1);glVertex2f(100, 100);
    glTexCoord2f(0, 1);glVertex2f(0, 100);

but not fixed pipeline

In Topic: GLSL frag shader position not set

19 September 2015 - 11:10 AM

I am having a problem understanding how  gl_TexCoord[0] gets set I think that tutorial uses a newer shader type than what I have been using

gl_TexCoord[0] is in both the vertex and the frag shaders but no where am I setting it and that tutorial doesnt seem to set it

I am sending uv coordinates now but I think I am just sending them blindly


I create the uv array then send it like this

// 2nd attribute buffer : UVs
glBindBuffer(GL_ARRAY_BUFFER, uvbuffer);
	1,                                // attribute. No particular reason for 1, but must match the layout in the shader.
	2,                                // size : U+V => 2
	GL_FLOAT,                         // type
	GL_FALSE,                         // normalized?
	0,                                // stride
	(void*)0                          // array buffer offset

but nowhere do I see how to set something useful like gl_TexCoord[0]

In Topic: GLSL frag shader position not set

19 September 2015 - 11:00 AM

@MarkS yea I didnt know where those things like gl_MultiTexCoord0, gl_TexCoord[0], gl_Position came from and that apparently the issue I need to send them somehow which I am trying to figure out how to do


@giordi Yea it looks like it works the same way as shader toy but for the desktop so its regular opengl not es/webgl

My current "program" is just a splash screen then after that I will venture into showing a single texture that will update via webkit and go from there

I am handling everything myself x11 opengl in c not glut no glew nothing else

my buffer is just a rectangle

static const GLfloat g_vertex_buffer_data[] = { 
    -0.5f, -0.5f, 0.0f,
    -0.5f, 0.5f, 0.0f,
    0.5f, -0.5f, 0.0f,
    0.5f, 0.5f, 0.0f

I am reading this tutorial and trying to figure out the uv coordinates now


In Topic: GLSL frag shader position not set

19 September 2015 - 10:35 AM

Your assuming a bit too much lol

This is my first shader program my only otheer opengl experience has been 1.5 fixed function and even that was limited experience


I was following this tutorial



got it working got a shader working with colors and took my shader from shader maker and must have jumped some steps I figured since I am not using a texture I didnt need all that


I will look into the textured tutorial and learn some more and see about uv coordinates