Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Knurz

Pages: [1] 2 3
1
C / C++ /C# / Re: [C++][OpenGL] Sine Scroller
« on: May 14, 2013 »
Ok, i got a cute wave effect, but i can't get the character distorsion right.
Here is the example, for anyone who wants to try.
The method is _DrawChar on bmpFont.cpp class, and the z rotation seems to be working ok.
Sorry about the huge .rar size...

I haven't looked at rez's code and yours but that's what I see in his glrez intro:
He is doing a full sine wave at the y-axis (normal sine-scroller effect) and is rotating on the z axis each char individually. As you can see in the text-passages each char is "waving" up (or down) till it reaches a limit, then he is doing a smaller z-rotation. Maybe he is simple triggering a function when the position of one char on the Y axis is reaching a value, and this function simple is rotating the char based on the "steps" the char has taken since the function has been triggered (that's how I would do it).

Maybe this is effects are obvious and I'm writing bullsh*t, but Rez is a master of design, and at this stage of his carreer  (when the glrez intro was written) with openGL the effects are more nice tricks (like his blending orgies in some intros) but he is designing his stuff in a really nice perfect way.

Brgds (and post your results  :) )

2
C / C++ /C# / Re: [C++][OpenGL]VSync & framerate
« on: April 12, 2013 »
But this works only if you disabled the option that the driver should take care of vsync (or you have statically enabled it).
So you can't override the settings in the driver with wglSwapIntervalEXT.

Are you sure?
If i execute code in my pc(without calling the function), it enables VSync automatically (as if the driver had taken care of it by default). But if then i turn it off with the function the VSync disables.

(I hope you understand what i'm trying to say,  :P)

Saludos

I don't know the exact behaviour of an AMD card (I'm NVIDIA user)... On NVIDIA you have a combo-box with 3 Options avail:
- Force VSync ON
- Force VSync OFF
- Let Application decide

