Welcome, Guest. Please login or register. Did you miss your activation email?

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.


Topics - cmbrgames

Pages: [1]
1
Graphics / Problem with using NTSC shader
« on: September 01, 2013, 03:33:47 pm »
I'm trying to use this shader in SFML: http://www.mediafire.com/download.php?touakpcbs2ujqcp

Here's the 1st pass vertex:
Code: [Select]

      uniform mat4 rubyMVPMatrix;
      attribute vec2 rubyVertexCoord;
      attribute vec2 rubyTexCoord;
      varying vec2 tex_coord;

      varying vec2 pix_no;
      uniform vec2 rubyTextureSize;
      uniform vec2 rubyInputSize;
      uniform vec2 rubyOutputSize;

      void main()
      {
         gl_Position = rubyMVPMatrix * vec4(rubyVertexCoord, 0.0, 1.0);
         tex_coord = rubyTexCoord;
         pix_no = rubyTexCoord * rubyTextureSize * (rubyOutputSize / rubyInputSize);
      }

1st pass fragment:
Code: [Select]
      varying vec2 tex_coord;
      uniform sampler2D rubyTexture;
      uniform int rubyFrameCount;
      varying vec2 pix_no;

#define PI 3.14159265
#define CHROMA_MOD_FREQ (0.4 * PI)
#define CHROMA_AMP 1.0
#define ENCODE_GAMMA (1.0 / 2.2)

      const mat3 yiq_mat = mat3(
         0.2989, 0.5959, 0.2115,
         0.5870, -0.2744, -0.5229,
         0.1140, -0.3216, 0.3114);

      vec3 rgb2yiq(vec3 col)
      {
         return yiq_mat * col;
      }

      void main()
      {
         vec3 col = texture2D(rubyTexture, tex_coord).rgb;
         vec3 yiq = rgb2yiq(pow(col, vec3(ENCODE_GAMMA)));

         float chroma_phase = PI * 0.6667 * (mod(pix_no.y, 3.0) + float(rubyFrameCount));
         float mod_phase = chroma_phase + pix_no.x * CHROMA_MOD_FREQ;

         float i_mod = CHROMA_AMP * cos(mod_phase);
         float q_mod = CHROMA_AMP * sin(mod_phase);

         yiq = vec3(yiq.x, yiq.y * i_mod, yiq.z * q_mod);
         gl_FragColor = vec4(yiq, 1.0);
      }

Looking at the examples in SFML I think I need to somehow modify these to get them to work in SFML, but I have some trouble.  What should I put in place of rubyMVPMatrix, rubyTexCoord and rubyVertexCoord? I tried replacing rubyTexCoord with gl_TexCoord[0] but that gave me errors.

2
Hello
I'm making a Contra-style shooter using SFML with randomly generated levels. The graphics are terrible because I suck at drawing but maybe the gameplay will turn out better  :P For the moment I'm planning to release a demo with one level and a boss fight.

What I plan to add to the game:
- 10-20 different types of enemies
- 6 weapons including the spreadgun and a sword; each of the weapons can be upgraded once by picking it up again
- Gradius-style powerup system
- Shrines placed around the level that can give you random good or bad effects
- Challenge rooms which if you complete them you'll get a 1up or some other bonus


DOWNLOAD ALPHA 1 VERSION (2MB)
Devlog @ tigsource
Level generator info

Screenshots:



Pages: [1]