GameDev
Strange libpng/zlib crash
bool base::Image::load_png (IODevice &in) { png_byte signature [PNG_SIG_SIZE] = {0}; PNGReader png; PixelFormat format; boost::scoped_array rows; try { // Check signature in.read(signature, PNG_SIG_SIZE); if (png_sig_cmp(signature, 0, PNG_SIG_SIZE) != 0) { throw std::logic_error("Stream is not a PNG image"); } // Setup input png_set_read_fn(png.readp, &in, &on_png_read); png_set_sig_bytes(png.readp, PNG_SIG_SIZE); // Get info and allocate image png_read_info(png.readp, png.infop); switch (png_get_color_type(png.readp, png.infop)) { case PNG_COLOR_TYPE_GRAY: format = LUM_8; break; case PNG_COLOR_TYPE_GRAY_ALPHA: format = LUM_ALPHA_8; break; case PNG_COLOR_TYPE_PALETTE: case PNG_COLOR_TYPE_RGB: format = RGB_8; break; case PNG_COLOR_TYPE_RGB_ALPHA: format = RGB_ALPHA_8; break; default: throw std::invalid_argument("Invalid PNG color type"); } reset(Vec2u(png_get_image_width(png.readp, png.infop), png_get_image_height(png.readp, png.infop)), format, NULL, 0); // Setup transformations png_set_expand(png.readp); png_set_strip_16(png.readp); png_set_packing(png.readp); // Read data rows.reset(new png_bytep [size.y]); for (unsigned int y = 0; y < size.y; y++) { rows[y] = &data.get()[y * pitch]; } png_read_image(png.readp, rows.get()); // Finish return true; } catch (const std::exception &e) { destroy(); error_string = e.what(); return false; } }
PNGReader is just a basic structure that creates and destroys the PNG structs in a way that takes advantage of RAII.
struct PNGReader { png_structp readp; png_infop infop; // Constructor PNGReader () : readp(NULL), infop(NULL) { readp = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, &on_png_error, &on_png_warning); if (!readp) { throw std::runtime_error("png_create_read_struct failed"); } infop = png_create_info_struct(readp); if (!infop) { throw std::runtime_error("png_create_info_struct failed"); } } // Destructor ~PNGReader () { if (infop) { png_destroy_read_struct(&readp, &infop, NULL); } else if (readp) { png_destroy_read_struct(&readp, NULL, NULL); } } };
I can't find any problems in my code that would cause zlib to crash. I even replaced the PNGReader struct with manual calls and got the same results. Here's the stack trace:
#0 0x00007ffff6676975 in raise () from /lib/libc.so.6 #1 0x00007ffff6677deb in abort () from /lib/libc.so.6 #2 0x00007ffff66b36ae in __libc_message () from /lib/libc.so.6 #3 0x00007ffff66b9326 in malloc_printerr () from /lib/libc.so.6 #4 0x00007ffff4b8fb5a in inflateEnd () from /usr/lib/libz.so.1 #5 0x00007ffff7749707 in ?? () from /usr/lib/libpng15.so.15 #6 0x00007ffff774997a in png_destroy_read_struct () from /usr/lib/libpng15.so.15 #7 0x000000000040e8c7 in PNGReader::~PNGReader (this=0x7fffffffe410, __in_chrg=<optimized out>) at src/base/image_png.cpp:78 #8 0x000000000040e507 in base::Image::load_png (this=0x7fffffffe4f0, in=...) at src/base/image_png.cpp:166 #9 0x0000000000406244 in get_texture (path=...) at src/resource.cpp:94 #10 0x000000000040b307 in vd_main (args=...) at src/main.cpp:36 #11 0x000000000040b523 in main (argc=1, argv=0x7fffffffe7f8) at src/main.cpp:75
Has anyone had a similar error when using libpng or zlib? Any help is appreciated.
Principles of an Indie Game Bottom Feeder
Moving into indie development? Find an underserved niche audience, "accept what you can't change, be as awesome as you can, charge what you're worth, and stand proud on the ocean floor," writes Spiderweb Software's Jeff Vogel.
Rogue-Like Game Library. Mac
Moving objects with user input
How do I set a key to move an object?
Like, click u and the object moves up a fixed distance over time. Like it moves up 1 on the graph if you click u, but over time like a sprite in game maker or something.
Do I need something besides opengl and some libraries to do this? glTranslate moves where an object first appears if you change a value before launching, so could I just change the initial value in that function somehow?
nvm. I found this amazing thing that helped me. just took some more work with my googlefu.
What Game engine should i use!
Mir2: http://mir2.gamepotusa.com/
or
Magic World Online: http://mwo.enjoymmo.com/
any help would be greatly appreciated.
thanks - Josh
Ovelin raises $1.4M for music education games
Newsbrief: Finnish startup developer Ovelin has raised $1.4 million in funding, with which it plans to expand on its WildChords guitar-teaching game for iPad. Released last year, WildChords uses audio technology to listen to the sound of a guitar, and allows the player to progress through the game and earn more points if they are playing the correct chords and notes. The round of funding was led by VC firm True Ventures, reports TechCrunch. Ovelin ...
Rift heading to China, in 'biggest game deal ever' for a Western MMO
Trion CEO Lars Buttler revealed today that his company's MMO Rift is coming to Chinese audiences via Chinese MMO giant Shanda -- and that this is just another step in the company's plans for global domination. "Let's say we dated a few, and they dated a few, and we fell in love," says Buttler, speaking of the Shanda's decision to operate Rift in China -- and Trion's own decision to go with Shanda. "They are ...
Simple API to encode movies
I am looking for a cross platform (Windows, Mac and Linux) library tat allows me to create movies from my openGL buffer content. It doesn't need to be anything fancy, best would be if I simply had following routines:
- char recorderInitialize(int resolutionX,int resolutionY,cont char* fileAndPath,int framerate);
- char recorderAddFrame(const unsigned char* buffer);
- char recorderEnd();
Of course I could wrap an api into above's routines, but I am at a loss about what API to use.
Any help or hint is greatly appreciated!
3D tv rendering
I have been looking for a decent and simple tutorial to show the steps required to render a native image that supports 3D so on a 3Dtv or Monitor you get depth in the image. If anyone knows of anything that may be of interest please share it.
Do I only need to double the framerate and offset the left and right images correctly or is there more to it?
My test tv will be http://www.panasonic.co.uk/html/en_GB/Products/VIERA+Flat+Screen+TV/2011+LED+%26+LCD+TV/TX-L37DT30B/Overview/7098157/index.html
Thanks in advance.
hinchy
pre-rendered cutscenes in LUA?
How can I add a pre-rendered cut-scene / movie in LUA?
such as many people do, the user triggers the zone and the movie plays...
is this even possible ?
cheers
Make Ogre3D and bullet work together without wrapper
I understand I need to create btCollisionObject, add a shape to it (let us say a btSphereShape), and add it with btCollisionWorld::addCollisisionObject().
But how to I mirror movements of a SceneNode and a btCollisionObject ?
I also want to have not instantaneous gun bullets (eg for long range, like in max payne), and since those travel fast and are small there is a possibility of collision miss. What is the proper way of avoiding this ? Should I do a raycast at each step to check if the bullet will hit a target ?
I don't need those bullet to actually be affected by gravity or to tunnel throught multiple target, if it can save some cycles. Attached Thumbnails
A simple problem: Growing a square in a cloud of points
I need the solution to keep it a square, and while I don't need global optimality, I do need the edge to go right up to the points. Any thoughts? I haven't had much sleep..so maybe my brain just isn't working and it's actually a really easy problem...
DeNA restructuring leads to Ngmoco layoffs
Newsbrief: Mobile developer Ngmoco confirmed today that there has been a number of layoffs in the company as part of a corporate restructuring in parent company DeNA. DeNA bought Rolando and Topple dev Ngmoco back in 2010 for $400 million. While the company has not stated a specific figure for the layoffs, Inside Mobile Apps reports that the number is "around 30." These layoffs come as DeNA posted a drop in profits year-over-year for its ...
Crowd-Funded Open Source RPG Portraits Set DONE!
Justin Nichol finished the Kickstarter-crowd-funded portrait marathon! The art has been uploaded here to OpenGameArt.
Back in December 2010, the project was funded with USD 2,567 (of at least USD 1,500) to make 30 portraits. Now all 30 portraits of the backers that sent him model photos have been finished.
The remaining five backers have been asked to get in contact with the artist. Best via Kickstarter.
Kickstarter will take a fee of USD 128.35 (5%).
Justin has a blog you can follow.
This post was retrieved from freegamer.blogspot.com.
Flip or mirror model/texture
I'm trying to understand how to flip/mirror a model, but after hours of researches and tries I didn't get any solution.
The engine that I'm developing is a tile engine in a 3D space (i'm using D3DFVF_XYZ | D3DFVF_TEX1 as vertex), I'm using D3DXMatrixOrthoOffCenterLH(&matProjection, 0.0f, f_viewWidth, -f_viewHeight, 0.0f, 1.0f, 100.0f) to get a good view space for a 2D game.
Currently, when I need to flip the tiles, I set on a vertex created, drawed and deleted every frame, I set TU and TV from x+width to x (for not-flipped tiles I set it from x to x+width). The effect that I get with this is very bad:
I tried also to uses D3DSAMP_ADDRESSU and D3DSAMP_ADDRESSV but with bad results and when I trying to do rotation with matrix, the window is totally empty.
Any idea?
Water multiple refraction with depth peeling
and all is well
EXCEPT
when rendering 3D waves (from a low camera angle) there is no way to calculate the true refraction
because it may include multiple waves:
eye < |---1---| |---2---| |---3---|
for this to render correctly I would have to render the far side of wave 3, then the near side of wave 3
then the far side of wave 2, etc.
I realised this morning that my cloaking technique:
which uses forward and reverse depth peeling (to get some of the near layers and some of the far layers), could be used to solve this problem
so, before I get out my hammer and tongs, how do other people approach this problem?
Why does RayIntersect return wrong values?
public bool CheckRayIntersection(Ray ray) { //Where aabb is the BasicModel's BoundingBox if (ray.Intersects(aabb) != null) { return true; } else {[/color] [color="#333333"] return false; } }
I create the Ray in my Camera.cs:
public Ray GetMouseRay(Vector2 mousePosition, Viewport viewport) { Vector3 near = new Vector3(mousePosition, 0); Vector3 far = new Vector3(mousePosition, 1);[/color] [color=#333333] near = viewport.Unproject(near, projection, view, Matrix.Identity); far = viewport.Unproject(far, projection, view, Matrix.Identity);[/color] [color=#333333] return new Ray(near, Vector3.Normalize(far - near)); }
And finally in game1.cs I check for Intersection in every BasicModel and write "Intersects" to Console:
foreach(BasicModel model in assetManager._modelsOnscreen) { if(model.CheckRayIntersection(camera.GetMouseRay(mouseLocation,viewport))) { winForm.ConsoleWrite = "intersects"; } }
Somehow it always returns true for intersection with offset (to the right) to the actual Boundingbox. I also don't have any clue how I could visualize the problem or step through it. Actually the Boundingbox is drawn correctly as seen here, so I don't think that aabb causes the problem.
Any advice is welcome,
noir
Minecraft, Portal 2 on shortlist for BAFTA's 2011 Game Award
The British Academy of Film and Television Arts has announced the shortlist for its Game Award 2011, with the likes of Portal 2 and indie behemoth Minecraft up for the award. The Game Award, a collaboration between BAFTA and UK retailer Game Group, is the only BAFTA award that is voted for by the public. Call of Duty: Black Ops previously picked up the 2010 award. Notable inclusions to the shortlist include war shooter rivals ...
simple Translation Question (noob)
Im basically a directX noob, and currently learning from pretty cool internet tutorials.
So i read into moving objects and figured out how to rotate and translate objects in World-axis, but how do i translate objects in Objectspace ?
or to be more specific;
How do i translate my Camera relative to its own Z-axis ?
i want to simulate a plane flying forward, but all i get is a "plane" flying towards the z-World-axis.
Heres my function which handles all translations:
void render_frame(void)
{
d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
d3ddev->Clear(0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
d3ddev->BeginScene();
static float forward = 0.0f; forward += 0.01;
static float pitch = 0.0f;
static float roll = 0.0f;
D3DXMATRIX matView;
D3DXMATRIX matMove;
D3DXMATRIX matRotateZ;
D3DXMATRIX matRotateX;
D3DXMatrixTranslation(&matView, 0.0f, 0.0f, forward);
D3DXMatrixRotationZ(&matRotateZ, roll);
D3DXMatrixRotationX(&matRotateX, pitch);
if((!KEY_DOWN(VK_DOWN))&&(KEY_DOWN(VK_UP))) {
pitch-=0.01f;
}
if((KEY_DOWN(VK_DOWN))&&(!KEY_DOWN(VK_UP))) {
pitch+=0.01f;
}
if((KEY_DOWN(VK_RIGHT))&&(!KEY_DOWN(VK_LEFT))) {
roll+=0.01f;
}
if((!KEY_DOWN(VK_RIGHT))&&(KEY_DOWN(VK_LEFT))) {
roll-=0.01f;
}
D3DXMatrixLookAtLH(&matView,
&D3DXVECTOR3 (0.0f, 0.0f, forward),
&D3DXVECTOR3 (0.0f, 0.0f, 0.0f),
&D3DXVECTOR3 (0.0f, 1.0f, 0.0f));
d3ddev->SetTransform(D3DTS_VIEW, &(matView*matRotateZ*matRotateX));
D3DXMATRIX matProjection;
D3DXMatrixPerspectiveFovLH(&matProjection,
D3DXToRadian(45),
(FLOAT)SCREEN_WIDTH / (FLOAT)SCREEN_HEIGHT,
1.0f,
100.0f);
d3ddev->SetTransform(D3DTS_PROJECTION, &matProjection);
meshTeapot->DrawSubset(0);
d3ddev->EndScene();
d3ddev->Present(NULL, NULL, NULL, NULL);
}
Can you help me solving my problem ?
Any Idea or "pointing into the right direction" is highly appreciated ! (as i dont even know how to search without the specific terms...)
additionaly: Do you have any other advises for handling Input ? (mine sure isnt the best.)
(or even other no goes you detect in the above ?)
thank you
Help for recommending books about terrain,light,shadow and so on~
So what's your opinion?
If you can tell me some more like VSD,LOD,animation,PM,post-processing,ray-tracing,etc.Then the best,Thanks!
Thx very much!
--Harry
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- …
- nächste Seite ›
- letzte Seite »