Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

636 Good

About cebugdev

  • Rank

Personal Information

  • Role
  • Interests

Recent Profile Visitors

10230 profile views
  1. i ported the line rendering using triangles from the site bellow to OpenGL (desktop) and/or ES (in C++) https://hypertolosana.wordpress.com/2015/03/10/efficient-webgl-stroking/ original source (in javascript) https://hypertolosana.github.io/efficient-webgl-stroking/playground.js basically it just draw and create a line based from points and render a traingle based (GL_TRIANGLES) lines. now my question is, how do i get to compute the texture coordinates for it? im more confuse specially on the join part? Do you guys have any suggestions?
  2. hi, i am using stbi_load library since it is so lightweight, all we need to include is a header file, so i can easily port it to mobile (OpenGL ES), but i have discovered that it does not load TIFF with JPEG compression, are there any other alternative image loader that can load TIFF (with JPEG compression)? Im planning to use TIFF(with JPEG) as the textures to my 3d objects because of its size which is more than half of that PNGs.
  3. Hi, I was studying making bloom/glow effect in OpenGL and following the tutorials from learnopengl.com and ThinMatrix (youtube) tutorials, but i am still confuse on how to generate the bright colored texture to be used for blur. Do I need to put lights in the area of location i want the glow to happen so it will be brighter than other object in the scene?, that means i need to draw the scene with the light first? or does the brightness can be extracted based on how the color of the model was rendered/textured thru a formula or something? I have a scene that looks like this that i want to glow the crystal can somebody enlighten me on how or what the correct approach is? really appreciated!
  4. since our game is p2p, one vs one game, we are planning to implement our game in a peer to peer manner wherein there is no central game server but instead the users will just host it on his phone and the challenger will just connect to his him thru sockets. There will be a central database to handle stats, authentication, etc. (implemented thru firebase). more or less looks like this So here are the flow in a nutshell. 1. when user logs in to the game, his IP address will be logged in the firebase database. 2. the user is presented with a list of users online to challenge. when use clicks on a player, the user issues a challenge. when the challenged player accepts the challenge, the user connects to him directly. Now, my issue. This works if both or all users are in the same network since their IP will be unique, but if say for example, we are playing across internet, there is a chance that 1 or two users will have the same IP (when using public IP) when two players are in the same network (ex: office wifi) Situation 1: both user1 and user2 uses mobile data, both of them has public IP (no issue) Situation 2: user1 uses mobile data, user2 uses office wifi, user2 shared the same public IP to his officemate. user1 and user2 play against each other with no issue, but what happen if, say user3 who shares the same wifi with user2 also wants to connect and challenge somebody in the game, he uses the same IP address therefore there is an issue if we somebody needs to connect to that IP address since two users share the same public IP. Also, to help the discussion we are using native (linux) sockets in C++ in both iOS and Android. Any tips on how to handle this? How does applications working with peer to peer handle this?
  5. a simple assignment such as bellow int main() { double variable = 1.4; double value = variable; return 0; } the value of both variable and value is 1.399999999999999 Why is this? BUT when setting this double value = 1.5; Gives correct result!! why? Any idea on how to resolve this or atleast a workaround?
  6. Hi all, I know that most inverted texture issue is because of inverted coordinate system but this case maybe different. so here are the facts. 1. I am rendering a 2D sprite using a quad and a texture in orthographic projection. I was just following the code from learnopengl.com here https://learnopengl.com/In-Practice/2D-Game/Rendering-Sprites have a look at initRenderData() void SpriteRenderer::initRenderData() { // Configure VAO/VBO GLuint VBO; GLfloat vertices[] = { // Pos // Tex 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f }; ... } Please take note that this was rendered in orthographic projection, which means the coordinates of this quads are in screenspace (top left are 0,0 and bottom right are width,height) and please observed the texture coordinate as well, instead of 0,0 at the bottom left, with width, height at top right the coordinates is inverted instead. SO if we are using orthographic projection, does this mean texture coordinates are inverted as well? Is this assumption correct? 2. When rendering this quad straight, everything is OK and rendered with proper orientation void Sprite2D_Draw(int x, int y, int width, int height, GLuint texture) { // Prepare transformations glm::mat4 model = glm::mat4(1.0f); //initialize to identity // First translate (transformations are: scale happens first, // then rotation and then finall translation happens; reversed order) model = glm::translate(model, glm::vec3(x, y, 0.0f)); //Resize to current scale model = glm::scale(model, glm::vec3(width, height, 1.0f)); spriteShader.Use(); int projmtx = spriteShader.GetUniformLocation("projection"); spriteShader.SetUniformMatrix(projmtx, projection); int modelmtx = spriteShader.GetUniformLocation("model"); spriteShader.SetUniformMatrix(modelmtx, model); int textureID = spriteShader.GetUniformLocation("texture"); glUniform1i(textureID, 0); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, texture); glBindVertexArray(_quadVAO); glBindBuffer(GL_ARRAY_BUFFER, _VBO); glEnableVertexAttribArray(0); glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), (GLvoid*)0); glDrawArrays(GL_TRIANGLES, 0, 6); glBindBuffer(GL_ARRAY_BUFFER, 0); } draw call glClearColor(0.2f, 0.3f, 0.3f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); //display to main screen Sprite2D_Draw(0, 0, 500, 376, _spriteTexture); result BUT when rendering that image into a frame buffer, the result is inverted! here is the code #if 1 frameBuffer.Bind(); glClearColor(0.2f, 0.3f, 0.3f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); //... display backbuffer contents here //draw sprite at backbuffer 0,0 Sprite2D_Draw(0, 0, 1000, 750, _spriteTexture); //----------------------------------------------------------------------------- // Restore frame buffer frameBuffer.Unbind(SCR_WIDTH, SCR_HEIGHT); #endif glClearColor(0.2f, 0.3f, 0.3f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); //display to main screen Sprite2D_Draw(0, 0, 500, 376, frameBuffer.GetColorTexture()); result, why? for reference here is the FBO code int FBO::Initialize(int width, int height, bool createDepthStencil) { int error = 0; _width = width; _height = height; // 1. create frame buffer glGenFramebuffers(1, &_frameBuffer); glBindFramebuffer(GL_FRAMEBUFFER, _frameBuffer); // 2. create a blank texture which will contain the RGB output of our shader. // data is set to NULL glGenTextures(1, &_texColorBuffer); glBindTexture(GL_TEXTURE_2D, _texColorBuffer); glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, _width, _height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL ); error = glGetError(); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // 3. attached our texture to the frame buffer, note that our custom frame buffer is already active // by glBindFramebuffer glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, _texColorBuffer, 0 ); error = glGetError(); // 4. we create the depth and stencil buffer also, (this is optional) if (createDepthStencil) { GLuint rboDepthStencil; glGenRenderbuffers(1, &rboDepthStencil); glBindRenderbuffer(GL_RENDERBUFFER, rboDepthStencil); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, _width, _height); } error = glGetError(); // Set the list of draw buffers. this is not needed? //GLenum DrawBuffers[1] = { GL_COLOR_ATTACHMENT0 }; //glDrawBuffers(1, DrawBuffers); // "1" is the size of DrawBuffers error = glGetError(); if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { return -1; } // Restore frame buffer glBindFramebuffer(GL_FRAMEBUFFER, 0); return glGetError();; } void FBO::Bind() { // Render to our frame buffer glBindFramebuffer(GL_FRAMEBUFFER, _frameBuffer); glViewport(0, 0, _width, _height); // use the entire texture, // this means that use the dimension set as our total // display area } void FBO::Unbind(int width, int height) { glBindFramebuffer(GL_FRAMEBUFFER, 0); glViewport(0, 0, width, height); } int FBO::GetColorTexture() { return _texColorBuffer; } this is how it was initialized FBO frameBuffer; frameBuffer.Initialize(1024, 1080); spriteShader.Init(); spriteShader.LoadVertexShaderFromFile("./shaders/basic_vshader.txt"); spriteShader.LoadFragmentShaderFromFile("./shaders/basic_fshader.txt"); spriteShader.Build(); hayleyTex = LoadTexture("./textures/smiley.jpg"); Sprite2D_InitData(); Any one knows what is going on in here?
  7. hi all, i am trying to implement a textbox with scroll where you can display as many text as you can and just use the scroll bar to see the rest of the image, same as to how listbox works, etc I have implemented this using 2D SDL by displaying the messages in an extra framebuffer/texture and just bitBlk the portion of it to the main screen depending on offset. I am porting my 2D SDL code to straight OpenGL ES 2.0 by creating extra framebuffer(FBO) and render to texture, now my question is how to select a portion of that texture to be rendered only in OpenGL ES 2.0 (more like how is bitblk can be implemented in OpenGL ES 2.0)? I was thinking to using scissors but im not sure if this is the right solution. Also, I am using OpenGL ES 2.0 (Mobile) so not all libraries from desktop OpenGL is available. In Summary 1. How to do bitblk in OpenGL ES.0 for textures rendered in orthographic projection (2D)?
  8. Hi, ive been wondering how to texture a GL_LINES in OpenGL, the thing is im using OpenGL ES 2.0, so it may be possible for desktop OpenGL 3.3+ but im not sure if it is possible to texture a line in OpenGL ES 2.0
  9. originally, i just use GL_LINE_STRIP to render lines and it has been evident in different device the difference in width of the lines, plus i cannot texture it! so i decided to use triangles to render my lines so i can have control on its width and add some textures,, i can already convert a line segment based from two given points, or two lines using 3 points using textured quad, I want to do the joints of these quads next, since the app needs to draw using the mobile touchscreen, so it is fitting to have a circular cap/joints instead of those pointy joints. I saw some lessons and tutorials and they suggest as simple as adding a circle in the joint end, is that really how simple it is done? Let me know if you guys have any tips and further suggestions, or link to a source/tutorial (OpenGL/OGL ES). much appreciated!
  10. 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!
  11. 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?
  12. 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!
  13. 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
  14. 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?
  15. 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?
  • 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!