Sign in to follow this  
kimi

OpenGL OpenGL in 10 days !?!?!

Recommended Posts

kimi    150
Hi all,

As the topic says I really want to get the hang of OpenGL in 10 days. I am a newbie but trying to understand OpenGL for some months now. However I do not seem to get it and not confident to write program from scratch.

For now I want to get something working in OpenGL 2 and then move on to GLSL for my final project in the university.

Nehe tutorial ? or what resources on internet I should follow. I have ordered OpenGL superbible 5th edition from amazon so it should be in my hands in 4 days but I would like to know how you guys learned OpenGL programming ?

I want learn how to handle your own matrices ???, how does modeview matrix actually work. How to render and move things in 3D. I do not think I completely understand it TBH.

Please help

Share this post


Link to post
Share on other sites
Yours3!f    1532
its not going to be 10 days but rather at least a year:) (or more, from personal experience)
you might read the bible 5th edition in a month or so, but that's unlikely and even after reading you'll have to practice a LOT until you get comfortable with it and deal with your own ideas.
even after doing the aforementioned practice you'll likely run into lot of problems, that usually will come from not being experienced enough.
to add, if you aren't comfortable with C++ than it will likely take much longer time to accomplish this.

I'm not trying to persuade about don't start to learn OpenGL, but I'd like to emphasise that it will take a long-long time to get to the end of it

Share this post


Link to post
Share on other sites
Erik Rufelt    5901
NeHe is probably one of the faster ways to get something up and running, and it shouldn't take too long to make some working prototypes.

Actually completing a more advanced game, or learning all the internals, will take a long time. I wouldn't recommend starting with learning the math if you want to see quick results, unless you already have a very solid university math background.

Share this post


Link to post
Share on other sites
Trienco    2555
[quote name='playstation' timestamp='1302883778' post='4798822']
I want learn how to handle your own matrices ???, how does modeview matrix actually work. How to render and move things in 3D. I do not think I completely understand it TBH.
[/quote]

Two simplifications:
A matrix describes a coordinate system, the columns are x,y,z and origin. That's all there is to it (unless you add scaling or shearing). Don't worry about mathematical details of what happens when you multiply, just think "M = A*B" means "apply transformations in A after applying transformations in B". The result can still be directly read as coordinate system.

The mysterious w-coordinate on vectors can be thought of like this: w = 0 -> direction vector, w = 1 -> position vector (yes, it applies to matrices, the axes have w=0, the position/translation has w=1). If you do the math yourself you will see how it removes the translation part when multiplying with a matrix and when you look at GLs lighting model you will see how it makes the difference between a point light and a directional light.


More bla:
OpenGL is actually hiding stuff in a way that is both convenient and confusing. glRotate isn't magic, it just creates a rotationMatrix and does modelview = rotation * modelview. Same with glTranslate. D3D forces you to do it yourself, so you can't ignore what really happens. Seems more tedious, but ignorance isn't always bliss (look at the kind of questions arising from trying to achieve everything with these to glCursed functions). You want to forget about them if you handle your matrices yourself. If you don't move the point of view (or "camera", though technically such a thing doesn't exist) you can just directly glLoadMatrix your objects matrix and render it. Else you first need to apply the inverse of your "imaginary" camera's matrix (and yes, it simply transforms everything rendered afterwards -aka "the world"- in the opposite way).


"How to render and move things" suggests a wrong order. You can't move stuff after rendering it (it's just a bunch of pixels in the frame buffer now). First you setup your matrix to have it drawn in the right place, then you render. If you move it, you use a different matrix when drawing the next frame.

Share this post


Link to post
Share on other sites
kimi    150
Thanks for reply all. Yeah I will go through tutorials as it is defintely faster way to get things moving. Reading booking and practising will definitely take months.

[quote name='Trienco' timestamp='1302938888' post='4799054']
[quote name='playstation' timestamp='1302883778' post='4798822']
I want learn how to handle your own matrices ???, how does modeview matrix actually work. How to render and move things in 3D. I do not think I completely understand it TBH.
[/quote]