Let's say that User 1 has Option 3 enabled. So your program is doing well because your application is telling the driver "Use Vsync".
User 2 has Option 1 where your wglSwapIntervalEXT has no effect (it's already enabled and the statement does nothing).
Assuming User 3 has Option 2 enabled, your wglSwapIntervalEXT has also no effect (it's not enabled and your app cannot enable it).

Many users have the option 3 enabled (AFAIK it's the setting by default) and your app will do fine on most PCs, but if someone has Option 2 enabled, your program is going nuts because it has no blocking when calling glFinish() or similar.

This are the behaviours my tests and experience gave me while testing my "framework" on different cards/settings/PCs.
I'm initalizing OGL with wglSwapIntervalEXT(1) but I don't count on it in my rendering loop.

Brgds,
Berny/Knurz

3
C / C++ /C# / Re: [C++][OpenGL]VSync & framerate
« on: April 12, 2013 »
Hi.

If you want to enable VSync with Linux/GLX you can try this:
Code: [Select]
In Linux / GLX
Use the GLX_EXT_swap_control extension to control swap interval. Check the GLX-specific extensions string via glXQueryExtensionsString() to verify that the extension is actually present.
The extension provides glXSwapIntervalEXT(), which also directly specifies the swap interval. glXSwapIntervalEXT(1) is used to enable vsync; glXSwapIntervalEXT(0) to disable vsync.

But this works only if you disabled the option that the driver should take care of vsync (or you have statically enabled it).
So you can't override the settings in the driver with wglSwapIntervalEXT.

I've found another solution for me which is independent of the settings of the driver but it's not that accurate (in fact you cannot query the driver if the screen is fully drawn). I'm using a high-precision timer (win32) and I'm only drawing something if a 1/60 sec. time passed (~0.0167 ms). The advantage of this is if someone has statically disabled the vsync in his driver your program isn't going crazy because he has no real timer anymore.

There are several well documentated code-snippets around here so have a look at them.

Maybe there are newer, better solutions to this problem, but I didn't find anything which provides a more stable framerate on different (driver) settings with OGL.

Brgds.

4
C, C++, now learning the new (really powerful) C++11 Standard.

5
General chat / Re: Meteor Hits Russia
« on: February 17, 2013 »
It's more than I can see - too cloudy here in Doncaster.

I wonder if they found any fragments in Russia.

The meteor crashed into an icy lake, afaik there is atm no chance of getting any larger parts of the meteor out of the lake.

6
General chat / Re: The Welcoming Committee
« on: November 24, 2012 »
Hi all
I'm acd2001 and i'm a big fan of old demoscene intros and cracktros.
I want to thanks Retro Remakes and Pouet.
I'm here to learn something about C and C++ languages.

Yeah another C Guy   ;D

 :hi:

7
C / C++ /C# / Re: OGL: Loading Images From Memory
« on: November 17, 2012 »
Quote
I got really good quality by using the stuff provided from OGL
Well, the "build in" anti-aliasing has some drawbacks, too - mainly that it only works for colors.
If you're using deferred rendering, averaged normals and depth-values at boundary-edges can really take you into trouble.
That's why post-production filters for anti-aliasing (like smaa) got more popular lately.

I just watched some demonstration videos, SMAA looks really great. But I'm far away from understandig this :)

8
General chat / Re: Smooth interpolation...
« on: November 17, 2012 »
Yeah, very nice resource!

9
C / C++ /C# / Re: OGL: Loading Images From Memory
« on: November 15, 2012 »
That's actually a pretty bad solution because it's sampling a regular grid which has bad slope coverage.
For proper image quality you'll also need a rather complex downsampling filter to attenuate frequencies above nyquist (which bilinear/bicubic filtering won't) and which is probably already implemented somewhere in the hardware - but would require one (or two) additional rendering passes.

I got really good quality by using the stuff provided from OGL, I didn't really tried out the shader solution to the FSAA problem - maybe the shader would be a good fallback solution for some older cards ?



10
C / C++ /C# / Re: OGL: Loading Images From Memory
« on: November 15, 2012 »
BTW there is just ooooone little "nasty" thing with FBOs:

You don't have any FSAA effects with Framebuffers and the rendering quality is in my opinion (without FSAA) very shitty. There are several solutions to this problem, I found one with shaders but it seems an overkill for just applying a "normal" behaviour with FBO. After hours of googeling I found that the good guys at Khronos Group have already solved this problem for us by extending OpenGL with FSAA-FBOs.

And before you start searching again for examples, here is what I've found on the web - I packed this stuff into a function again:

Code: [Select]
#define FRAMEBUFFER_MULTISAMPLE 8
...

int createMSAAFBO ( struct FBOELEM *store, int width, int height) {
    unsigned int fbo, cbo, dbo;
    int maxsamples;
    GLenum error;

    glGetIntegerv (GL_MAX_SAMPLES_EXT, &maxsamples);

    if ( maxsamples > FRAMEBUFFER_MULTISAMPLE )
        maxsamples = FRAMEBUFFER_MULTISAMPLE;

    glGenFramebuffersEXT (1, &store->fbo);
    glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, store->fbo);
    glGenRenderbuffersEXT (1, &store->colorbuf);
    glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, store->colorbuf);
    glRenderbufferStorageMultisampleEXT (GL_RENDERBUFFER_EXT, maxsamples, GL_RGBA, width, height);
    glGenRenderbuffersEXT (1, &store->depthbuffer);
    glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, store->depthbuffer);
    glRenderbufferStorageMultisampleEXT (GL_RENDERBUFFER_EXT, maxsamples, GL_DEPTH_COMPONENT, width, height);
    glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, store->colorbuf);
    glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, store->depthbuffer);

    error = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
    if (error != GL_FRAMEBUFFER_COMPLETE_EXT) {
        switch (error) {
            case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
                MessageBox(NULL, "GL_FRAMEBUFFER_UNSUPPORTED_EXT", "FBO-ERROR", MB_OK | MB_ICONINFORMATION);
                break;
            case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
                MessageBox(NULL, "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT", "FBO-ERROR", MB_OK | MB_ICONINFORMATION);
                break;
            case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
                MessageBox(NULL, "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT", "FBO-ERROR", MB_OK | MB_ICONINFORMATION);
                break;
            case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
                MessageBox(NULL, "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT", "FBO-ERROR", MB_OK | MB_ICONINFORMATION);
                break;
            case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
                MessageBox(NULL, "GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT", "FBO-ERROR", MB_OK | MB_ICONINFORMATION);
                break;
            case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
                MessageBox(NULL, "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT", "FBO-ERROR", MB_OK | MB_ICONINFORMATION);
                break;
            case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
                MessageBox(NULL, "GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT", "FBO-ERROR", MB_OK | MB_ICONINFORMATION);
                break;
            case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT:
                MessageBox(NULL, "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT", "FBO-ERROR", MB_OK | MB_ICONINFORMATION);
                break;
            default:
                MessageBox(NULL, "default:", "FBO-ERROR", MB_OK | MB_ICONINFORMATION);
                break;
        }
    }
    glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
    return (store->fbo);
}

