[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Hello, /g/! I'm currently having fun with OpenGL in C++,

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 6
Thread images: 2

File: opengl_logo.png (11KB, 440x192px) Image search: [Google]
opengl_logo.png
11KB, 440x192px
Hello, /g/!

I'm currently having fun with OpenGL in C++, making squares, triangles, making a point take the coords of my mouse and shit like that.

Currently, all the coords of the stuff I draw are hardcoded, so I'd like to implement some sort of input in the window that can retrieve data for the rendering part.

What library do you recommend? I'm working on Linux, btw.
>>
File: screencast_00000.webm (288KB, 1362x733px) Image search: [Google]
screencast_00000.webm
288KB, 1362x733px
current progress

using freeglut and glew
>>
>>58156532
post code OP, also I recommend OpenAL for sound, maybe SDL, just post code and progress
>>
>>58156991
here's the whole file

#include <cstdio>

#include <GL/glew.h>
#include <GL/freeglut.h>

double mouse_x = 0,
mouse_y = 0;

void mouseMove( int x, int y ) {
mouse_x = x;
mouse_y = y;
}

void renderScene( ) {

glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

double x = ( mouse_x / 320 - 1 ),
y = -( mouse_y / 140 - 1 );

glBegin( GL_TRIANGLES );
glVertex3f( 0, 0, 1 );
glVertex3f( 1, -1, 0 );
glVertex3f( x, y, 0 );
glEnd();

glutSwapBuffers();
}

int main ( int argc, char** argv ) {
glutInit ( &argc, argv );
glutInitDisplayMode ( GLUT_SINGLE | GLUT_RGB );
glutInitWindowPosition ( 1100, 100 );
glutInitWindowSize ( 640, 280 );
glutCreateWindow ( "GL_VERSION" );

glutDisplayFunc( renderScene );
glutPassiveMotionFunc( mouseMove );

glutIdleFunc( renderScene ) ;

glewInit();
printf( "OpenGL version supported by this platform: (%s) \n", glGetString( GL_VERSION ) );
printf( "GLSL version supported by this platform: (%s) \n", glGetString(GL_SHADING_LANGUAGE_VERSION ) );

glutMainLoop ( );

return 0;
}


currently looking into SDL, but I don't think it will help that much. Gonna look into GUI libs later
>>
>>58157038
if you plan on using QT, go for qtcreator for the IDE
>>
>>58157038
> glBegin
you should use modern OpenGL instead
Thread posts: 6
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.