Two simplifications:
A matrix describes a coordinate system, the columns are x,y,z and origin. That's all there is to it (unless you add scaling or shearing). Don't worry about mathematical details of what happens when you multiply, just think "M = A*B" means "apply transformations in A after applying transformations in B". The result can still be directly read as coordinate system.

The mysterious w-coordinate on vectors can be thought of like this: w = 0 -> direction vector, w = 1 -> position vector (yes, it applies to matrices, the axes have w=0, the position/translation has w=1). If you do the math yourself you will see how it removes the translation part when multiplying with a matrix and when you look at GLs lighting model you will see how it makes the difference between a point light and a directional light.


More bla:
OpenGL is actually hiding stuff in a way that is both convenient and confusing. glRotate isn't magic, it just creates a rotationMatrix and does modelview = rotation * modelview. Same with glTranslate. D3D forces you to do it yourself, so you can't ignore what really happens. Seems more tedious, but ignorance isn't always bliss (look at the kind of questions arising from trying to achieve everything with these to glCursed functions). You want to forget about them if you handle your matrices yourself. If you don't move the point of view (or "camera", though technically such a thing doesn't exist) you can just directly glLoadMatrix your objects matrix and render it. Else you first need to apply the inverse of your "imaginary" camera's matrix (and yes, it simply transforms everything rendered afterwards -aka "the world"- in the opposite way).


"How to render and move things" suggests a wrong order. You can't move stuff after rendering it (it's just a bunch of pixels in the frame buffer now). First you setup your matrix to have it drawn in the right place, then you render. If you move it, you use a different matrix when drawing the next frame.
[/quote]

Thanks, I was looking at some matrixes and it is definetly confusing. OpenGL handles so I guess we do not have to worry about it. I like your example M= A*B and how OpenGL handle matrix in reverse order. I am not sure about the model and view matrix. Model handle from objecr space to world space and view from world spcae to eye space. It is confusing

Share this post


Link to post
Share on other sites
SimonForsman    7642
[quote name='playstation' timestamp='1303130608' post='4799854']
Thanks, I was looking at some matrixes and it is definetly confusing. OpenGL handles so I guess we do not have to worry about it. I like your example M= A*B and how OpenGL handle matrix in reverse order. I am not sure about the model and view matrix. Model handle from objecr space to world space and view from world spcae to eye space. It is confusing
[/quote]

If you're a university student try to take linear algebra, it helps alot.

Share this post


Link to post
Share on other sites
jesse007    158
[quote name='playstation' timestamp='1302883778' post='4798822']
Nehe tutorial ? or what resources on internet I should follow. I have ordered OpenGL superbible 5th edition from amazon so it should be in my hands in 4 days but I would like to know how you guys learned OpenGL programming ?
[/quote]

Maybe you know this already, but be aware that NeHe uses the old fixed pipeline of OpenGL 2, but the Superbible 5th edition uses OpenGL 3.3. Assuming that you're just starting out, this can be very confusing because the book will not use most of the functions found in NeHe's tutorials as they are deprecated. Everything is done with shaders in the Superbible and that is why the author provides the GLtools library. Basically the GLtools is providing the functionality from OpenGL 2 that was deprecated in 3.3. I'm a beginner at OpenGL so It took me a bit to figure this out.

Share this post


