Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

787 Good

About jeff8j

  • Rank
  1. jeff8j

    GLSL frag shader position not set

    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); glBindVertexArray(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?
  2. jeff8j

    GLSL frag shader position not set

    It seems like I need something like this glBegin(GL_QUADS); glTexCoord2f(0, 0);glVertex2f(0, 0); glTexCoord2f(1, 0);glVertex2f(100, 0); glTexCoord2f(1, 1);glVertex2f(100, 100); glTexCoord2f(0, 1);glVertex2f(0, 100); glEnd(); but not fixed pipeline
  3. jeff8j

    GLSL frag shader position not set

    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 glEnableVertexAttribArray(1); glBindBuffer(GL_ARRAY_BUFFER, uvbuffer); glVertexAttribPointer( 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]
  4. jeff8j

    GLSL frag shader position not set

    @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 http://www.opengl-tutorial.org/beginners-tutorials/tutorial-5-a-textured-cube/
  5. jeff8j

    GLSL frag shader position not set

    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 http://www.opengl-tutorial.org/beginners-tutorials/tutorial-2-the-first-triangle/   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
  6. jeff8j

    GLSL frag shader position not set

    My vertex shader has gl_position gl_Position    = gl_ModelViewProjectionMatrix * gl_Vertex; Is that the same thing I am looking for can I use it instead of texture coordinates?
  7. jeff8j

    GLSL frag shader position not set

    I dont have a texture so I guess I'm not that must be what im missing what would I use to upload the coordinates?
  8. jeff8j

    GLSL frag shader position not set

    I set a position because its different on gles so I have a if gles do this else do what its doing now   I have changed it to not include that but it doesnt change the output :( // fragment shader void main(){ // Calculate distance to center float d = distance(gl_TexCoord[0].xy, vec2(0.5, 0.5)); vec3 color = vec3(0.0,0.0,0.0); color += d; gl_FragColor = vec4(color, 1.0); } Its still the same uniform grey
  9. jeff8j

    GLSL frag shader position not set

    I created this simpler frag shader to help visualize and narrow down the issue // fragment shader vec4 position = gl_TexCoord[0]; void main(){ // Calculate distance to center float d = distance(position.xy, vec2(0.5, 0.5)); vec3 color = vec3(0.0,0.0,0.0); color += d; gl_FragColor = vec4(color, 1.0); } Heres how shader maker looks versus my program the shader maker one is the circle  
  10. I created a shader in shader maker it works great when I go to add it into my program it wasnt working and I believe to have narrowed it down to the position is not being set I use this to set my position vec4 position = gl_TexCoord[0]; and I just copied shader makers vertex // simple vertex shader void main() { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; gl_FrontColor = gl_Color; gl_TexCoord[0] = gl_MultiTexCoord0; } I can manually set the gl_FragColor and that works just fine the rectangles color will change I dont know if there is something that I have to enable or initialize for gl_Texcoord does someone know what I am missing or doing wrong? I am using c on linux glx window gl 3.3 Thanks
  11. jeff8j

    GLSL simple shader help

    Thats nice still doesnt make it useful does it?
  12. jeff8j

    GLSL simple shader help

    I do leave all my posts this one on the other hand was not post worthy I posted late at night without thinking clearly There is no solution other than me thinking clearly I only confused myself when writing it so im sure it will confuse others I was hoping it would die but got put back up
  13. jeff8j

    GLSL simple shader help

    Do not bring up old issues that I posted without enough thought its rude. I would gladly delete if there were an option but I cannot find it
  14. Can someone help me make lines pointing out from the center like this shader as a fragment shader https://www.shadertoy.com/view/lslGzr I would like to make them spin but getting them would be a great step   I am trying to think of a way to do this but I have just started and need some help I would think I can get the angle from the center for each fragment if its a certain angle make it a color how can I determine the angle from the center?
  15. jeff8j

    Live filesystem changes

    bittorrent sync allows me to use my drive so im not limited to space anything less than 5gb is too small 10gb may do theres alot of different versions for testing that take alot of extra space the game sits at around 350mb though   bittorrent sync seems to be ideal perfect fit for what were doing
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!