JoeyDewd

Members
  • Content count

    20
  • Joined

  • Last visited

Community Reputation

1216 Excellent

About JoeyDewd

  • Rank
    Member

Personal Information

  1. I've been thinking about something similar; like-minded individuals where each has a certain expertise in a specific field (in your chase technical art) that can help each other wherever possible e.g. in like a skype text chat group with 10 - 15 people or so. I'm quite knowledgeable in OpenGL and could probably use some advice from a technical artist as well from time to time so like an eye for an eye ;)   Send me a private message if you're up for it :)
  2. Great! That'll probably save some headaches in the future
  3. Not at all :) someone should probably update the wiki :p
  4. The text of the font rendering tutorial is incorrect.    Passing GL_ALPHA as the texture's format and internal format parameter is incorrect. What you want instead if pass GL_RED as the texture's format/internal-format and access the .r component from the texture sampling in your shaders like so: outColor = vec4(1, 1, 1, texture(glyphTexture, TexCoords).r);
  5. C++ Primer is a good thourough book on the C++ language together with C++11 features. Do note that the book tries to discuss almost all aspects of the C++ language (most in a brief fashion) together with a large section of the STL. Since it discusses a large portion of the language, it's a good book to read through and then later use it for reference.   If you'd really want to delve into what C++ has to offer and how to use it, it definitely is a good book, but a large read ;) If you just want to create videogames using C++ you're probably better off reading a smaller (more game-oriented) C++ book in my opinion.
  6. Wrong stride: glVertexAttribPointer

    If each of your vertices consists of 5 floats, the stride parameter should be equal to the total size of a single vertex (in this case, 3 positions floats and 2 texture coordinate floats) so 5 * sizeof(GLfloat). The last parameter defines the offset for each vertex attribute within a single vertex. The positions are at the start of each vertex so the offset is NULL. However, the texture coordinates start after the 3rd float of your data per vertex so its offset should be 3 * sizeof(GLfloat). This is all assuming your vertex data is tightly packed.   Your code should then look like this: glEnableVertexAttribArray(shaderProgram.vertexAttribute); glVertexAttribPointer(shaderProgram.vertexAttribute, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), NULL); glEnableVertexAttribArray(shaderProgram.uvAttribute); glVertexAttribPointer(shaderProgram.uvAttribute, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)(3 * sizeof(GLfloat)); Note that if your data is tightly packed, you could also set the stride equal to 0, after which OpenGL will figure out the stride itself, but in my opinion its usually best to specify it explicitly so you won't get any surprises.
  7. You need to multiply your light position with only the view matrix. Multiplying it with gl_ModelViewMatrix multiplies it with both the model and view matrix, which is not correct. Unfortunately I'm not too familiar with pre 3.3 OpenGL. I searched it up and it seems you can't retrieve just the view matrix in GLSL which makes doing lighting calculations like this quite cumbersome if I'm honest. Maybe someone else knows how to retrieve the view matrix pre 3.3?    If definitions like world space, view/camera space sounds confusing to you I suggest you look up a tutorial or article about OpenGL's coordinate systems; once you get the hang of the different spaces, lighting becomes much eassier to understand :)
  8. Your lightPos variable is in world space e.g. a position in the global world, while your normal and vertexPos are in view space e.g. as seen from the viewer. Because you're doing calculations on variables that are in different spaces you get wrong results.  You should transform your lightPos vector to view space as well by multiplying this with the view matrix of your scene to get it to the view space.