how to simulate a lamp in libgdx? [closed] - opengl

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am using libgdx and I was wondering how to simulate a lamp.
What I mean is that I have a background texture and all the colors in it are pretty dark becuase it is suppose to a dark environment. What I want to do is to grab a region of the texture and make all the colors brighter like if it there was a lamp somewhere.
Now, the lamp is supposed to be moving and that will be calculated at run time so it is unpredictable to know where it would be, and the only thing that comes to my mind is to get every pixel from the texture and get the color and just change the rgb values to be higher to have that effect.
The thing is that the lamp is suppose to be moving a lot. It wont stop moving until the game is over and I feel that changing the color of every pixel is kind of a heavy process. Is there another way to it?
By the way, the game is a cartoon so I don't need the lamp too be realistic.

Could you instead layer an alpha blended transparency to darken the visible area except where the lamp is? I plan to use this to achieve a pseudo-lighting effect in a game.

Related

Using homography for a virtual monitor [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm currently working on a project where I need to create a virtual screen for feedback during a game
My program draws an image at a tracked position. What I wan't it to do is to have this image follow my 4 tracked points, so it scales and rotates.
What I need for this is to get the homography to work, and I'm sorry to ask this question, because I know there's a lot of different articles, and I've been trying to go through quite many of these, but they don't make much sense to me. The issue i'm facing right now is that I don't know how to.
I can get it to scale the texture or the content of the image but it remains the same format of height and width. It doesn't rotate it, right now since I don't have a update function for it yet, which I don't know how to create either. I need it to stretch the picture itself so it scales accordingly to the points tracked.
With this post I hope you can help me in the right direction for just scaling the format of my image accordingly, that would be a major break-through for me.
I'm using openframeworks with openCV and ofxCV addons in Codeblocks (C++) on windows 7.
There's some functions in the addons of ofxCv, I'm pretty confused about:
For instance, I have not much idea of how the "imitate();" works and what it does.
This neither:
"homography = findHomography(Mat(dstPoints), Mat(srcPoints);"
and the: "warpPerspective(origImg, warpImg, homography, CV_INTER_LINEAR);"
I'm not sure I'm using these correctly, and have had difficulties finding proper documentation on these, that makes sense to me.
Another thing I have doubts about, is the usage of matrices in regards to this task.
As you've propably already figured out, I'm really not an experienced programmer. Any help in the right direction would be much appreciated!
This is a paste of all of the code: http://pastebin.com/MFfJqGZ1
The most interesting part, or where I personally believe I'm missing something or have done something wrong is between line 199-223.
And heres the header file: http://pastebin.com/XfQySAmh
Thanks so much in advance
Best regards
Jesper

Create a 2D world [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
Ive got a project for school that is to create the tanks game ( like worms or something else )
With a little research I found that the best way to create the 2D world would be to hold a bitmap of 1 and 0 to switch between background and foreground. So that I could load 2 images one for the background like the worms game the sea or something and another image with the map that is placed on it. Now because of that bitmap if I shoot something I could simply replace a 1 in a 0 so that there is a whole in the map..
With QT I could then just draw a canvas where I could display that bitmap.
I just don't find how to program this, maybe someone could help me out, where to start?
What you're describing with the 1's and 0's is called transparency and bitmaps can be made to encode this information in them, usually known as the alpha channel.
The key is to break down the problem into smaller parts and then tackle each small part - your question is very broad. So, break it down like this:
Create a window
Draw a bitmap on the window (no transparency - it's the background)
Draw a second bitmap with transparency
Modify transparency of second bitmap at run time
Although I think the qt is not the right tool for that, you can start with Graphics View Examples. That should give you a quick start.

Creating 3D Models for a Game using Blender and Bloom Effect in Graphics [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I am creating a game that requires heavy use of 3D Models. I started using Blender for creating models. Here are some models which I came across while developing a model
I need to create a model of a Cube with Horizontal Grooves/Depressions and impart glow to those Grooves. I went through a blender tutorial which described how to impart glow to certain objects but I don't how to create a Cube with Grooves/Depressions.
Second Question is related more to the field of Graphics. What is Bloom effect ? Is it related to lighting models in any way? How do I impart it using Opengl and C++ ?
I can only try to help you with your second question, since I'm not experienced with blender. A Bloom effect is a graphical effect to visualize strong light sources. It is often implemented as a shader. The wikipedia article is actually quite interesting.
You should be able to find tons of tutorials for both OpenGL and DirectX respective their shader languages. A quick search provided these, which look promising:
http://prideout.net/archive/bloom/
http://doenemeier.de/2011/03-opengl-bloom-shader.html

GDI+ performance for pixel level rendering [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I am doing some animation based on an algorithm that is supposed to render a scene at 800 x 600 resolution. It will essentially be redrawing each pixel for every "frame" at, hopefully, no less than 30 FPS.
Would this be possible?
I guess I would be drawing bitmaps.
Thanks
The fastest bitmap pixel format on most hardware is 32PArgb. A 800x600 bitmap takes about 8.5 milliseconds on my laptop when drawn unscaled with Graphics::DrawImage(). It has decent graphics hardware. This goes up to 12 msec for other pixel formats.
What you can't predict is how much time you'll burn rendering the scene. That's going to set your true FPS limit. Graphics libraries like DirectX and XNA store texture bitmaps in video memory to speed up the rendering, you won't get this from GDI+.
You haven't told us how you intend to draw the scene (using what method). If by "pixel level" rendering you mean calling SetPixel() method, you should take a look at things like http://supercomputingblog.com/graphics/using-lockbits-in-gdi/
The push of modern hardware is way, way, way in excess of those demands.

How to create this desktop recorder? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I want to create a desktop recorder that require very little HD space.
It should capture the current display into a buffer, compare it to the previous state, and save only the rectangles that differ to the previous state.
What API, function or library I have to use ?
Well if you want to save the differences from each frame to frame only you could simply use a substraction-method. Simply substract the color values at image(t+1) from image(t)... All parts that stay equal haven't changed... only the parts that are different will result in something non-zero. You can then extract the rectangles around it and save them. But of course be aware since there might be more than one part changing of course and you probably wanna save each one instead of the big rectangle that contains all changes...
You could use OpenCV for this... it has all basic functions for image substraction, rectangle fitting, cropping, ...
Hope that helps...
Consider using Windows Media Screen Capture encoder for the task. You will feed your captured frames to it, and it will do the rest and create highly efficient wmv file for you.