Shaders (vertex_submit draw with shaders matrixes)

Discussion in 'Programming' started by Edgamer63, Mar 16, 2019.

  1. Edgamer63

    Edgamer63 Member

    Joined:
    Jan 24, 2018
    Posts:
    45
    Hello, i was wondering on how to draw a vertex buffer, but into another position using a shader matrix (Because drawing with only matrix_world new positions is so bug!, so i think that shaders would solve the problem)... because is to low to do it changing cordinates time by time... also it's 3D and for models made by me with triangle lists :D ... Thank you ;)
     
  2. flyingsaucerinvasion

    flyingsaucerinvasion Member

    Joined:
    Jun 20, 2016
    Posts:
    1,902
    Please elaborate. If your question is whether you can use a time value to control position or orientation from within a shader, the answer is yes.
     
  3. Edgamer63

    Edgamer63 Member

    Joined:
    Jan 24, 2018
    Posts:
    45
    And how can i do it? :/
     
  4. flyingsaucerinvasion

    flyingsaucerinvasion Member

    Joined:
    Jun 20, 2016
    Posts:
    1,902
    What are you trying to do?

    EDIT: Also, what do you mean when you say using the world matrix is bug?
     
    Last edited: Mar 16, 2019
  5. Edgamer63

    Edgamer63 Member

    Joined:
    Jan 24, 2018
    Posts:
    45
    I try to draw a vertex_buffer in another position that has already been defined within the vertex_buffer. And I think that a shader could solve that problem better than using the matrix of gamemaker 1.4, because using matrix_world alaways bug, and they draw very bad.

    So I think that using the special matrixes of the shaders to draw the vertex inside the world in another position, it is possible, but I do not know how :( , and I need help.

    P.S:
    The vertex format is vertex_position_3D and vertex_color.
     
  6. flyingsaucerinvasion

    flyingsaucerinvasion Member

    Joined:
    Jun 20, 2016
    Posts:
    1,902
    In what way is the world matrix bugged?
     
  7. Edgamer63

    Edgamer63 Member

    Joined:
    Jan 24, 2018
    Posts:
    45
    i need to draw more than one matrix_world, to draw diferent positions of many vertex buffers, so it sometimes take other positions and buffers... also because it need to end in a matrix_build(0,0,0,0,0,0,1,1,1) to draw the window properly.

    Yeah, i try to draw the vertexes in a mosaic.
     
  8. flyingsaucerinvasion

    flyingsaucerinvasion Member

    Joined:
    Jun 20, 2016
    Posts:
    1,902
    It's not clear to me what you are talking about.

    It is possible to use shader uniforms to individually position different parts of a single vertex buffer, if that is what you are talking about. But there are two major drawbacks. 1), you have to duplicate data in your vertex buffer. 2), there are a limited number of shader uniform components to work with, which limits how many different instances you can position individually.

    But like I said, it is still not clear to me what problem you are encountering using the world matrix to position things. I suspect either that you are trying to use it incorrectly or you need to explain more fully why it is not sufficient for your needs.

    You mention a mosaic. If you mean a uniform grid pattern, then why isn't the vertex position attribute sufficient to position individual parts?
     
  9. Edgamer63

    Edgamer63 Member

    Joined:
    Jan 24, 2018
    Posts:
    45
    Because the vertex buffers are of larger sizes ... and the matrix_build and submiting does not fill the need to draw it properly, because in a strange way ... the matrixes projects other vertex buffers instead of what i really signaled to draw .... and are not bad programmed :'( .

    So, the normal matrix functions in gamemaker are bugged in this kind of drawing, and i think that a shader drawing will do it correctly. And that's exactly what right now i don't know how to do.
     
  10. flyingsaucerinvasion

    flyingsaucerinvasion Member

    Joined:
    Jun 20, 2016
    Posts:
    1,902
    Are you trying to say that when you use the world matrix, that the problem isn't just that things are drawn in the wrong place, but that entirely the wrong vertices are being drawn? If so, this would be the first time I've ever heard anyone describe this kind of problem in gamemaker. My initial guess is that you've mixed up the pointers of your vertex buffers.
     
  11. Edgamer63

    Edgamer63 Member

    Joined:
    Jan 24, 2018
    Posts:
    45
    Woah! Amazing Research! i wouldn't found that so easy... so thanks :D !
     
  12. flyingsaucerinvasion

    flyingsaucerinvasion Member

    Joined:
    Jun 20, 2016
    Posts:
    1,902
    I'm not sure if you are being sarcastic, or if indeed my guess there got lucky.
     
  13. Edgamer63

    Edgamer63 Member

    Joined:
    Jan 24, 2018
    Posts:
    45

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice