- Viewing Profile: Reputation: japro
Community Stats
- Group Members
- Active Posts 458
- Profile Views 4,199
- Member Title Member
- Age 28 years old
- Birthday March 4, 1985
-
Gender
Male
-
Location
Switzerland
User Tools
Contacts
japro hasn't added any contacts yet.
#4963082 So I started writing Example Programs
Posted by japro
on 25 July 2012 - 04:19 PM
It also has a simple phong lighting implementation and is funny in that it doesn't use a vbo at all. It generates the sample points by "abusing" instanced rendering and only uses gl_VertexID and gl_InstanceID and the texture as inputs so to speak.
Here is a video:
#4961281 make games using eclipse?
Posted by japro
on 20 July 2012 - 05:56 AM
#4961185 Particle System...
Posted by japro
on 19 July 2012 - 11:14 PM
examples 07-09 are particle system to some extent. There isn't a whole lot to it actually... just just draw lots of billboarded quads at the particle positions. Everything else like how you want the particles to move, be shaded etc. is up to you. In that code up there I use a geometry shader for the rendering, you could just as well use instancing or even explicit quads.
#4961182 Hardware Occlusion Queries, why use them next frame?
Posted by japro
on 19 July 2012 - 11:09 PM
I have an example of this here: https://github.com/p...onal_render.cpp
Edit: DX seems to have this functionality as well I just wasn't sure at the point of writing the post since I'm not really experienced with DX
#4960966 Any way Render to VBO directly?
Posted by japro
on 19 July 2012 - 09:15 AM
#4959576 Need tips on collision response for a 2D ball hitting another 2D ball that is...
Posted by japro
on 16 July 2012 - 07:03 AM
Anyway a simple collision resolution for this case is to simply offset each ball by half the penetration.
void resolveCollision(Ball &a, Ball &b)
{
vec2 diff = a.position-b.position;
double dist = length(diff);
double penetration = max(0, a.radius + b.radius - dist);
a.position += 0.5*penetration*diff/length;
b.position -= 0.5*penetration*diff/length;
}
Then you just apply that iteratively to all colliding pairs of balls and either have "multi collision" being sorted out over multiple time steps, or iterate this until there is no collisions anymore.This doesn't handle velocity yet but I didn't really get how you want that resolved anyway? just cancel out relative movement? elastic collision
#4957987 Screen space , World space issue ?
Posted by japro
on 11 July 2012 - 05:20 AM
The second line simply does what it says there? Convert [-1,1] to [0,1]. Most likely because the "Normal" render target clamps values to [0,1].
#4957454 So I started writing Example Programs
Posted by japro
on 09 July 2012 - 05:49 PM
Somewhat related, after having completed the occlusion culling example I kept playing with it and after some amount of copy pasting from my own code and adding a deferred pipeline I ended up with this:
http://youtu.be/j9QLwqNs6pk
#4955802 So I started writing Example Programs
Posted by japro
on 04 July 2012 - 06:15 PM
Slightly bloaty since for occlusion queries to make sense you need enough stuff to... well occlude each other. I ended up doing a voxel/cube renderer for that. On the one hand 700 lines for an example is a little long. But at the same time 700 lines for a voxel renderer with occlusion queries is fairly short I would say ;)
#4955116 So I started writing Example Programs
Posted by japro
on 02 July 2012 - 06:19 PM
My problem there is that it doesn't rally show anything new in terms of OpenGL. The FBO FXAA already does that sort of. On the other hand I could use that to explicitly show multiple render targets.How about a deferred shader?
In the meantime, I added two examples that both show a particle system. One implemented by moving the particles on CPU side and copying them to the vram via multiple mapped buffers and the other doing the same but staying on the gpu and moving the particles via transform feedback.
#4954849 Object oriented programming issue
Posted by japro
on 02 July 2012 - 04:09 AM
Vector a(1024), b(1024), c(1024); a = b*3.14+c;then a naive implementation gets compiled to something like:
Vector tmp(1024); for(int i = 0;i<1024;++i) tmp[i] = b[i] * 3.14; for(int i = 0;i<1024;++i) a = tmp[i] + c[i];but expression templates can give you:
for(int i = 0;i<1024;++i) a[i] = b[i] * 3.14 + c[i];
#4954409 So I started writing Example Programs
Posted by japro
on 30 June 2012 - 06:34 PM
The shader encapsulation is of course something that one would do in actual code (and I of course have wrappers that do exactly that). But as far as the examples are concerned I will not do that since I want to keep them self contained and free of my own "encapsulation design".
#4953939 So I started writing Example Programs
Posted by japro
on 29 June 2012 - 06:34 AM
You mean as in a separate file or just separate functions? I'm aware that the examples aren't exactly best coding practice in terms of structuring etc. But I wanted to avoid introducing to much of my structure since that is one of the things that I often don't like in tutorials. That the author structures the code in some way that is intuitive to him but not me. Which in the end makes it harder to find what I'm actually looking for. Also I wanted the examples to be self contained without external includes other than the libs. I was considering putting something like a index on the top of the examples like:Maybe add a common module for the (common) shader stuff ?
/* * lines x-y: shader setup * lines z-w: vbo setup * ... */to make it easier to find the relevant parts.
Can you elaborate on what you mean with modules?
I guess I could add a variation of example 1 to show that possibility. Maybe I will move the other example also to use the layout version instead of BindAttribLocation. It indeed looks cleaner somehow.Possibly, the attribute locations could be specified using shader layout commands instead of using glBindAttribLocation(). But I suppose using glBindAttribLocation() can be an advantage for some use-cases.
Thank you for the feedback guys
The next examples I'm considering to add are sync queries and buffer mapping (for texture streaming), timer queries, occlusion queries and conditional render as well as transform feedback. For the moment I'm going through OpenGL3.3 features and after having covered those I'll also look into 4+ stuff (tessellation most notably). There might be other features I'm currently not thinkingof?
#4953771 So I started writing Example Programs
Posted by japro
on 28 June 2012 - 03:46 PM
so about two years back I again got into OpenGL (the first time was a failure being way back at the beginning of my programming career). Specifically I was only interested in learning "modern OpenGL" so 3 and later. Since at that time I already was pretty competent with C++ and math I figured it would be relatively easy. But then I got quickly frustrated with the online resources that are available. The majority is outdated and littered with deprecated functionality and most or the tutorials are more graphics programming tutorials that happen to use OpenGL instead of actually focusing on OpenGL. You know the ones that go: "how to open a empty window", "how to draw a triangle", "how to load a model"... wait? what has loading a model to do with OpenGL?
So I often ended up reading reference pages and specs but that is somewhat frustrating without examples to go along with them. And searching for examples again resulted in lots of deprecated code and otherwise frustrating stuff like OpenGL functionality wrapped away under custom frameworks. I want to learn about OpenGL after all and not about how the author likes to wrap it.
So I finally started to write examples like I would have wanted them myself. Partly so I have code lying around that I can refer to myself but also because I think there might be other people like me out there. The current state is available on github:
https://github.com/p...OpenGL-Examples
The basic Idea is that each example is self contained (not reliant on some base code or obscure libraries) in a single file and is meant to provide a clean usage of one or multiple OpenGL 3+ features. Sadly I still have to rely on some libraries for context creation etc. so the examples depend on glfw, glew and glm.
The reason why I post this here is that I want more feedback and suggestions. So please let me know what you think. Also tell me if there is something wrong with my English in the comments, I'm not a native speaker after all. And since I'm already shamelessly plugging my stuff I usually announce new examples on my twitter (see signature).
#4953636 Object oriented programming issue
Posted by japro
on 28 June 2012 - 06:09 AM
- Home
- » Viewing Profile: Reputation: japro

Find content