The difference between FSAA FBO's and non-FSAA FBO's is (as you can see in the example above) that you can't bind any textures to this Buffer but you can do a "Blit" to another FBO which has a texture object bound.

Code: [Select]
void texturizeMSAAFBO ( int source, int dest, int width, int height) {
    glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, source);
    glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, dest);
    glBlitFramebufferEXT(0, 0, width, height, 0, 0, width, height, GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, GL_NEAREST);
    glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);
    glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
}

This "Blits" (how I missed this term from good old Amiga) the source-MSAA (or any FBO if you need that) to dest FBO (created by the function of my first posting).

I found another "solution" several days ago, where some guy wrote that he "antialiases" his Screen by creating a FBO with twice size of the Backbuffer. I didn't like the solution so I didn't really tried it out, but I readed in some OGL Specs that FBO Rendering on newer cards should be the fastest solution.

11
After finishing the movie-database-project I got bored again and started last Friday something - I don't know what it will look when it's done..but I wanted to render something different than 2D/cubes and I wanted to explore OGL a little bit deeper than in my previous codes.. But it will have a "cracktro" style (again), aimed size is under 40k.

Cu.



12
C / C++ /C# / Re: OGL: Loading Images From Memory
« on: November 13, 2012 »
The screen is obviously being rendered to something other than a texture.

No idea how to use that as it doesn't tell have any examples. Maybe have to set the view to ortho and grab the pixels some how.

But thanks for the link. Appreciate it.

Offscreen Rendering using OGL is very very simple and you can use generic functions to generate everything you need.

Here you have an example how I create a FrameBufferObject:
Code: [Select]
struct FBOELEM {
    GLuint fbo;
    GLuint depthbuffer;
    GLuint texture;
    GLuint colorbuf;
    GLint status;
};

...

int createFBO ( int count, struct FBOELEM *buffers, int width, int height, int filter ) {
    int current, enderr = 1;
    GLenum error;

    for (current = 0; current < count; current++) {
        glGenFramebuffersEXT (1, &buffers[current].fbo);
        glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, buffers[current].fbo);
        glGenRenderbuffersEXT (1, &buffers[current].depthbuffer);
        glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, buffers[current].depthbuffer);
        glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, width, height);
        glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, buffers[current].depthbuffer);
        glGenTextures (1, &buffers[current].texture);
        glBindTexture (GL_TEXTURE_2D, buffers[current].texture);
        glTexParameteri (GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, filter);
        glTexParameteri (GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, filter);
        glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8,  width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
        glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, buffers[current].texture, 0);
        // check if everything was ok with our requests above.
        error = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
        if (error != GL_FRAMEBUFFER_COMPLETE_EXT) {
            buffers[current].status = 0;
            enderr = 0;
        }
        else
            buffers[current].status = 1;
    }
    // set Rendering Device to screen again.
    glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
    return (enderr);
}

void enableFBO ( int fbo, int width, int height ) {
    // thus cannot have a larger request than tex size!
    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
    glPushAttrib(GL_VIEWPORT_BIT);
    glViewport(0, 0, width, height);
}

inline void disableFBO () {
    glPopAttrib();
    glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
}

I think this is self-explaining what it does.

Just call createFB() to create n FBO's and if you want to render something to one of the screens call enableFBO(myFBO[n].fbo), render your stuff to offscreen and don't forget to switch to the backscreen after you've finished using disableFBO().

If you want to use the rendered texture call glBindTexture(GL_TEXTURE_2D, myFBO[n].texture). You can use it like a loaded Texture Bitmap.

