HELP! 4k problems
category: general [glöplog]
Hey all, I am late and I suck.
I am having problems with Auld's Perlin Noise code. I am trying to modify it so that it 1) doesn't create GL textures and all that shit (I don't have time to use them anyway), 2) is 512x512 instead (not done).
I need it for height map generation.
The problem is that alpha blending does not seem to work for me. Here's what I've done:
1) Created a new quadric, and explicitly set it to generate uv coords (works)
2) Enabled depth testing, set the clear color
3) Called this function:
The texture is then stored in rarray.
Notice: I didn't modify it to write to 512x512 texture yet, though rarray is 512x512 big.
the problem: It appears that the texture does not get blended together. Also, the quadric doesn't look like it's at the right place, but that's fixable.
Screenshot:
If someone could help me I would be very happy. I also have problems getting lighting to work (or rather, I didn't look into it). Right now, everything I have is just flatshaded/globally illumated. However, I don't do any backface culling because I need both sides of my polygons visible, and this mean that I can't just do diffuse lighting or something simply like that.
LG.
I am having problems with Auld's Perlin Noise code. I am trying to modify it so that it 1) doesn't create GL textures and all that shit (I don't have time to use them anyway), 2) is 512x512 instead (not done).
I need it for height map generation.
The problem is that alpha blending does not seem to work for me. Here's what I've done:
1) Created a new quadric, and explicitly set it to generate uv coords (works)
2) Enabled depth testing, set the clear color
3) Called this function:
Code:
GLubyte rarray[512*512];
static void captureNoiseTexture (const uint per, uint noct)
{
uint s=512;
uint i;
// enable blending
glEnable (GL_BLEND);
glEnable(GL_TEXTURE_2D);
// set standard blending function
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// persistance in alpha
glColor4ub (255,255,255,per);
do {
// we could use s*s but its more bytes...
i = 256*256;
// an array of random values...
while (i) {rarray[--i]=rand();}
// halve the resolution of texture each octave
s >>= 1;
newTexture (1, 1, s, GL_LUMINANCE, &(rarray[0]));
gluDisk (q, 0, 1, 16, 1);
} while (--noct);
// now capture what we drew and put it into a texture
glReadPixels (256,256,512,512,GL_RED,GL_UNSIGNED_BYTE,rarray);
glDisable(GL_TEXTURE_2D);
glDisable (GL_BLEND);
}
The texture is then stored in rarray.
Notice: I didn't modify it to write to 512x512 texture yet, though rarray is 512x512 big.
the problem: It appears that the texture does not get blended together. Also, the quadric doesn't look like it's at the right place, but that's fixable.
Screenshot:
If someone could help me I would be very happy. I also have problems getting lighting to work (or rather, I didn't look into it). Right now, everything I have is just flatshaded/globally illumated. However, I don't do any backface culling because I need both sides of my polygons visible, and this mean that I can't just do diffuse lighting or something simply like that.
LG.
Oh, I call the function like this:
captureNoiseTexture(120,7);
depending on the persistence (120 in this case), it just goes lighter and darker.
captureNoiseTexture(120,7);
depending on the persistence (120 in this case), it just goes lighter and darker.
What values do you use for 'per'?
Do you have depth testing enabled?
Do you have depth testing enabled?
Yup, I did! It works now! Thanks :)
oh and for lighting, just put one light where the camera is, that helps a lot already. put random shades of white for ambient diffuse and specular and you've got standard lighting without much effort. i think. maybe others have better tips.
What skrebbel said, but make it random shades of green.
OK, I did this in my init code:
glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient);
glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse);
glEnable(GL_LIGHT1);
glEnable( GL_LIGHTING );
glShadeModel(GL_SMOOTH);
However, it doesn't preserve the original colors of the fragments. Any clues?
glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient);
glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse);
glEnable(GL_LIGHT1);
glEnable( GL_LIGHTING );
glShadeModel(GL_SMOOTH);
However, it doesn't preserve the original colors of the fragments. Any clues?
glEnable(GL_COLOR_MATERIAL);
you'll make it!!!
Uhh, it looks nice.
SOMEBODY GIVE ME A NICE WAY TO DO A GRADIENT SKYBOX! QUICK!
wake up neo, nineties want their multitexturing hacks back to home.
glcolor
glvertex
glcolor
glcolor
glvertex
glcolor
glvertex
glcolor
glvertex
glcolor
glvertex
something like that should work...
glvertex
glcolor
glcolor
glvertex
glcolor
glvertex
glcolor
glvertex
glcolor
glvertex
something like that should work...
or
varying vec2 p;
main()
{
gl_Fragment = vec4(p.y, 0.0, 0.0, 0.0);
}
varying vec2 p;
main()
{
gl_Fragment = vec4(p.y, 0.0, 0.0, 0.0);
}
Bad request :P
Time to learn glsl!
Lord Garga: make 4 quads forming the walls of a cube, with the bottom color to a bright brownish white, and the top color to a sky blue. and as a roof make a sky blue quad.
now add lazers, multiplexed normalmaps with paralax mapping and self shadowing inc. ambient occlusion and you'll be fine.
uh, I am so gonna have lazer in the demo then.
Speaking of which, how do I make light that is more like a torch than a sun? i.e, if I have a green floating ball which is supposed to light up only a tiny part of the area which it is in, and not all of the scene?
Speaking of which, how do I make light that is more like a torch than a sun? i.e, if I have a green floating ball which is supposed to light up only a tiny part of the area which it is in, and not all of the scene?
you probably want distance attenuation?
Code:
glLightf(GL_LIGHTix GL_CONSTANT_ATTENUATION, 1.0f)
glLightf(GL_LIGHTix GL_LINEAR_ATTENUATION, 0.2f)
glLightf(GL_LIGHTx, GL_QUADRATIC_ATTENUATION, 0.08f)
Uh, yes please. Thanks. Do I need anything else than that? Diffuse/Ambient/etc?
OK, getting fucked here. Any simple functions which can play back midi files, or do I have to fuck around with gm.dls myself?
Weapons. Lots of weapons.
Well, you could try this player.
I never used it, cause I prefer to code my own softsynths, but Chip/Pantuflas Software recently told me about it, cause he used that player in his 4k intro for last Euskal.
But... hey! Less "poueting" and more coding! Hurry up, Lord Graga!
I never used it, cause I prefer to code my own softsynths, but Chip/Pantuflas Software recently told me about it, cause he used that player in his 4k intro for last Euskal.
But... hey! Less "poueting" and more coding! Hurry up, Lord Graga!
In this I used this ugly hack to play MIDI.
1. Drop the midi file to c:\
2.
1. Drop the midi file to c:\
2.
Code:
mciSendString("close all", NULL, 0, NULL) ;
mciSendString("open c:\\e.mid type sequencer alias MUSIC", NULL, 0, NULL);
mciSendString("play MUSIC from 0 notify", NULL, 0, hwnd) ;