Link to post
Share on other sites
jyk    2094
[quote name='playstation' timestamp='1303130608' post='4799854']
I like your example M= A*B and how OpenGL handle matrix in reverse order.[/quote]
OpenGL doesn't handle matrices in reverse order. (If you're referring to the transforms being applied in the order B->A rather than A->B, this is simply a consequence of the fact that most OpenGL references use column-vector notation. But, it's not 'reversed' with respect to anything in particular.)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Similar Content

    • By pseudomarvin
      I assumed that if a shader is computationally expensive then the execution is just slower. But running the following GLSL FS instead just crashes
      void main() { float x = 0; float y = 0; int sum = 0; for (float x = 0; x < 10; x += 0.00005) { for (float y = 0; y < 10; y += 0.00005) { sum++; } } fragColor = vec4(1, 1, 1 , 1.0); } with unhandled exception in nvoglv32.dll. Are there any hard limits on the number of steps/time that a shader can take before it is shut down? I was thinking about implementing some time intensive computation in shaders where it would take on the order of seconds to compute a frame, is that possible? Thanks.
    • By Arulbabu Donbosco
      There are studios selling applications which is just copying any 3Dgraphic content and regenerating into another new window. especially for CAVE Virtual reality experience. so that the user opens REvite or CAD or any other 3D applications and opens a model. then when the user selects the rendered window the VR application copies the 3D model information from the OpenGL window. 
      I got the clue that the VR application replaces the windows opengl32.dll file. how this is possible ... how can we copy the 3d content from the current OpenGL window.
      anyone, please help me .. how to go further... to create an application like VR CAVE. 
       
      Thanks
    • By cebugdev
      hi all,

      i am trying to build an OpenGL 2D GUI system, (yeah yeah, i know i should not be re inventing the wheel, but this is for educational and some other purpose only),
      i have built GUI system before using 2D systems such as that of HTML/JS canvas, but in 2D system, i can directly match a mouse coordinates to the actual graphic coordinates with additional computation for screen size/ratio/scale ofcourse.
      now i want to port it to OpenGL, i know that to render a 2D object in OpenGL we specify coordiantes in Clip space or use the orthographic projection, now heres what i need help about.
      1. what is the right way of rendering the GUI? is it thru drawing in clip space or switching to ortho projection?
      2. from screen coordinates (top left is 0,0 nd bottom right is width height), how can i map the mouse coordinates to OpenGL 2D so that mouse events such as button click works? In consideration ofcourse to the current screen/size dimension.
      3. when let say if the screen size/dimension is different, how to handle this? in my previous javascript 2D engine using canvas, i just have my working coordinates and then just perform the bitblk or copying my working canvas to screen canvas and scale the mouse coordinates from there, in OpenGL how to work on a multiple screen sizes (more like an OpenGL ES question).
      lastly, if you guys know any books, resources, links or tutorials that handle or discuss this, i found one with marekknows opengl game engine website but its not free,
      Just let me know. Did not have any luck finding resource in google for writing our own OpenGL GUI framework.
      IF there are no any available online, just let me know, what things do i need to look into for OpenGL and i will study them one by one to make it work.
      thank you, and looking forward to positive replies.
    • By fllwr0491
      I have a few beginner questions about tesselation that I really have no clue.
      The opengl wiki doesn't seem to talk anything about the details.
       
      What is the relationship between TCS layout out and TES layout in?
      How does the tesselator know how control points are organized?
          e.g. If TES input requests triangles, but TCS can output N vertices.
             What happens in this case?
      In this article,
      http://www.informit.com/articles/article.aspx?p=2120983
      the isoline example TCS out=4, but TES in=isoline.
      And gl_TessCoord is only a single one.
      So which ones are the control points?
      How are tesselator building primitives?
    • By Orella
      I've been developing a 2D Engine using SFML + ImGui.
      Here you can see an image
      The editor is rendered using ImGui and the scene window is a sf::RenderTexture where I draw the GameObjects and then is converted to ImGui::Image to render it in the editor.
      Now I need to create a 3D Engine during this year in my Bachelor Degree but using SDL2 + ImGui and I want to recreate what I did with the 2D Engine. 
      I've managed to render the editor like I did in the 2D Engine using this example that comes with ImGui. 
      3D Editor preview
      But I don't know how to create an equivalent of sf::RenderTexture in SDL2, so I can draw the 3D scene there and convert it to ImGui::Image to show it in the editor.
      If you can provide code will be better. And if you want me to provide any specific code tell me.
      Thanks!
  • Popular Now