Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

204 Neutral

About alx119

  • Rank

Personal Information

  • Role
    Game Designer
  • Interests

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi guys, I was reading an article about colors and functions in GLSL and I saw an exercise to create a colorful flag with step function. My concern is what kind of math do I have to know and how to use it, how to think, whenever I want to create something I want, something like in the image below, or the flag. Thanks in advance!
  2. Hi guys, I'm following the stencil tutorials from learnopengl.com and I tried something and I can't explain why is not working. I might not understood very good the stencil test. So I have a floor and 2 containers and I want to draw a border around containers, like in the tutorial. The code will be: //Before the rendering loop: glEnable(GL_DEPTH_TEST); glEnable(GL_STENCIL_TEST); glStencilFunc(GL_NOTEQUAL, 1, 0xFF); glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); In the rendering loop: //Draw the floor but don't write to stencil buffer glStencilMask(0x00); DrawFloor(); //Draw the 2 containers glStencilFunc(GL_ALWAYS, 1, 0xFF); glStencilMask(0xFF); DrawTwoContainers() //Scale containers for the borders glStencilFunc(GL_NOTEQUAL, 1, 0xFF); glStencilMask(0x00); glDisable(GL_DEPTH_TEST); DrawTheTwoScaledContainers() glStencilMask(0xFF); glEnable(GL_DEPTH_TEST); Well everything is working fine, but at the code where I scale the containers, if I change the GL_NOTEQUAL, with GL_LESS, it draws only the normal containers, but not the borders and not even the floor.The stencil values where the borders should be drawn are 0, so they are not equal and they are less than 1. Why is this happening ? Hope you can help me with an explanation and thanks in advance!
  3. Hi, Thank you for your replies. To be more specifically, if I have made this from the picture in glsl, my question is how do I attach it to a uniform sampler2D texture for my skybox in OpenGL? I hope I made you to understand what I mean. Thanks in advance!
  4. Hello all, I'm working with Opengl for maybe, a future space game and let's say I want to create skybox textures, but I don't want to use photoshop or other tools. Let's say, I want to generate them procedurally. How can I do that, because from what I know, I have to modify all the images per pixel and OpenGL doesn't support this. Or I have to modify an image with, let's say OpenCV and then import them in OpenGL and modify them colors ? Thank you!
  5. Hi, Thank you very much for your help. I will have a look on the video and https://www.uvlayout.com/ when I will need I learned already from https://learnopengl.com/, but until the advanced lighting. And about Unreal engine, I already tried it, but I don't know...I think I gave up because of the blueprints. I tried also with Unity and again..I didn't like it. Or didn't understand them. And I enjoy more to code, because I want to learn better c++. Again, thank you very much for your advice.
  6. Hi, Thank you for your reply. Sorry, I wasn't so clearly in the topic...I would like to learn to make realistic graphics like in the video. I know I have to study how to create textures, bump images, working with lights, PBR etc...so that's why I asked for some very good tutorials / articles. When I need, I use Maya, but not for advanced things. Just simple modelling. About a game engines...I tried to use, but I gave up on them...they don't bring enough satisfaction. So I'm using c++ with opengl.
  7. Hi, I saw these days this game: I would like an advice about what should I study to create graphics like these. If you could provide some articles it would be very helpfully. I could ask for books, but to be honestly I don't have patience and time to read full books. Thank you!
  8. That's what I want to do. I wrote a part from algorithm, but like I said, I'm not sure if I understood it. About Perlin noise, maybe after this I will try it .
  9. My goal is to create clouds, gases, or nebulas for skyboxes. And I don't want to use any softwares. I would like to code them by myself.
  10. Hello, I'm trying to implement in opencv The Diamond Square algorithm, but something is not working. I think I didn't understand exactly the algorithm. https://en.wikipedia.org/wiki/Diamond-square_algorithm 1. When I initialize first the four corners, they must have the same color ? Or different ones ? In my algorithm they have different colors. 2. Then I calculate the midpoint of the square by averaging the square corners(The diamond step). So the midpoint will have a color...let's say red. 3. After this, the corners from the square step (the third image from the link) will be averaged and the value will be contained by the midpoint. But the midpoint will not be the same for the square and for the diamond ? So the final color will be that one from the square step ? What is the point by performing the diamond step ? I'm very confused to be honestly. I tried to search on the internet, but I didn't understand from other websites. It would be nice if someone would explain more clearly, what the colors of the pixels would be. Thank you!
  11. alx119

    .obj file text parsing

    I already did something. I didn't to use the char for the slash. It would have been more easy.:P. Instead I eliminated the slash from the line. Here is my code. if (lineStr[0] == 'f') { std::cout << "LINE STR FACE: " << lineStr << std::endl; for (int i = 0; i < lineStr.length(); i++) { if (lineStr == '/') { lineStr = ' '; } } std::stringstream os; std::string unused; os << lineStr; unsigned int v1, t1, n1, v2, t2, n2, v3, t3, n3; os >> unused >> v1 >> t1 >> n1 >> v2 >> t2 >> n2 >> v3 >> t3 >> n3; //... }
  12. Hi, I'm trying to load an .obj model to OpenGL and I need to parse the file. What I've done until now: v 0.000000 3.897879 -1.378193 v -0.309017 3.856391 -1.352228 vt 0.314607 0.256292 vt 0.226357 0.365001 vn -0.156435 0.837235 -0.523990 vn -0.309017 0.806183 -0.504556 f 13/3/45 14/6/46 24/29/47 f 24/29/47 14/6/46 25/31/48 So for the v / vt / vn the code source is: std::vector<glm::vec3> vertex; std::vector<glm::vec2> texture; std::vector<glm::vec3> normals; std::string lineStr; while (inf) { getline(inf, lineStr); //std::cout << "LINESTR: " << lineStr << std::endl; if (lineStr[0] == 'v' && lineStr[1] == ' ') { std::stringstream os; std::string unsused; double posx, posy, posz; os << lineStr; os >> unsused >> posx >> posy >> posz; std::cout << " Pos X: " << posx << " Pos Y: " << posy << " Pos Z: " << posz << std::endl; vertex.push_back(glm::vec3(posx, posy, posz)); } // The same source code is for vt and vn } It seems that it works. But I have some problems parsing the faces. I don't know exactly how to do it. Well I could use a lot of "if", but I'm not sure if this would be a good idea. Any advices ? Thank you!
  13. alx119

    Importing .OBJ model to OpenGL

    Thank you very much guys, I will give it a try and I will come back if I will have any other problems/questions or when I will finish with it. Thank you! EDIT: Hell Yea! Thank you very much guys!
  14. alx119

    Importing .OBJ model to OpenGL

    Hi, I came back to this topic because I didn't write an model importer yet, because I had something else to do. So today I will start to write it, but first I have a few questions. I was thinking to make a vector for vertices, one for textures, and one for normals and after to interleave the data in a single vector. My object has around ~290 vertices, ~596 vt, and ~570 vn. So one of the question is: 1.How can I store all of this in vectors ? or in a single vector if I want to use interleaved data ? How much space can a vector support ? Another question. Let's say I have some faces: f 1/3/1 2/4/2 13/23/3 12/24/4 f 1/3/6 3/34/5 14/35/6 13/23/3 2.So I have 2 faces, both of them have the first vertex 1, with the texture coordonate no. 3, but have different normals, 1 and 6. So how can I write this in my interleaved data ? 3. If my spaceship model uses 2 textures, how can I know which texture to use in shaders ? How can I find the coordonates for each texture ? So for the moment, these are my questions. Hope somebody can help me to clarify the parsing of the .obj file. Thank you!
  15. alx119

    Importing .OBJ model to OpenGL

    @cgrant: I tried to follow once, the tutorials with assimp from learnopengl.com and I encountered an error that I couldn't solve it. Also I didn't understand so much what was with the root nodes and all the things referring to assimp, so I told myself that it would be challenging to create my own model importer. Also, I will try first with .obj files, just for learning purpose and maybe in the future, I will try with other formats. @Yxjmir: Thank you for all the informations. I've worked before with VAO's and VBO's, and was slightly ok, but I think I understood more what they do, and not how they do.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!