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 4 5
Projects / Re: Something small...
« on: March 15, 2018 »
wow! this is a really cool intro! :D i love the text effect and star! x3 big props, man! = D

also thaanks a lot for the source too! = 3

Thanks =). Unable to paint anything, I have to use something simple  ::)

You're welcome, it's not very good with comments, if you have any questions, just contact me.

Projects / Re: Something small...
« on: March 10, 2018 »
That is really neat!  :goodpost:

Appreciate, glad you like it  :||

Projects / Re: Something small...
« on: March 08, 2018 »
Works pretty fine now, very oldschoolish intro for sure  :D

Looking forward to see more GL3 experiments :)

I'm very glad it did not crash  ;D

Next one will be a little bit longer =)

Projects / Re: Something small...
« on: March 07, 2018 »
Hi Rbz!

I edited my first post and attached an, which contains the non-packed executable.

(didn't use kkrunchy for that reason, but bero's packer seems to be on the blacklist too).

@Knurz I'm so glad you liked it! +O+ also i'm amazed you are still willing to help even after it is released; thanks you so much, man! also wOW i never though about managing one long charset image with UV Mapping! that's so damn clever! =' D

also yea, they are very costly :c in fact that was made me have to shorten the greets ;-; rip BUT once i sort that out i'll ensure myself everyone that helped me on DBF are in this time x3

also absolutely! :D i'll have arrays or one recursive function that do the work of all the objects next time lmao, thaanks you so much for your useful hints and help! you rocks!~ =' D

@Rbz i'm very happy of your approval; thaanks, man!~ +O+

Hey! Glad I could bring some ideas to you.. probably everyone did his first scrolltext like you did  =).
Hope to see more prods from you and your team in near future!

Have Fun! =)

Projects / Something small...
« on: March 04, 2018 »

I played around with GL3 a little bit the last two weeks and want to show what the result of my journey is =).
Nothing big, just a one-screener Amiga-like intro.

As always, source included. In the is a file called wobjbin.c, which is an importer for 3D-Formats based on assimp ( It's written on linux, using gcc-32, so you may run into troubles compiling it on win.

Have fun!

General chat / Re: The Welcoming Committee
« on: March 01, 2018 »
Yeah, we need more C Coders onboard =)


Very well done mate! I like the style you aimed for very much (just watched the yt video, bc I only have linux in the office).

I downloaded the code too and you put ALOT of lines and work in to that. Just one thing I saw in your code.

You're loading one single char into a texture, which is technically fine, don't get me wrong, but it's alot to write and alot to compile =).
I just wanna give you an idea to make font-printing/scrolltexts easier. Remember the UV-Mapping we talked about in the other thread you openend ?
Let's say you have an image where ALL of the character you want to use are in a row like: ABCDEF... and so on.
You could upload the whole image into a texture and use the UV-mapping to "cut" one character from the texture and map it to the quad you're using.
(If you need some example codes, I'll can post them here).

Try to avoid too much usage of glPop/glPushMatrix (GL has to do stack-operations every time, which could consume more time than you have left for a single frame).

Try to use more arrays, it'll help you ALOT cutting down the lines of your sourcecode, like the further_snow_transparency_* variables. Just an idea if you say
Code: [Select]
float further_snow_transparency[20];
You could cut down the source by simply doing a iteration over the array:
Code: [Select]
for (int c=0; c<20;c++) { further_snow_transparency[c] -= (float)(rand() % 27583) / 100000.f; }
You can do this ofc with further_snow_v_move too =).

Again, lovely visuals, nice sound, very well done!



Oh no you're giving me too much attention =). Glad I could help and thanks that you will release the source!

I'm glad it worked! (greetings are always appreciated :D)

If you want to use different textures in your project, just load another file with UPNG and do the stuff you did with the first texture again(glgentextures, glbindtexture, glteximage2d...) but with the 2nd texture to upload it to your GPU.  After that, you can simply switch the current texture by using glBindTexture with the new texture-id again:

Code: [Select]
glBindTexture(GL_TEXTURE_2D, texture);
  glTexCoord2f(0.0, 0.0);   glVertex2f(-0.3f,   0.3f);
glTexCoord2f(1.0, 0.0);   glVertex2f(0.3f,  0.3f);
glTexCoord2f(1.0, 1.0);   glVertex2f(0.3f, -0.3f);
glTexCoord2f(0.0, 1.0);   glVertex2f(-0.3f, -0.3f);

glBindTexture(GL_TEXTURE_2D, texture_2);
  glTexCoord2f(0.0, 0.0);   glVertex2f(-0.3f,   0.3f);
glTexCoord2f(1.0, 0.0);   glVertex2f(0.3f,  0.3f);
glTexCoord2f(1.0, 1.0);   glVertex2f(0.3f, -0.3f);
glTexCoord2f(0.0, 1.0);   glVertex2f(-0.3f, -0.3f);

Just be sure that you don't mess around with texture within your glbegin...glend block, this would probably result in an error.