Hope this example helps :).

Brgds.

13
Great Competition!

congrats to the winners!

14
Hi Guys!

Just wanted to say hello and report what I've done the last few weeks (this maybe sound a bit nerdy  ;D ).

I've a movie and TV collection with about 5000 files containing it, and a hardware Mediaplayer to render this stuff to tv.
After a while it was nearly impossible to browse my collection, just imagine you want to watch a movie starting with letter "J"..it was really annoying.

So I installed a Manger for this called "yamj" (Yet another movie jukebox), which downloads information, posters from the net and stores the information in several XML Files. A nice solution, but not nice enough for a lazy person like me :). This brought me to the next step: Making a website, containing my movies and TV Shows. This was done really fast using a template system and PHP/MySQL.

But I missed something... I was not really happy that I can browse my stuff on the web, but I was just not able to start a video from my webpage. This "evolved" to the next level: Add a function to the page which uses UPnP to tell the Mediaplayer to play file X. After a while of browsing the net I found the theory how to do it but I didn't found a program which was able to play a file, only using the commandline. So I did this too (and UPnP is a very annoying protocol...).

I packaged this stuff and uploaded it to a GIT repository: https://github.com/theknurz/yamj-ro-suite

If you have readed this.. I warned you..it's a bit nerdy  ;D

BTW, nice competition again, if I find time, I'll distribute something :).

Byebye

15
General chat / Re: The Secret World
« on: July 04, 2012 »
Hey!

I'm a really MMO Addict and I've also tried TSW Beta and I buyed it last week online. I also played Age of Conan...
Yea the game is definitely a great try to do something different on the MMO-Market.

You've done (or learned from AoC) so much right, it really really makes fun to splash Zombie/Drough Faces :).
The Graphics are more than stunning (Savage Coast the Wood where the Treehouse hangs is more than an eyecatcher, its epic!), the sound is perfectly synchronized to the "mood" from your character. I love the shader which you apply when you are dead or when you try some mushrooms ;).
FC also learned that the users don't care about lights (in Tortage ^^) and care more about the gameplay itself. PvP is also great (love slaughtering at stonehenge :D ).
Default-UI is the BEST one I've seen for years, you don't need any UI-Addons.

Tentonhammer rated TSW at 85% or so, I rate it above 90%. ;)

Guys if you want to play a really nice adult MMO, try TSW.
(And I'm not in any way affiliated with FC ^^).

Some critics from a 10+year MMO Gamer:
The chat system is horrible.
No dungeon finder in 2012 ? Mhh ok, i like the social interaction and don't need it, but some friends already complained about that.
Please fix the PvP-queue-bug :)

But FC has done a really great job, I was afraid (after I've played AoC) that the "Funcom"-Effect strikes again in this games (First levels are great, than more than flat).

Great job, great game, absolutly great storyline!

cu.

PS.: BUFF SHOTGUN!  :||

16
Are you setting your viewport to the right dimensions ?

Code: [Select]
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
glPushAttrib(GL_VIEWPORT_BIT);
glViewport(0, 0, width, height);

17
Projects / Re: New and Last Intro
« on: June 16, 2012 »
Catchy chiptune, and screen #2 is REALLY great :)

18
Nice! Thanks :)

19
Challenges & Competitions / Re: [CUBES] HTTSC
« on: June 14, 2012 »
Yeah K+++++ for the src :updance:

Oops, that reminds me. Will post mine soon, promise!

Waiting for it too :). (because raymarching hurts my brain...  :inspired: )

20
General chat / Mathematics on youtube [GERMAN]
« on: June 07, 2012 »
Hi!

http://www.youtube.com/watch?v=mWN0cA_Ngk4&list=PL526B83B6A68B8759&index=13&feature=plpp_video

Wer sich mit Mathematik genauso schwer tut wie ich, das eine recht anschauliche Version des ganzen Vektorenkrams und mit der Rumrechnerei desselben. Wenn man auf den Channel des Users geht sind da noch etliche andere Mathevorlesungen aufgezeichnet, aber da ich eher noch bei den Basics bin, poste ich mal das. :)

lg.

Pages: [1] 2 3