Finally! I've got stuff moving on the screen. It seems that I was over-thinking things with my previous attempts at getting the cube to move around. All I really needed to do was pass the data into the vertex shader and let it handle the rest. Whatever, It's all working now.
With this we wrap up two topics. Textures will be done; well more done, my texture code was done after the UV coordinates. As well as transformations and animation. Or at least the basics of animation are done, this just shows how to move and distort meshes, actually making it look like real movement takes a bit more planning and effort.
Showing posts with label GLSL. Show all posts
Showing posts with label GLSL. Show all posts
Monday, February 24, 2014
Friday, February 21, 2014
Matrix math and OpenGL
I'm still working out how to apply these transforms in my model class. I think it'd be best if I found a way to pack the necessary information into a uniform buffer when rendering an object, this would allow the shaders to perform the necessary transformations. The trick of course is to pack the data in such a way that everyone can make sense of it, and that's where I'm stuck at the moment.
Regardless, of my inability to copy data legibly I can still explain the core of what needs done. OpenGL uses matrix math to perform transformations on your models. These transformations are what allows in to move around on the screen. So let's talk about matrix math.
Regardless, of my inability to copy data legibly I can still explain the core of what needs done. OpenGL uses matrix math to perform transformations on your models. These transformations are what allows in to move around on the screen. So let's talk about matrix math.
Friday, February 14, 2014
Loading Textures in GL
I've got colored polygons on the screen. Flat colors like that really aren't all that visually appealing. I'm sure you could arrange enough of them to make an interesting picture, but it seems like a lot of work. What would be a lot easier is if we could just take some image data and stretch that across the polygons.
Monday, January 13, 2014
Shader Attributes
We've passed data to our shaders, but it's one size fits all data. There's going to be situations where we need different information for each vertex, and pushing all this in uniform blocks just isn't going to work. It's time to try shader attributes.
These are arrays of data, each element of the array should correspond to one of the vertexes. When the shader executes it will only read the element that corresponds to the current vertex. This is handy for things like locations, colors, normals and so forth which need applied individually to each vertex.
These are arrays of data, each element of the array should correspond to one of the vertexes. When the shader executes it will only read the element that corresponds to the current vertex. This is handy for things like locations, colors, normals and so forth which need applied individually to each vertex.
Friday, January 10, 2014
Talking to shaders
I've finished create the most basic of shaders, and they work in the sense that they get polygons onto the screen. Let's step them up a bit. To do that we'll need to pass data to the shaders, perhaps a color and maybe the model projection matrix to start moving away from those deprecated attributes.
I'd like to move up to a newer version of OpenGL, but I'm limited to version 3.0 (GLSL 1.3) since that's the highest version I can reach with all the machines I work on. I'll make an effort not to use any features that are removed in later versions, I can't make any promises since it's not always easy to know what features those are.
I'd like to move up to a newer version of OpenGL, but I'm limited to version 3.0 (GLSL 1.3) since that's the highest version I can reach with all the machines I work on. I'll make an effort not to use any features that are removed in later versions, I can't make any promises since it's not always easy to know what features those are.
Monday, January 6, 2014
The most basic shaders
So our program doesn't draw always draw triangles because we're missing shaders. The code was updated so that it can load and use shaders, there just aren't any for it to load. Let's fix that.
I'm not going to create anything fancy, just the most simple shaders to demonstrate the absolute basics. I should mention that I just started learning about shaders a week and a half ago, so you can't really expect digital magic quite yet.
I'm not going to create anything fancy, just the most simple shaders to demonstrate the absolute basics. I should mention that I just started learning about shaders a week and a half ago, so you can't really expect digital magic quite yet.
Subscribe to:
Posts (Atom)