nuklear icon indicating copy to clipboard operation
nuklear copied to clipboard

How draw on main window in SDL2 OpenGl3

Open sp00ck opened this issue 6 years ago • 7 comments

I download a demo/sdl_opengl3, it working.

How draw a line on main window? Where i can put my code? i put it after /* draw */ but not working

        /* Draw exist in demo */
        SDL_GetWindowSize(win, &win_width, &win_height);
        glViewport(0, 0, win_width, win_height);
        glClear(GL_COLOR_BUFFER_BIT);
        glClearColor(bg.r, bg.g, bg.b, bg.a);

/* my code */
        glLineWidth(2);

        glColor3f(0.80, 0.0, 0.0);
        glBegin(GL_LINES);
        glVertex2i(10,10);
        glVertex2i(200,320);
        glEnd();

        glColor3f(0.0, 0.0, 0.0);
        glBegin(GL_POINTS);
        glVertex2i(50, 50);
        glEnd();

        glFlush();

this same file https://gist.github.com/sp00ck/b96cd160b12443ae23365cf4d759de63

Is possible using SDL function draw line etc? Where are stored renderer?

sp00ck avatar Feb 11 '19 12:02 sp00ck

I joining canvas and normal example but dont work

https://gist.github.com/letarg0/56dd1aa3beb01bf74b420745a49dc0b3

How change background content not only color. How draw primitives on background?

letarg0 avatar Feb 15 '19 10:02 letarg0

it is nk_sdl_render() function that draws on screen, maybe your lines and points are being overwritten by it?

irtusb avatar Feb 20 '19 16:02 irtusb

@irtusb

it is nk_sdl_render() function that draws on screen, maybe your lines and points are being overwritten by it?

This function draw everything. How draw Line?

Simple, tell how draw line in demo file. Draw a simple rectangle. Show diff etc.

Do You know?

texrg avatar Feb 26 '19 15:02 texrg

@irtusb ok, how draw before nk_sdl_render() ? can You tell me where put SLD_ draw line (0,0,400,400)

letarg0 avatar Mar 04 '19 16:03 letarg0

you are using openGL, SDL_drawline and similar won't work. you need glLine or whatever it is called

irtusb avatar Mar 04 '19 21:03 irtusb

@irtusb Can You explain how do this? My code using glLineWidth(2); etc. But not working. Can You show answer?

sp00ck avatar Mar 09 '19 10:03 sp00ck

I only do plain sdl, sorry but I cannot help you more in that regard

El sáb., 9 mar. 2019 7:18, Łukasz Marek [email protected] escribió:

@irtusb https://github.com/irtusb Can You explain how do this? My code using glLineWidth(2); etc. But not working. Can You show answer?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vurtun/nuklear/issues/799#issuecomment-471164549, or mute the thread https://github.com/notifications/unsubscribe-auth/AASVp8liNf1imEen-9Kr8MRoANvyMZCnks5vU4pogaJpZM4a0DXd .

irtusb avatar Mar 09 '19 14:03 irtusb