Shintah

Members
  • Content count

    19
  • Joined

  • Last visited

Community Reputation

109 Neutral

About Shintah

  • Rank
    Member
  1. GLSL and lighting

    You have to calculate lighting in the shaders as well.
  2. 2 GLSL questions

    Not sure how you set things up or which GL version you use but you need to bind the second set of texture coordinates to an attribute in the shader. Then you can pass it from the vertex shader in gl_TexCoord[1] just like you did with gl_TexCoord[0]. When you have your second set you can choose which one to use when you do your texture lookups.
  3. 2 GLSL questions

    If you have two colors, x and y, all mix does is take (1-a)*x + a*y. You can combine colors any way you want and don't have to use the mix function. i.e. x+y, x-y, x*y or whatever gives the result you want. If you have more colors you just have to calculate how much of each color you want and how you want to combine them and write an expression for it. To get another set of texture coordinates you just have to create a new VBO with the new set of coordinates and bind it while drawing just like you did with the first set. Or pack another set into your vertex structure in the VBO you already have. Depending on which way you do things. Hope this helps. Cheers.
  4. C++ int beyond 2,147,483,647?

    If you want arbitrarily big numbers you can use a library like [url="https://mattmccutchen.net/bigint/"]https://mattmccutchen.net/bigint/[/url]
  5. The GLSL spec just says: [quote]Both gl_FragColor and gl_FragData are deprecated; the preferred usage is to explicitly declare these outputs in the fragment shader using the out storage qualifier.[/quote] so I guess it's just magic. Not sure what happens if you declare multiple outputs without using them. In the cases where you actually want more then one color output you have to specify this with glDrawBuffers and/or with layout qualifiers in the GLSL shader. Not entirely sure about all the details so check the GL documentation or glsl spec for more details.
  6. Just took a quick glance at the code but one thing I saw is that you don't enable the vertex attribs with glEnableVertexAttribArray.
  7. Basic DirectX 9 shader tutorial

    You can check out the samples and tutorials that come with the DirectX SDK. MSDN also contain quite a lot of information, [url="http://msdn.microsoft.com/en-us/library/ms810449.aspx"]here[/url] for example.
  8. Maybe you should check out their FAQ. Seems to me they care more about if it's a good game or not rather then how it was made.
  9. VAO problem

    As karwosts said. glVertexAttribPointer((GLuint)0, 3, GL_FLOAT, GL_FALSE, 0, 0); This is wrong I think. You should be passing the location for the attribute in the shader program that is bound, not just an arbitrary int. Use glGetAttribLocation to get the location of an attribute from a shader and use that as argument for glVertexAttribPointer and glEnableVertexAttribArray.
  10. GLSL and looping

    Should be perfectly fine to do it in a loop. Sounds like you get stuck in the loop. Are you sure you break out of it correctly?
  11. As far as I know the compiler removes everything that is not used for optimization. So if you don't pass an attribute along to the next shader stage or do any useful computation with it, it will be removed from the shader during compilation. I'm not a 100% sure about all details, the GLSL spec probably says something about it. Not sure exactly what you mean with your last question. If you don't need some specific data in the next shader stage. Don't pass it along. :) edit: I think I know what you mean now. You don't need to explicitly pass something along to the next stage. If an attribute, blend weights for example, is used to do some meaningful computation in the vertex stage the compiler will not remove it. Only unused attributes might be removed during compilation.
  12. Location of -1 mean that the attribute was not found in the shader. myNormal and myColor is not used in the shader and therefore the shader compiler will remove them from the program. So when you try to get their locations they do not exist. Try and do something usefull with them and it'll probably work again.
  13. Not sure when it was introduced but GLSL 1.5 have a textureGrad function.
  14. I think the UV coords are not necessarily saved in the same order as the vertices. Try the MFnMesh::getPolygonUV or MFnMesh::getPolygonUVid to get the correct UV coords for each vertex.