Opengl glow...?

Started by
26 comments, last by JavaCoolDude 18 years, 11 months ago
Quote:Original post by JavaCoolDude
[Honest attempt to help]
I'm in the process of writting a demo that exploits both HDR and GLOW techniques desribed above by fellow members, do you want me to send you a PM when I'm done with the source and hinaries?
[/Honest attempt to help]


Ahhh, sure that would be good :D
Advertisement
(seeing the nickname) in C++ or Java? :-p

Well i would be interested in anything about HDR, since i know zero (well almost) about this.

@kc:
It depends on your "blur" and "contrast" filters. The less the blur, the more the sharpness (but from a point and after it won't be glow anymore). Also the more the contrast (=the larger the N), the less the amount of the image that will be presented in "glow".

Experiment.
--Slashstone - www.slashstone.comNerveBreak free scripting system.
In C++ of course, my nick comes from the fact that I was soooooooo into Java like a year ago before taking Computing IV (C++) in college, and ever since, I only swear by C/C++ and ASM [embarrass]
Quote:Original post by JavaCoolDude
In C++ of course, my nick comes from the fact that I was soooooooo into Java like a year ago before taking Computing IV (C++) in college, and ever since, I only swear by C/C++ and ASM [embarrass]

What's wrong with Java? :)
Considering all your (really cool!) demos you post here for some time - they'd all run same fast in Java as in C++ since they all seem to be highly pixel rate limited, so the 99% of the job is done by the GPU in them, isn't it? It's clear that Java is 'not best' at 'low overhead' for unit operations nor is it memory allocation friendly, so anything that requires CPU processing is a lot faster using C++, but computer graphics these days is moving more and more towards GPU processing, so Java is slowly becoming considerable option too.
Maciej Sawitus
my blog | my games
Don't get me wrong, I still do a lot of stuff in Java including graphic development as shown here http://xith.org/demo/JavaCoolDude.php, however the lack of templates and direct access to memory left me with a bad taste...
Let's leave it there for now shall we :D
Quote:Original post by JavaCoolDude
the lack of templates and direct access to memory left me with a bad taste...

Java 5.0 comes with generics (read 'templates'), which is basically the same. You can't count on direct access to memory in future Java versions however, I doubt ;-)

Personally, what I miss at most in Java compared to C++ is multi inheritance. A friend of mine is doing a master thesis on how to simulate them in Java using compilation preprocessing and delegates however :)
Maciej Sawitus
my blog | my games
hmm, all right thanks for all your help! can somone just explain one more thing?...or 2 i guess.
how to you make the pixelData and the 512x512 texture? im rather new to all of this :P
To allocate memory for pixelData do:
char* pixelData = new char[512 * 512 * 3];

To upload it to texture created before something like:
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 512, 512, GL_RGB, GL_UNSIGNED_BYTE, pixelData);

And to create texture (done once at startup):
glGenTextures(1, &texId);
glBindTexture(GL_TEXTURE_2D, texId);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 512, 512, GL_RGB, GL_UNSIGNED_BYTE, pixelData);

Hope this help! :)
Maciej Sawitus
my blog | my games
ok, now for some reason its really laggy(some times...the lag seems to build up if i like at it, which is odd) and not working :( heres what i have(sorta of)



glViewport(0, 0, 512, 512);

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, mTextureHandle.getGLName());
glColor4f(1,1,1,1);

glBegin(GL_QUADS);
glTexCoord2f(0,0);
glVertex3f(-QuadHalfSize,0,+QuadHalfSize);
glTexCoord2f(1,0);
glVertex3f(+QuadHalfSize,0,+QuadHalfSize);
glTexCoord2f(1,1);
glVertex3f(+QuadHalfSize,0,-QuadHalfSize);
glTexCoord2f(0,1);
glVertex3f(-QuadHalfSize,0,-QuadHalfSize);
glEnd();

char* pixelData = new char[512 * 512 * 3];
glReadPixels(0, 0, 512, 512, GL_RGB, GL_UNSIGNED_BYTE, pixelData);

glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 512, 512, GL_RGB, GL_UNSIGNED_BYTE, pixelData);

// Restore our canonical rendering state.
glDisable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
dglSetViewport(viewport);

glEnable(GL_BLEND);
// Enable Texturing.
glEnable(GL_TEXTURE_2D);
// Select the objects' texture.
glBindTexture(GL_TEXTURE_2D, texId);
// Set Colour/Alpha.
glColor4f(1,1,1,1);

glBegin(GL_QUADS);
glTexCoord2f(0,0);
glVertex2f(0,0);

glTexCoord2f(1,0);
glVertex2f(1,0);

glTexCoord2f(1,1);
glVertex2f(1,1);

glTexCoord2f(0,1);
glVertex2f(0,1);
glEnd();


And then in the init function i have

char* pixelData = new char[512 * 512 * 3];
//GLuint texId;

glGenTextures(1, &texId);
glBindTexture(GL_TEXTURE_2D, texId);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 512, 512, GL_RGB, GL_UNSIGNED_BYTE, pixelData);
Ouch, it should be laggy...
This
char* pixelData = new char[512 * 512 * 3];
should be done only once, at initialization time.
Maciej Sawitus
my blog | my games

This topic is closed to new replies.

Advertisement