Something to consider in your project..because I saw it in your code.. you're calling glBindTexture(...) twice. First you do the preparations for the texture, then you bind it again. This isn't necessary, because GL is a "state machine", everything you set stays in it's state until you change it. You're calling glPushMatrix() and glPopMatrix() without doing any matrix operations within it's logical block.  (I'm just saying because GL calls are limited and expensive)

Happy coding! =)


You're very welcome =).

If you're using ANSI-C you could use UPNG.

UPNG compiles without any prerequisites with gcc:
Code: [Select]
majortom@vdr:~/coding/c/upng/upng$ gcc -c upng.c -o upng.o
majortom@vdr:~/coding/c/upng/upng$ echo $?

Here's an example (png = compressed PNG, pngsize=size in Bytes of png):
Code: [Select]
GLuint createTexturefromPNG (unsigned char *png, size_t pngsize, GLint filter) {
GLuint texture = 0;
upng_t *pngt;
unsigned int format = 0;

glGenTextures(1, &texture);

if (!texture) return (texture);

pngt = upng_new_from_bytes(png, pngsize);


if ( (upng_get_error(pngt) != UPNG_EOK) || (!texture) || (!pngt) ) {
if (pngt) upng_free(pngt);
return (0);

format = upng_get_format(pngt);

glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, format == UPNG_RGB8 ? GL_RGB : GL_RGBA, upng_get_width(pngt), upng_get_height(pngt), \
0, format == UPNG_RGB8 ? GL_RGB : GL_RGBA, GL_UNSIGNED_BYTE, upng_get_buffer(pngt));
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
glBindTexture(GL_TEXTURE_2D, 0);


return (texture);

This only supports RGB and RGBA Images - no other fancy stuff.

What I forgot to mention in my first reply is that you have to glBindTexture(GL_TEXTURE_2D, <your_texture_id>); before rendering your object.



Last question first, you can use PNGs without any libraries, there are many PNG decoders out there, like (which I prefer, because of it's size).

Let's assume you have the image in RGBA Format uncompressed in memory, first of all you'll have to tell GL to generate a texture:
Code: [Select]
glGenTextures (1, &myTexture);
You'll have to bind the texture for the operations to follow:
Code: [Select]
glBindTexture (GL_TEXTURE_2D, myTexture);
And you'll have to describe to GL what size and format your image has (please take a look at the API Manual, there are many options!):
Code: [Select]
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, myTexture_width, myTexture_height, 0, GL_RGBA, GL_UNSIGNED_BYTE,  uncompressedMemoryTexture);
If you have done any errors in your previous steps, you will notice it when calling glTexImage2D =).
We can change the filtering of our texture:
Code: [Select]

After you've done all that, unbind any texture:
Code: [Select]
glBindTexture(GL_TEXTURE_2D, 0);
Somewhere in your code you have to enable the usage of textures:
Code: [Select]
In your code where you do the rendering you'll have to pass a UV-Coordinate to every vertex you pass to the pipeline to tell GL how to map the image onto the vertex.
Imagine this:

and use glTexCoord2f(s,t) and pass the coordinates to gl.

Nehe has good examples for mapping:

Bye =).


Transparency is very tricky to do right because you have to be very cautious to order your vertices from the most far to the closest one.
But a quick answer would be:
Code: [Select]
glEnable (GL_BLEND);

Maybe helps you to achieve what you want to do.

It's written in and for delphi but the approach he uses should be valid for PB too.

I don't know if you can produce 64bit PE with dynamic added data, but it should work with 32bit PE.

Purebasic / Re: Amiga Rasters Effect
« on: May 23, 2016 »
I'm sure one of you PB-guys can provide him a simple code for a fullscreen GLSL-"Loader"..

Let the GPU do the work  ;D

Purebasic / Re: Amiga Rasters Effect
« on: May 23, 2016 »

This is my "version" of Rasterbars, done in GLSL. I wouldn't use precious GL-Calls to draw lines =).

Code: [Select]
#define PI 3.1415926
#define MAXRAST 7.
#define RASTERS 12
#define ANG2RAD PI/180.
#define ORIGIN_Y 500

uniform float time;
uniform vec2 resolution;
uniform sampler2D myTex;

