I Made a Drawing Software From Scratch (C++ & OpenGL)

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ธ.ค. 2024

ความคิดเห็น • 90

  • @RoyaltyInTraining.
    @RoyaltyInTraining. 5 หลายเดือนก่อน +59

    I see a lot of problems here. First of all, as others have pointed out already, you should immediately render all brush strokes that occurred between two frames into a separate framebuffer, then display that framebuffer in the UI without clearing it between frames. That way it acts as an accumulator, and you can stop redrawing all previous brush strokes for every new frame.
    Instead of using lots of polygons to make circular shapes, I'd use a square or a very low poly circular shape, and then perform a check inside the fragment shader if the current fragment is inside the shape or not (using the formula x^2 + y^2

    • @karankumarmageswaran1550
      @karankumarmageswaran1550 หลายเดือนก่อน +1

      better way i see for drawing is using SDF shapes to make a line. if the current pixel is inside the circle shape of the brush, then you color, otherwise you don't. and the nice thing abut SDF lines is you can interpolate them so they connect smoothly.

  • @vicenteeduardo5598
    @vicenteeduardo5598 5 หลายเดือนก่อน +106

    I don't think it is very good to draw a bunch of circles into the canvas, if you are going for a vector drawing the it is better to make a shape out of point and the generate a path filled, but if it is only a canvas as you said, then it would be better drawing the result to a texture and then you only need to render each circle into the texture once and you won't have the color pallet problem anymore

    • @SteffenF
      @SteffenF 5 หลายเดือนก่อน +14

      the fps drop is huge. your solution would fix that as well 😁

    • @gabrielecocchieri7588
      @gabrielecocchieri7588 5 หลายเดือนก่อน +1

      yeah isnt he making a draw call for each small circle? still an awesome job, when speaking about c++ and especially OpenGL/graphics programming every step forward is so hard.

    • @graphics_gurunt
      @graphics_gurunt 5 หลายเดือนก่อน +5

      Yeah he should have the texture as a buffer and then manipulate that buffer directly whenever he draws something

    • @TheRealZitroX
      @TheRealZitroX 4 หลายเดือนก่อน

      Keep the history is usefull when cmd z.
      Without removing drawn stuff you indeed should draw on a buffer object.
      V sync the window to monitor to remove unnecessary cpu usage

    • @notbillymays
      @notbillymays 25 วันที่ผ่านมา

      ​@@gabrielecocchieri7588 me when batch rendering

  • @girlazo2222
    @girlazo2222 4 หลายเดือนก่อน +2

    I'm glad youtube recommends channels like yours!

  • @conrad6071
    @conrad6071 5 หลายเดือนก่อน +23

    I'm also new to OpenGL, I think you should use a shader to draw into a off-screen texture(FBO), copy that texture and feed it to shader next frame, so that its content accumulated.
    Maybe different shader for different brush (shapes and image).
    The saving problem will gone because you're using FBO.
    And your frame rate will barely drop.

    • @Derker2002
      @Derker2002 5 หลายเดือนก่อน +1

      or create a quad with texture and draw on texture, so you can specify the resolution and have multiple "papers" to draw on. It will be much more efficient than drawing a bunch of triangles.

    • @Alik-Green
      @Alik-Green 5 หลายเดือนก่อน +1

      I would use a compute shader to draw to an image texture and then draw that image texture to the screen.

    • @urisinger3412
      @urisinger3412 5 หลายเดือนก่อน

      no need for a diffrent shader, he can just store brushes as an image/bitmap and draw it every time

  • @MartinWoad
    @MartinWoad 5 หลายเดือนก่อน +9

    The problem is that by importing windows.h you've basically tied your program to Windows forever, until you go back to the lines of code you've written that are utilizing it and rewrite them or someone uses Wine. I would have personally abstracted that layer and instead and made a class for each platform that would then handle the logic for each OS. Or otherwise.

    • @TheRealZitroX
      @TheRealZitroX 4 หลายเดือนก่อน

      Don’t have to when just trying out.
      I see much more problems with the shaders and circle draws each frame. Abstraction is for bigger problems or when you know you want to work on different operating systems

  • @isaacgraphics1416
    @isaacgraphics1416 5 หลายเดือนก่อน +3

    This is a cool video, I'm grateful you talked a bit about some of the basic starting steps, that's pretty uncommon in these kinds of videos

  • @ahmedabuharthieh579
    @ahmedabuharthieh579 5 หลายเดือนก่อน +5

    Great Video. Quick note: Instead of interpolating between prev mouse position then drawing many circles, you could try drawing a line between the two points (you would have to draw the line as a quad to allow for any thickness of line)

  • @Cartoonkal
    @Cartoonkal 2 หลายเดือนก่อน

    I searched up "how to make a drawing software" on TH-cam and this is the only video I found that is actually what I was looking for lol thanks for this

  • @thegamingdudeonwindows7804
    @thegamingdudeonwindows7804 5 หลายเดือนก่อน +4

    I was lokey surprised at 0:40 this is really good quality keep it up g👍

  • @midnightfuture
    @midnightfuture 4 หลายเดือนก่อน

    Cool project, well done. I'm sure you learned a ton in the process!

  • @pixelreset1572
    @pixelreset1572 4 หลายเดือนก่อน

    Such a good training project, I read some comments before posting this one, and yeah, I think it would be better to do the drawing stuff within a material shader. I would recommend rendering the dots based on UV, determining if the mouse has been released in between frames and if not, you can draw 2 triangles (aka a rectangle) between the new and old circle, which is an insanely easy implementation :)

  • @yashkumarkasaudhan1354
    @yashkumarkasaudhan1354 5 หลายเดือนก่อน +3

    what a good way to describe your project in a fun and interesting way

  • @AnnasVirtual
    @AnnasVirtual 5 หลายเดือนก่อน +7

    that text color brings back eclipse memories

    • @doodocina
      @doodocina 5 หลายเดือนก่อน

      wooooo another eclipse user

    • @stickguy9109
      @stickguy9109 5 หลายเดือนก่อน

      Lesgoo eclipse mentioned

    • @gabrielecocchieri7588
      @gabrielecocchieri7588 5 หลายเดือนก่อน

      oh no... THE software

  • @Luzyvert
    @Luzyvert 5 หลายเดือนก่อน +1

    cool video, you should try adding vsync so that the gpu doesn't do more work than it needs to. vsync will allow the app to only render the frames that can be displayed on the user's screen, additionally you could set a hard limit like 200 fps as well in case people have vsync forced off in their gpu's control panel. Maybe you could also look at allowing multiple users to draw on the same canvas over the network just for the experience. have fun with it :>

  • @akidanis6984
    @akidanis6984 5 หลายเดือนก่อน

    Great vid! I love how the more lines you draw the fps gets lower lol.
    Keep up the good stuff ;0

  • @nano-ai
    @nano-ai 5 หลายเดือนก่อน

    very nice video! i love the editing quality.i've tried learning opengl but i've had to scrap it each time. this video motivated me to give it another shot!

  • @slava6105
    @slava6105 5 หลายเดือนก่อน +1

    Good project you're developing 👍.
    AFAIK ImGui draws as another layer (pass) and can be turned off by some means.
    With you solution (saving whatever is already rendered to a file) I would try either to get a shot of only a canvas layer or disable imgui for a small period of time (with lock of user control for extra safety) to get only the canvas. I personally prefer the first but whatever is working will be good.
    Other things to consider:
    OS-specific libraries in general applications is the last resort. You either don't want to extend the application to other platforms or you have no ability to (e.g. windows tweaker is already bound to windows).
    You mentioned getting "ascii code from keypress" or so - unicode support is a valuable application feature and if you have ability to add it (if you plan on displaying/entering text in your program) it would be nice to do.
    After unicode support comes translation and other stuff (l10n, i18n) - a hard thing to do but it gets harder to add as the time passes.

  • @anon_y_mousse
    @anon_y_mousse 5 หลายเดือนก่อน

    I still remember my first drawing program. I used MFC and drew directly on a window canvas. It was garbage and I quit working on it after I got it working, but maybe I should revisit the idea since that was back when I was using Win98.

  • @htnguyenpanda
    @htnguyenpanda 5 หลายเดือนก่อน

    Awesome video!

  • @samllea1
    @samllea1 5 หลายเดือนก่อน +2

    YOU MADE MY GOOGLE GO OFF AT 12 IN THE MORNING 😭

  • @diakothefirst
    @diakothefirst 2 หลายเดือนก่อน

    good job actually

  • @PymeCheckTV
    @PymeCheckTV 5 หลายเดือนก่อน

    Good stuff!

  • @isaac45896
    @isaac45896 4 หลายเดือนก่อน

    Nice video. the fps in your app goes down fast maybe because of using a lot of draw calls, you should look for some videos about batch rendering, secondly, to gain in performance : use squares vertex instead of circles vertex then just apply a circle shader or texture to simulate the circle stroke. that's all what i can say

  • @lolcat69
    @lolcat69 5 หลายเดือนก่อน +1

    Store the colors in the vertices, and instead if drawing a circle that way only use 4 vertices, make a square and draw a circle with shader code

    • @lolcat69
      @lolcat69 5 หลายเดือนก่อน +1

      Or, make a "canvas" buffer that lives on the CPU and draw pixels to that, then you send it to de GPU with OpenGL to render it, so you don't have to deal with shaders that much and you will have a constant size of objects for the drawing

  • @Orsonster
    @Orsonster 5 หลายเดือนก่อน +2

    Seriously nice job! I'm amazed!

    • @IamWassim
      @IamWassim  5 หลายเดือนก่อน

      thanks means a lot!!

  • @Cadknowledge
    @Cadknowledge 4 หลายเดือนก่อน

    can you make something like manim with good UI in c++ ?

  • @Byynx
    @Byynx 4 หลายเดือนก่อน

    When you freely draw are you creating a new vertex object for each point you make or do you have a single VBO with the size of the APP and you just work pixel by pixel in the fragment shader?

  • @gabrielecocchieri7588
    @gabrielecocchieri7588 5 หลายเดือนก่อน +3

    that is really cool, why didn't you add the possibility to use multiple colors in the same drawing?

    • @IamWassim
      @IamWassim  5 หลายเดือนก่อน +2

      Great question! I initially considered adding a feature for multiple colors, but then I thought about transforming the software into a game. The idea is to create a game based on machine learning, where it asks you to draw items like a blue car, a yellow house and stuff like that... then it rates your drawing on a scale of 1 - 10 for accuracy. Because of this, implementing multiple colors seemed less important at the time. However, I plan to add it in future updates.

    • @gabrielecocchieri7588
      @gabrielecocchieri7588 5 หลายเดือนก่อน

      ok, maybe i missed the part where you say this in the video

    • @gabrielecocchieri7588
      @gabrielecocchieri7588 5 หลายเดือนก่อน

      you got a discord right?

  • @tranquil31
    @tranquil31 5 หลายเดือนก่อน

    awesome video, please keep making vids! subbed

  • @MahmudulHasan-ld3nz
    @MahmudulHasan-ld3nz 5 หลายเดือนก่อน

    bro what drawing softare were you using at 3:11?

    • @tetraizor
      @tetraizor 5 หลายเดือนก่อน

      Goodnotes

  • @abrarmasumabir3809
    @abrarmasumabir3809 5 หลายเดือนก่อน

    bro what drawing softare were you using at 3:11

  • @hoseashpm7810
    @hoseashpm7810 12 วันที่ผ่านมา

    You need zoom in/out, and panning functionality. Then you’ll be more satisfied

  • @mcp-hackers
    @mcp-hackers 4 หลายเดือนก่อน

    Whats the font that you use in visual studio?

  • @Cnastret
    @Cnastret 5 หลายเดือนก่อน

    A very good video 👍

  • @stof_-6785
    @stof_-6785 5 หลายเดือนก่อน

    nice work

  • @chapanharder
    @chapanharder 5 หลายเดือนก่อน

    Nice bro.

  • @obedabit280
    @obedabit280 5 หลายเดือนก่อน +1

    Have you noticed that the FPS is dropping too much when you draw a lot on the canvas?

  • @Pepcen
    @Pepcen 4 หลายเดือนก่อน

    When fixing bug #1 you could have just used a rectangle. It'd be so much easier and efficient.

  • @Vorono4ka
    @Vorono4ka 5 หลายเดือนก่อน

    Really funny, I like this video

  • @jawadalamoush6112
    @jawadalamoush6112 5 หลายเดือนก่อน +1

    Alsalam Alaikum Akhi. High quality video, Good job! earned a subscriber man. much love

  • @jackcomas
    @jackcomas 5 หลายเดือนก่อน +2

    Better than Adobe Photoshop

  • @jadBN
    @jadBN 5 หลายเดือนก่อน

    Waw! Keep going!

  • @Fernando-du5uj
    @Fernando-du5uj 5 หลายเดือนก่อน

    whats your msvc colorscheme?

  • @lolman-vb8ro
    @lolman-vb8ro 5 หลายเดือนก่อน

    great video, how'd you get started with c++, I currently am really good at python but want to branch out to higher level compiled languages like c++

  • @samarthtandale9121
    @samarthtandale9121 5 หลายเดือนก่อน

    You truely are genius bro !!! Subscribed!

  • @rexoverwatch
    @rexoverwatch 5 หลายเดือนก่อน

    very cool

  • @yonilaskov340
    @yonilaskov340 5 หลายเดือนก่อน

    how have you came to make this, figuring it out

  • @Kave-qp1yt
    @Kave-qp1yt 5 หลายเดือนก่อน

    how can i install the program?

  • @andrewdunbar828
    @andrewdunbar828 14 วันที่ผ่านมา

    I sat on a furniture and wrote an information in a comment.

  • @vvvorlds
    @vvvorlds 5 หลายเดือนก่อน

    Now ask yourself, what problem do you want to solve?

  • @S.M_GAMER_GG
    @S.M_GAMER_GG 5 หลายเดือนก่อน

    now made nodepad!!

  • @MED_Laaguidi
    @MED_Laaguidi 4 หลายเดือนก่อน

    are you moroccan bro?

  • @akshatsingh9830
    @akshatsingh9830 5 หลายเดือนก่อน

    u have any discord or reddit community ?

    • @IamWassim
      @IamWassim  5 หลายเดือนก่อน

      No unfortunately

  • @ganghumilde
    @ganghumilde 5 หลายเดือนก่อน +1

    gg

  • @michaelhawthorne5516
    @michaelhawthorne5516 5 หลายเดือนก่อน +1

    Your vector of vectors made me sad

  • @Mohammed_designer9
    @Mohammed_designer9 4 หลายเดือนก่อน

    Why you write std::cout ?? You can write just cout, using namespace std;

  • @cvabds
    @cvabds 5 หลายเดือนก่อน

    I bet you can't do that on templeOS, I will only subscribe if you like this and confirm you will do that

  • @pedrodeazeredonogueira9661
    @pedrodeazeredonogueira9661 4 หลายเดือนก่อน

    >from scrach
    >open GL

  • @airman122469
    @airman122469 4 หลายเดือนก่อน

    “From scratch… with OpenGL”
    Ummmmmm… if you’re not going directly to the frame buffer it’s not “from scratch,” not really anyway.

  • @grevel1376
    @grevel1376 5 หลายเดือนก่อน +1

    storing each dot is a bad idea

    • @informagico6331
      @informagico6331 5 หลายเดือนก่อน +3

      Not being constructive is too

  • @meninoesperto2773
    @meninoesperto2773 5 หลายเดือนก่อน

    Using Windows to program == Dislike

    • @elnegroteodex
      @elnegroteodex 5 หลายเดือนก่อน +3

      ???

    • @elnegroteodex
      @elnegroteodex 5 หลายเดือนก่อน

      When programming OS doesnt matter

    • @elnegroteodex
      @elnegroteodex 5 หลายเดือนก่อน

      in most cases

    • @RoyaltyInTraining.
      @RoyaltyInTraining. 5 หลายเดือนก่อน +4

      Please stop being an elitist.
      Kind regards,
      A Linux nerd