Request a Tutorial

• (5 Pages)
• « First
• 3
• 4
• 5

60 Replies - 42784 Views - Last Post: 22 December 2014 - 08:16 AMRate Topic: 1 Votes //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=120237&amp;s=58745c6e38235f2bd157eb5b3f41cc21&md5check=' + ipb.vars['secure_hash'], cur_rating: 4, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

#61 jbeme

Reputation: 3
• Posts: 98
• Joined: 30-October 09

Re: Request a Tutorial

Posted 22 December 2014 - 08:16 AM

I was just updating myself on OpenGL and two tutorials would have been nice. I'd make them myself, but I doubt anyone wants me to do it. Still a few concepts I don't fully understand.
I should also note, I only use glew, windows, string, and stdio. Not a big fan of add-in's like glut or even glmath.

1)Breakdown of gl_position matrix by slot and meaning
Language: C (one of the C's anyways, wouldn't matter much for a matrix)
Subject: Take a 4x4 matrix, look at it as a array of floats. The tutorial would explain what each spot in the array would be and how to mathematically derive that from something like gluLookAt(since this is now deprecated).
Something similar to what is shown https://www.youtube....id=P8Xs_WR4zIw. Take x,y,z and convert to gl_perspective.
Purpose: It took me about 40 hours to figure this out myself, since most people like to just teach a matrix and give you magic equations (I always want to understand why, not just use magic) or they have massive use of addition libraries or some other plug-in type thing. It's odd to me that tutorials on the most basic of things don't exist and I don't want anyone else to suffer like I did. People prefer magic.
Something like
```GLfloat* some_array = {1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0,
0.0, 0.0, 0.0, 10.0f}
GLint loc = glGetUniformLocation(shaderProgram, "pos_in_mat");
glUniform4fv(loc, some_array);

```

instead of (taken from learnopengl.com)
```model = glm::translate(model, cubePositions[i]);
GLfloat angle = 20.0f * i;
model = glm::rotate(model, angle, glm::vec3(1.0f, 0.3f, 0.5f));

```

``` #version 410 core
layout (location = 0) in vec3 position
uniform float* some_array;
main() {
gl_position = some_array*position;
}

```

I hope the above code is close enough to give the idea. Even if not technically right...
Currently for my most basic shader I have.
```gl_position = offset * vec4(position.x + move_x, position.y + move_y, position.z + move_z, 1.0f);

```

It works for 360 degrees on all axis, but I'd love to clean it up and have a slightly better understanding.
A similar breakdown for below shader would also be a nice bonus. Using an array of floats and setting each one separately.
```gl_position = projection * view * model * position;

```

I am using this for some things, but I honestly don't understand everything going on to the level I want. I can set up a projection and understand short cuts to do that, but I don't know how to set up the matrix bit by bit and I can't find a good tutorial that explains it all without using something to cheat. I'm relatively sure it possible, due to the code I hobbled together via trial and error.

2) "Base OpenGL"
Language: C or Cish
Subject: A tutorial looking at Opengl without using Glut, GLFW, etc.
Purpose: I think everyone should understand how things work before they start adding in things like Model View and Projection View and before they start using the GLmath library.
Comments: If you wanted to do collision first, that'd be neat. It's the only thing I have left to relearn:)

This post has been edited by jbeme: 22 December 2014 - 08:40 AM