• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

jsmtux

Members
  • Content count

    5
  • Joined

  • Last visited

Community Reputation

235 Neutral

About jsmtux

  • Rank
    Newbie
  1. Hi all, thanks for your time. The code I use to initialize the vaos is: glGenVertexArrays(1, &iVAO); glBindVertexArray(iVAO); glGenBuffers(5, m_Buffers); //here I load the buffers' information and the images glBindBuffer(GL_ARRAY_BUFFER, m_Buffers[POS_VB]); glBufferData(GL_ARRAY_BUFFER, sizeof(Positions[0]) * Positions.size(), &Positions[0], GL_STATIC_DRAW); glEnableVertexAttribArray(0); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ARRAY_BUFFER, m_Buffers[TEXCOORD_VB]); glBufferData(GL_ARRAY_BUFFER, sizeof(TexCoords[0]) * TexCoords.size(), &TexCoords[0], GL_STATIC_DRAW); glEnableVertexAttribArray(1); glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ARRAY_BUFFER, m_Buffers[NORMAL_VB]); glBufferData(GL_ARRAY_BUFFER, sizeof(Normals[0]) * Normals.size(), &Normals[0], GL_STATIC_DRAW); glEnableVertexAttribArray(2); glVertexAttribPointer(2, 3, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ARRAY_BUFFER, m_Buffers[BONE_VB]); glBufferData(GL_ARRAY_BUFFER, sizeof(Bones[0]) * Bones.size(), &Bones[0], GL_STATIC_DRAW); glEnableVertexAttribArray(BONE_ID_LOCATION); glVertexAttribIPointer(BONE_ID_LOCATION, 4, GL_INT, sizeof(VertexBoneData), (const GLvoid*)0); glEnableVertexAttribArray(BONE_WEIGHT_LOCATION); glVertexAttribPointer(BONE_WEIGHT_LOCATION, 4, GL_FLOAT, GL_FALSE, sizeof(VertexBoneData), (const GLvoid*)16); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_Buffers[INDEX_BUFFER]); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(Indices[0]) * Indices.size()*3, &Indices[0], GL_STATIC_DRAW); glBindVertexArray(0); And the code to draw them is: glBindVertexArray(iVAO); glBindBuffer(GL_ARRAY_BUFFER, m_Buffers[POS_VB]); glEnableVertexAttribArray(0); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ARRAY_BUFFER, m_Buffers[TEXCOORD_VB]); glEnableVertexAttribArray(1); glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ARRAY_BUFFER, m_Buffers[NORMAL_VB]); glEnableVertexAttribArray(2); glVertexAttribPointer(2, 3, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ARRAY_BUFFER, m_Buffers[BONE_VB]); glEnableVertexAttribArray(BONE_ID_LOCATION); glVertexAttribIPointer(BONE_ID_LOCATION, 4, GL_INT, sizeof(VertexBoneData), (const GLvoid*)0); glEnableVertexAttribArray(BONE_WEIGHT_LOCATION); glVertexAttribPointer(BONE_WEIGHT_LOCATION, 4, GL_FLOAT, GL_FALSE, sizeof(VertexBoneData), (const GLvoid*)16); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_Buffers[INDEX_BUFFER]); for (unsigned int i = 0 ; i < meshes.size() ; i++) { const unsigned int MaterialIndex = meshes[i].MaterialIndex; if (MaterialIndex < maps.size() && maps[MaterialIndex]) { dynamic_cast<Image*>(maps[MaterialIndex])->Bind(); } glDrawElementsBaseVertex(GL_TRIANGLES, meshes[i].NumIndices, GL_UNSIGNED_INT, (void*)(sizeof(unsigned int) * meshes[i].BaseIndex), meshes[i].BaseVertex); } // Make sure the VAO is not changed from the outside glBindVertexArray(0); And this way it works, but if the VAO weren't invalid It should work like this glBindVertexArray(iVAO); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_Buffers[INDEX_BUFFER]); for (unsigned int i = 0 ; i < meshes.size() ; i++) { const unsigned int MaterialIndex = meshes[i].MaterialIndex; if (MaterialIndex < maps.size() && maps[MaterialIndex]) { dynamic_cast<Image*>(maps[MaterialIndex])->Bind(); } glDrawElementsBaseVertex(GL_TRIANGLES, meshes[i].NumIndices, GL_UNSIGNED_INT, (void*)(sizeof(unsigned int) * meshes[i].BaseIndex), meshes[i].BaseVertex); } // Make sure the VAO is not changed from the outside glBindVertexArray(0);
  2. Thank you very much for your answer. I found out that the vertex array gets invalidated when I call the SFML display function. But I still have no clue about how to fix it or what kind of calls could lead to this behaviour
  3. Hi, I've been having a weird problem for a long time and I hope you can help me.   I'm trying to use VAOs in my engine, I load them and I get no errors, but when I call glBindVertexArray I get error 1282. The weird thing is that in the first iteration of the game loop I don't get that error. So there must be some operation that invalidates the VAO.   The only way I can show things in screen is by calling glEnableVertexAttribArray, glVertexAttribIPointer, glEnableVertexAttribArray, glVertexAttribPointer for every bufferbefore painting as if I hadn't set up the VAO.   Do you have any idea of what is wrong? Thanks
  4. Going on with the problem, if I change my function to this: lua_rawgeti(L, LUA_REGISTRYINDEX, tmp.luaRef); luaL_checktype(L, -1, LUA_TTABLE); return 1; Checktype says that a lua table is on top of the stack, but if I print this return value from lua it says it is a nil value
  5. Hi all, I've been trying to integrate lua into my game but I've been having some difficulties, I hope you can help me because I'm stuck. In my code I create metatables in Lua and store them in c with lua_getglobal(L,newTable); lua_call(L,0,1);//lua creates a new metatable and returns it int luaRef = luaL_ref(L,LUA_REGISTRYINDEX); newTable is a function that creates a new metatable and returns it, then I call it and get the reference from the stack and store it in luaRef Once I have this reference, if I need to call a function  of this metatable from c I do: lua_getglobal(L,name.c_str());//Get the table name lua_getfield(L,-1,"function");//set the function from the table lua_rawgeti(L, LUA_REGISTRYINDEX, luaRef);//set the table object lua_call(L,1,0);//call the function And it works. My problem is that when I try to push this reference back to lua so that I can call these functions I get a My code is int Scripted::LgetObject(lua_State *L){     lua_getglobal(L,name.c_str());     lua_rawgeti(L, LUA_REGISTRYINDEX, tmp.luaRef);     return 1; } and from Lua: object=getObject() object:function() As I understand, the avobe C code pushes de table into the stack, but all lua receibes is a nil value. I've been trying to solve this for days and I don't know what to do next, please point me in the right direction Thanks