my first opengl 3 tutorial

my first opengl 3 tutorial

Postby rogerdv » 26 May 2014, 14:23

A couple of weeks ago I decided to start learning OpenGL 3 basics, and during the process, create a few tutorials to help others going through the same process. So far I have finished the first, and here is it: https://www.dropbox.com/s/g11tl72ehmwnol7/gl301.zip
The archive contains the code (commented in english and spanish) and a Codeblocks project. My intention was to provide other build files too, but I discarded it because of 2 reasons: first, when I was googling about, source code was more relevant for me than IDE projects. Second, lack of time. I dont have a PC at home, so I have been coding in my office time, which I have to split among writing, learning, design, relax, and of course, work.
I have a couple of ideas for more basic tutorials and I will post here as soon as they are completed.
User avatar
rogerdv
 
Posts: 289
Joined: 10 Dec 2009, 18:26

Re: my first opengl 3 tutorial

Postby mdtrooper » 27 May 2014, 16:49

I have been trying to compile...but there are some errors:

{l Code}: {l Select All Code}
miguel@miguel-HP-Pavilion-dm4-Notebook-PC /tmp $ g++ main.c
main.c: In function ‘int main(int, char**)’:
main.c:69:5: error: ‘SDL_Window’ was not declared in this scope
main.c:69:17: error: ‘mainwindow’ was not declared in this scope
main.c:70:5: error: ‘SDL_GLContext’ was not declared in this scope
main.c:70:19: error: expected ‘;’ before ‘maincontext’
main.c:87:25: error: ‘SDL_GL_CONTEXT_MAJOR_VERSION’ was not declared in this scope
main.c:88:25: error: ‘SDL_GL_CONTEXT_MINOR_VERSION’ was not declared in this scope
main.c:96:49: error: ‘SDL_WINDOWPOS_CENTERED’ was not declared in this scope
main.c:97:19: error: ‘SDL_WINDOW_OPENGL’ was not declared in this scope
main.c:97:39: error: ‘SDL_WINDOW_SHOWN’ was not declared in this scope
main.c:97:55: error: ‘SDL_CreateWindow’ was not declared in this scope
main.c:104:5: error: ‘maincontext’ was not declared in this scope
main.c:104:50: error: ‘SDL_GL_CreateContext’ was not declared in this scope
main.c:109:29: error: ‘SDL_GL_SetSwapInterval’ was not declared in this scope
main.c:150:32: error: ‘SDL_GL_SwapWindow’ was not declared in this scope
main.c:165:37: error: ‘SDL_GL_DeleteContext’ was not declared in this scope
main.c:166:33: error: ‘SDL_DestroyWindow’ was not declared in this scope
And I have a Patreon in https://www.patreon.com/migueldedios.
User avatar
mdtrooper
 
Posts: 185
Joined: 26 Jul 2012, 13:24
Location: Spain

Re: my first opengl 3 tutorial

Postby rogerdv » 27 May 2014, 17:05

SDL2 is required to create an opengl 3 context. Also, make sure that paths in build options point to the right SDL2 directories.
User avatar
rogerdv
 
Posts: 289
Joined: 10 Dec 2009, 18:26

Re: my first opengl 3 tutorial

Postby c_xong » 28 May 2014, 00:47

I suggest you use a build system such as CMake, and include that instead of project files for a specific IDE. Users can then generate project files for their own platform/IDE, and the build system can also manage dependencies.

Modern build systems like CMake are very easy to use, no more difficult than writing a Makefile. For example, for your package you might just start with the following CMakeLists.txt:

{l Code}: {l Select All Code}
project(my_first_ogl3_tut)

find_package(SDL2 REQUIRED)
find_package(OpenGL REQUIRED)

add_executable(tut01_thebox main.c)
target_link_libraries(tut01_thebox ${SDL_LIBRARY} ${OPENGL_LIBRARIES})
User avatar
c_xong
 
Posts: 234
Joined: 06 Sep 2013, 04:33

Re: my first opengl 3 tutorial

Postby blue.bear » 29 May 2014, 09:16

Thanks for sharing this tutorial. I'm plannig to learn OpenGL 3 basics so thank you for your time.
blue.bear
 
Posts: 3
Joined: 29 May 2014, 09:13

Re: my first opengl 3 tutorial

Postby rogerdv » 29 May 2014, 12:27

A tutorial about a cube and indexes is on the work (a bit slowly).
User avatar
rogerdv
 
Posts: 289
Joined: 10 Dec 2009, 18:26

Who is online

Users browsing this forum: No registered users and 1 guest