void main( void ) {
vec3 baseCol = vec3(0.7, 0.3, 1.0), outCol = vec3 (0., 0., 0.), txtCol;
vec2 p = gl_FragCoord.xy / resolution.xy;
float maxRast, RASTLINES = 8., YBASE = .7, yd = -1., rd = 8., rdd = 64., sa;
int c;

RASTLINES = (RASTLINES / float(ORIGIN_Y) ) * resolution.y;
maxRast = 1./resolution.y * RASTLINES;
txtCol = texture2D(myTex, p).rgb;

for (c=RASTERS; c > 0; c--) {
float jd = sin( (2.2*time)+(ANG2RAD*rd*float(c)))*0.14; // base modifier
yd = 1. - (1./maxRast* abs( jd+YBASE - p.y)); // distance from current pos to middle of bar
if (yd > 0.)
break; // hit one ? => leave

yd = clamp(yd, 0.0, 1.0);

if (yd > .0) {
baseCol.r = 0.5 + sin( (time*0.3) ) * .5;
baseCol.b = abs(sin(PI*baseCol.r));
baseCol.g = 1. - sin (baseCol.r +baseCol.b * .5 * PI);
sa = 1./float(RASTERS+1) * float(c);
outCol = baseCol.rgb * (yd * sa);
gl_FragColor = vec4( outCol , 1. );

It's rather primitive and uses the not very efficent for and if statements, but it works better than drawing it with GL_LINES or something similar.

Have fun coding mate.

C / C++ /C# / Re: Vulkan is here!
« on: February 28, 2016 »
At first I figured vulkan would be "just another api" but the more I read about it the more I like it. Having lower-level access to the hardware and a smaller API surface are both awesome benefits, though the external sync stuff looks a bit finicky (at a glance).

That said, the bigger problem (at least in my case) is lack of api/driver support, especially for OS X. While the API may be rad, if I can't use it, I won't :)

As far as I have seen in the samplecodes, it's truly "bare-to-metal", you have to do the most things that GL/DX abstracted for you, manually.
Like uploading a texture to GPU Mem. You'll have to query the card for the formats it's accept, query the card for memory availabe, reserve it and at last you can upload the texture. Sure there will be, in some time, libraries that abstract this stuff, but I think that the lowlevel freaks here will surely have their fun =).

Apple decided to push Metal on their platforms but I'm sure they will support Vulkan sooner or later.

C / C++ /C# / Vulkan is here!
« on: February 18, 2016 »
Hi Guys!

Two days ago Vulkan was released by Khronos with its first final version (1.0.31).

Do you consider to switch from your favorite API to Vulkan or do you stay with DX/GL ?

(I'm posting this in C Forum, because there is only a C/C++ Wrapper available by now).

Have a nice day! =)

Other languages / Re: Democoding with Java?
« on: July 16, 2015 »
I don't know any Java I only had some training with the VM itself (working as a sysadmin)...

Don't you run in any perfomance problems when the STW/GC kicks in ?

What I found quite useful is when using headers is to use a header guard, as often I would get compile errors saying that variables and functions had already been declared.
All you need do is surround your code with:
Code: [Select]
#ifndef _NAME_OF_HEADER_H_
#define _NAME_OF_HEADER_H_


btw, the _H_ is optional.

hope it helps.

Optional you can use #pragma once which should be compiled by the most (modern) Compilers.

horrible, no love for linux. what a shame.

If you do something on Linux, i would be glad to test it.
Running 64bit Arch linux, on i3/GMA4000

Would be nice if you'd like to test my little framework for Linux...

I've attached the executable to my post, if you'd like to have the src itself, just contact me.

The binary should ask you if you would like to run fullscreen, just display the FPS and play a wotw XM as bonus :P, XM player is not done by myself.
It's compiled as 64bit binary with Ubuntu 14.10 and you shouldn't have to install any extra libraries like SDL.

Code: [Select] =>  (0x00007fffd99f8000) => /usr/lib/nvidia-331/ (0x00007f9ec29f7000) => /usr/lib/x86_64-linux-gnu/ (0x00007f9ec2706000) => /usr/lib/x86_64-linux-gnu/ (0x00007f9ec2497000) => /usr/lib/x86_64-linux-gnu/ (0x00007f9ec228d000) => /usr/lib/x86_64-linux-gnu/ (0x00007f9ec1f54000) => /lib/x86_64-linux-gnu/ (0x00007f9ec1c4d000) => /lib/x86_64-linux-gnu/ (0x00007f9ec1a45000) => /lib/x86_64-linux-gnu/ (0x00007f9ec1827000) => /lib/x86_64-linux-gnu/ (0x00007f9ec1462000) => /usr/lib/nvidia-331/tls/ (0x00007f9ec125f000) => /usr/lib/nvidia-331/ (0x00007f9ebea50000) => /usr/lib/x86_64-linux-gnu/ (0x00007f9ebe83d000) => /lib/x86_64-linux-gnu/ (0x00007f9ebe639000)
/lib64/ (0x00007f9ec2d4c000) => /usr/lib/x86_64-linux-gnu/ (0x00007f9ebe32a000) => /lib/x86_64-linux-gnu/ (0x00007f9ebe112000) => /usr/lib/x86_64-linux-gnu/ (0x00007f9ebdf08000) => /usr/lib/x86_64-linux-gnu/ (0x00007f9ebdce9000) => /usr/lib/x86_64-linux-gnu/ (0x00007f9ebdae4000) => /usr/lib/x86_64-linux-gnu/ (0x00007f9ebd8de000)

Thanks in advance!

Pages: [1] 2 3 4 5