Jump to content
  • Advertisement

cebugdev

Member
  • Content count

    225
  • Joined

  • Last visited

Community Reputation

635 Good

About cebugdev

  • Rank
    Member

Personal Information

  • Role
    Programmer
  • Interests
    Programming

Recent Profile Visitors

9791 profile views
  1. Hi, we are planning to contract a 3rd party art provider to work on our games, we have already secured the funding and budget, however since this is our first rodeo ride with 3rd party doing assets for us, can you guys give advice on how to handle such things? 1. Will they take credits to the game as well or not? maybe arrange special discount that they will be included in the credits for a certain discount or something? 2. can they use their art as portfolio to their company as well or not? I know that most of the answer will be "depends on your contract or agreement" but what would be the best scenario/contract/agreement for this. Any professional advice is a great help! Thanks!
  2. Hi guys, we are working on a game right now, our engine is using OpenGL ES 2.0, and we want to establish a Pokemon Go style map where a 3D character walks around a 3D map via GEO location, Let me know some tips on how to do this using native Android and OpenGL ES. Do I use the default map API or should i re-render the maps in 3D? is there any tutorial, resources, books, links that discusses how to do this?
  3. hi all, how to implement this type of effect ? Also what is this effect called? this is considered volumetric lighting? what are the options of doing this? a. billboard? but i want this to have the 3D effect that when we rotate the camera we can still have that 3d feel. b. a transparent 3d mesh? and we can animate it as well? need your expert advise. additional: 2. how to implement things like fireball projectile (shot from a monster) (billboard texture or a 3d mesh)? Note: im using OpenGL ES 2.0 on mobile. thanks!
  4. i'd like to have a little control on how the lines will be rendered, ex: texturing it or adding a glow, ive been around the thread also in gamedev.net and they suggested that to have a full control in rendering we will not use the default GL_LINES but instead rendered it as triangles, I cant find any tutorials on how to do this or atleast a sample, can you guys give me a code snippet on how to do this? what i have right now are points rendered using GL_LINES and pairs of X,Y screen coordinates (ortho/2d projection) from mouse click. example, (0,0) (10,10), (10,10), (20,20), ... if you guys can point me to any tutorials, code snippets, please do i want to achieve line like this (drawn using mouse): https://www.gamedev.net/uploads/monthly_2017_11/S2.png.202e4f4c3d4255fe5ded81438a6e79b7.png
  5. cebugdev

    opengl es texturing line

    if that's the case, can you guys point me to any resources or tutorials on how to render lines as triangles efficiently without using so m any vertices?
  6. i have an application that allows drawing thru touch just like paint and using opengl es (mobile), currently, the line is just drawing with simple/default line style of opengl using GL_LINE_STRIP, i want to have different pen style on it, just like attached, so my question, is it possible to texture an opengl Line (GL_LINE_STRIP) so i can achieve my desired effect (see attached)? i know its possible to texture an OpenGL point via point sprite, but i have not found anything related to texturing an opengl Line. is this possible?
  7. Hi all, im loading an FBX file using Assimp and everything is OK including the animation but there is one certain FBX file that seems that the other meshes are not in the proper place. see attached screenshot (not align mesh.png), the correct ones should be the blades should be on the side of the character and not going thru its center. i have used assimp viewer and load and view the FBX file can it can be loaded and viewed correctly, which means Assimp can load the FBX format properly. Assimp Viewer output: the FBX file has 4 meshes, all the other 3 mesh including the entire body mesh has been positioned correctly except for the second mesh (index 1) which is the blade. I have been going thru my code again and again and can't find the problem, what could have i missed? here is my assimp loader code (without the animation and bone processing part as this problem happen with static mesh loading) bool AssimpMesh::Load(const std::string& Filename) { CleanUp(); m_pScene = m_Importer.ReadFile(Filename.c_str(), aiProcess_Triangulate | aiProcess_GenSmoothNormals | aiProcess_FlipUVs | aiProcess_JoinIdenticalVertices); bool Ret = false; if (m_pScene) { m_GlobalInverseTransform = AiToGLMMat4(m_pScene->mRootNode->mTransformation); m_GlobalInverseTransform = glm::inverse(m_GlobalInverseTransform); Ret = InitFromScene(m_pScene, Filename); } else { printf("Error parsing '%s': '%s'\n", Filename.c_str(), m_Importer.GetErrorString()); } return Ret; } bool AssimpMesh::InitFromScene(const aiScene* pScene, const std::string& Filename) { m_Entries.resize(pScene->mNumMeshes); m_Textures.resize(pScene->mNumMaterials); // Initialize the meshes in the scene one by one for (unsigned int i = 0; i < pScene->mNumMeshes; i++) { m_Entries[i].MaterialIndex = pScene->mMeshes[i]->mMaterialIndex; m_Entries[i].NumIndices = pScene->mMeshes[i]->mNumFaces * 3; const aiMesh* paiMesh = pScene->mMeshes[i]; std::vector<glm::vec3> Positions; std::vector<glm::vec3> Normals; std::vector<glm::vec2> TexCoords; std::vector<unsigned int> Indices; std::vector<VertexBoneData> Bones; Bones.resize(pScene->mMeshes[i]->mNumVertices); InitMesh(i, paiMesh, Positions, Normals, TexCoords, Bones, Indices); MeshEntry* entry = &m_Entries[i]; glGenVertexArrays(1, &entry->m_VAO); glBindVertexArray(entry->m_VAO); // Create the buffers for the vertices attributes glGenBuffers(ARRAY_SIZE_IN_ELEMENTS(entry->m_Buffers), entry->m_Buffers); // Generate and populate the buffers with vertex attributes and the indices glBindBuffer(GL_ARRAY_BUFFER, entry->m_Buffers[POS_VB]); glBufferData(GL_ARRAY_BUFFER, sizeof(Positions[0]) * Positions.size(), &Positions[0], GL_STATIC_DRAW); glEnableVertexAttribArray(POSITION_LOCATION); glVertexAttribPointer(POSITION_LOCATION, 3, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ARRAY_BUFFER, entry->m_Buffers[TEXCOORD_VB]); glBufferData(GL_ARRAY_BUFFER, sizeof(TexCoords[0]) * TexCoords.size(), &TexCoords[0], GL_STATIC_DRAW); glEnableVertexAttribArray(TEX_COORD_LOCATION); glVertexAttribPointer(TEX_COORD_LOCATION, 2, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ARRAY_BUFFER, entry->m_Buffers[NORMAL_VB]); glBufferData(GL_ARRAY_BUFFER, sizeof(Normals[0]) * Normals.size(), &Normals[0], GL_STATIC_DRAW); glEnableVertexAttribArray(NORMAL_LOCATION); glVertexAttribPointer(NORMAL_LOCATION, 3, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ARRAY_BUFFER, entry->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, entry->m_Buffers[INDEX_BUFFER]); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(Indices[0]) * Indices.size(), &Indices[0], GL_STATIC_DRAW); glBindVertexArray(0); } if (!InitMaterials(pScene, Filename)) { return false; } return true; } bool AssimpMesh::InitFromScene(const aiScene* pScene, const std::string& Filename) { m_Entries.resize(pScene->mNumMeshes); m_Textures.resize(pScene->mNumMaterials); // Initialize the meshes in the scene one by one for (unsigned int i = 0; i < pScene->mNumMeshes; i++) { m_Entries[i].MaterialIndex = pScene->mMeshes[i]->mMaterialIndex; m_Entries[i].NumIndices = pScene->mMeshes[i]->mNumFaces * 3; const aiMesh* paiMesh = pScene->mMeshes[i]; std::vector<glm::vec3> Positions; std::vector<glm::vec3> Normals; std::vector<glm::vec2> TexCoords; std::vector<unsigned int> Indices; std::vector<VertexBoneData> Bones; Bones.resize(pScene->mMeshes[i]->mNumVertices); InitMesh(i, paiMesh, Positions, Normals, TexCoords, Bones, Indices); MeshEntry* entry = &m_Entries[i]; glGenVertexArrays(1, &entry->m_VAO); glBindVertexArray(entry->m_VAO); // Create the buffers for the vertices attributes glGenBuffers(ARRAY_SIZE_IN_ELEMENTS(entry->m_Buffers), entry->m_Buffers); // Generate and populate the buffers with vertex attributes and the indices glBindBuffer(GL_ARRAY_BUFFER, entry->m_Buffers[POS_VB]); glBufferData(GL_ARRAY_BUFFER, sizeof(Positions[0]) * Positions.size(), &Positions[0], GL_STATIC_DRAW); glEnableVertexAttribArray(POSITION_LOCATION); glVertexAttribPointer(POSITION_LOCATION, 3, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ARRAY_BUFFER, entry->m_Buffers[TEXCOORD_VB]); glBufferData(GL_ARRAY_BUFFER, sizeof(TexCoords[0]) * TexCoords.size(), &TexCoords[0], GL_STATIC_DRAW); glEnableVertexAttribArray(TEX_COORD_LOCATION); glVertexAttribPointer(TEX_COORD_LOCATION, 2, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ARRAY_BUFFER, entry->m_Buffers[NORMAL_VB]); glBufferData(GL_ARRAY_BUFFER, sizeof(Normals[0]) * Normals.size(), &Normals[0], GL_STATIC_DRAW); glEnableVertexAttribArray(NORMAL_LOCATION); glVertexAttribPointer(NORMAL_LOCATION, 3, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ARRAY_BUFFER, entry->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, entry->m_Buffers[INDEX_BUFFER]); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(Indices[0]) * Indices.size(), &Indices[0], GL_STATIC_DRAW); glBindVertexArray(0); } if (!InitMaterials(pScene, Filename)) { return false; } return true; } void AssimpMesh::InitMesh(unsigned int MeshIndex, const aiMesh* paiMesh, std::vector<glm::vec3>& Positions, std::vector<glm::vec3>& Normals, std::vector<glm::vec2>& TexCoords, std::vector<VertexBoneData>& Bones, std::vector<unsigned int>& Indices) { const aiVector3D Zero3D(0.0f, 0.0f, 0.0f); // Populate the vertex attribute vectors for (unsigned int i = 0; i < paiMesh->mNumVertices; i++) { const aiVector3D* pPos = &(paiMesh->mVertices[i]); const aiVector3D* pNormal = &(paiMesh->mNormals[i]); const aiVector3D* pTexCoord = paiMesh->HasTextureCoords(0) ? &(paiMesh->mTextureCoords[0][i]) : &Zero3D; Positions.push_back(glm::vec3(pPos->x, pPos->y, pPos->z)); Normals.push_back(glm::vec3(pNormal->x, pNormal->y, pNormal->z)); TexCoords.push_back(glm::vec2(pTexCoord->x, pTexCoord->y)); } LoadBones(MeshIndex, paiMesh, Bones); // Populate the index buffer for (unsigned int i = 0; i < paiMesh->mNumFaces; i++) { const aiFace& Face = paiMesh->mFaces[i]; assert(Face.mNumIndices == 3); Indices.push_back(Face.mIndices[0]); Indices.push_back(Face.mIndices[1]); Indices.push_back(Face.mIndices[2]); } } void AssimpMesh::Render() { for (unsigned i = 0; i < m_Entries.size(); i++) { const unsigned MaterialIndex = m_Entries[i].MaterialIndex; assert(MaterialIndex < m_Textures.size()); if (m_Textures[MaterialIndex]) { m_Textures[MaterialIndex]->Bind(/*GL_TEXTURE0*/); } MeshEntry* entry = &m_Entries[i]; glBindVertexArray(entry->m_VAO); glDrawElements(GL_TRIANGLES, m_Entries[i].NumIndices, GL_UNSIGNED_INT, (void*)0); glBindVertexArray(0); } } I'm stuck on this one for hours already as it is just basic static mesh loading and i cannot find the problem what could i have missed or overlooked? (I attached the FBX file as well) Hellmech_Priest.FBX
  8. hi guys, are there any books, link online or any other resources that discusses on how to build special effects such as magic, lightning, etc. in OpenGL? i mean, yeah most of them are using particles but im looking for resources specifically on how to manipulate the particles to look like an effect that can be use for games,. i did fire particle before, and I want to learn how to do the other 'magic' as well. Like are there one book or link(cant find in google) that atleast featured how to make different particle effects in OpenGL (or DirectX)? If there is no one stop shop for it, maybe ill just look for some tips on how to make a particle engine that is flexible enough to enable me to design different effects/magic let me know if you guys have recommendations. Thank you in advance!
  9. oh god youre correct, silly me, i originally thought that the last parameter is for the number of data. Thanks man!
  10. im trying to test GL_Line strip by drawing line strips between points and it always starts at 0,0 even i start to draw at the middle of the screen. i simplified my test data to just draw two points but still the same. the result is the line is drawn from 0,0 to any points in my vertices. Im using orthographic projection and pases 2D vectors to my shaders to draw it on 3D, but that is not the concern. here is my non simplified testing: im trying to draw linestrips using mouse, but it always starts at 0,0 Here is the code (the simplified version/first image) float vertices[] = { SCR_WIDTH/2,SCR_HEIGHT/2, SCR_WIDTH,SCR_HEIGHT, }; unsigned int VBO = 0; unsigned int VAO = 0; glGenBuffers(1, &VBO); glGenVertexArrays(1, &VAO); glBindVertexArray(VAO); glBindBuffer(GL_ARRAY_BUFFER, VBO); glBufferData(GL_ARRAY_BUFFER, 4 * sizeof(float), vertices, GL_STATIC_DRAW); glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float), (void*)0); glEnableVertexAttribArray(0); glDrawArrays(GL_LINE_STRIP, 0, 4); Im using OpenGL 3.1 right now on desktop as i am writing a code that will be ported to OpenGL ES 2.0 after i write it in desktop, (android studio is slow so i do my opengl coding in Visual Studio)
  11. the project im working now is not a game, originally everything is rendered in 2D using opengl orthographic projection, inputs are specified a 2D X, Y coordinates in screen space, and it will be positioned there like how UI are positioned in games, it is just lately that they want to put a 3D rotation feature on those 2D elements without breaking the original specification that the user must specify a 2D coordinates to place an object in the screen, since you cannot perform the full rotation specially rotating in Y axis in an orthographic projection, i "enabled" the 3D mode by providing the view and projection matrix while gettinga 2D coordinates as input. hope i explained it clear.
  12. Nevermind, solved it. i set my near clipping plane to 1.0f instead of 0.1f, my old clipping plane is just too close that the object is not visible anymore, everything works fine!
  13. Hi all, a little background, our current opengl based system uses 2D orthographic projection to draw 2D elements into screen like adding images, texts, etc. When adding objects, coordinates are specified in screen coordinates (top left is 0,0 and bottom right is width, height), for the upcoming upgrade, we want to add rotation feature to these objects, however we cant do that using orthographic projection, so what i did is to add a perspective as well as a camera matrix to draw the object in 3D and add rotation, but if we do it in 3D then it takes a 3D coordinate and not the screen space coordinate which is not the specification, so what i did is, accept the 2D X,Y coordinate as input, unProject it and use the result as my new base X, Y coordinate for my object, my problem is i cannot seem to make to make it work here is the code (stripped down for simplicty): // Projection matrix 4:3 ratio glm::mat4 projectionMatrix = glm::perspective(glm::radians(45.0f), 4.0f / 3.0f, 0.1f, 100.0f); // Camera matrix glm::mat4 viewMatrix = glm::lookAt( glm::vec3(0, 0, 5), // Camera is at 0,0,5 in World Space, our triangle is at 0 z axis glm::vec3(0, 0, 0), // and looks at the origin glm::vec3(0, 1, 0) // Head is up (set to 0,-1,0 to look upside-down) ); glm::mat4 model = glm::mat4(1.0f); //identity // sample Rectangle input (X, Y, X2,Y2) in screen space is (0,0,100,100) i set 0 for Z as screen space does not have a Z glm::vec3 un = glm::unProject(glm::vec3(0, 0, 0), viewMatrix, projectionMatrix, viewport); glm::vec3 un_2 = glm::unProject(glm::vec3(100, 100, 0), viewMatrix, projectionMatrix, viewport); // Result // un : un = {x=-0.0552284457 y=-0.0414213315 z=4.90000010 ...} // un_2: un_2 = {x=-0.0414213352 y=-0.0276142210 z=4.90000010 ...} So the plan here is to use the unprojected result to construct a triangle and apply transformation such as rotation without breaking the existing code that accepts 2D space as coordinate. so in summary is accept 2D coordinates and draw a 3D object on that area with transformation. on the above code, it looks like the result is in the near clipping plane and when i draw a rectangle using those points, it is not visible on the screen (camera is at Z=5 position). any idea on how to do this? i know that Z is a player here somewhere but i dont know how. like the Z on the above result is on the near clipping plane, i just want it to be visible on the screen and appear on the specific 2D spot. let me know if you have any ideas on how to work on this black magic of a problem, Thank you in advance
  14. Hi again, thanks to the good advise from the guys on this thread https://www.gamedev.net/forums/topic/692174-opengl-2d-gui-system-question/?tab=comments#comment-5356606 thanks guys! I have my basic 2D GUI working now, buttons, windows/dialogs and sliders are working, now i want to port my scrollbox, listview controls to OpenGL, unfortunately i dont have an idea on how 'clipping' a rendered object works, in 2D canvas such as in 2D SDL or javascript canvas, what i did is for example on listview/listbox control, i draw all items in an offscreen canvas, and just Blit copy the visible area to screen based on the amount it was scrolled. Since i dont think OpenGL has the BlitBlk style of partial rendering a texture/canvas, how should i approach implementing a control such as listview control? Background, i want a 2D GUI control where there will be items inside (like a listview) that hides/clip when scrolled based on scroll value, any tips on how to do this on OpenGL?
  15. hi all, i am trying to build an OpenGL 2D GUI system, (yeah yeah, i know i should not be re inventing the wheel, but this is for educational and some other purpose only), i have built GUI system before using 2D systems such as that of HTML/JS canvas, but in 2D system, i can directly match a mouse coordinates to the actual graphic coordinates with additional computation for screen size/ratio/scale ofcourse. now i want to port it to OpenGL, i know that to render a 2D object in OpenGL we specify coordiantes in Clip space or use the orthographic projection, now heres what i need help about. 1. what is the right way of rendering the GUI? is it thru drawing in clip space or switching to ortho projection? 2. from screen coordinates (top left is 0,0 nd bottom right is width height), how can i map the mouse coordinates to OpenGL 2D so that mouse events such as button click works? In consideration ofcourse to the current screen/size dimension. 3. when let say if the screen size/dimension is different, how to handle this? in my previous javascript 2D engine using canvas, i just have my working coordinates and then just perform the bitblk or copying my working canvas to screen canvas and scale the mouse coordinates from there, in OpenGL how to work on a multiple screen sizes (more like an OpenGL ES question). lastly, if you guys know any books, resources, links or tutorials that handle or discuss this, i found one with marekknows opengl game engine website but its not free, Just let me know. Did not have any luck finding resource in google for writing our own OpenGL GUI framework. IF there are no any available online, just let me know, what things do i need to look into for OpenGL and i will study them one by one to make it work. thank you, and looking forward to positive replies.
  • 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!