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.


Messages - wizardofoz

Pages: [1] 2
1
Graphics / Image::CopyScreen
« on: November 23, 2008, 10:57:22 pm »
Quote
It wouldn't make sense, as RenderImage is already an image.


Yes you are right, thanks. I'll wait the update to PostFX  :)

2
Graphics / Strange Collision
« on: November 23, 2008, 10:45:18 pm »
Are you checking both X and Y values?

Try something like this:

Code: [Select]
// Object-to-object bounding-box collision detector:
short int Sprite_Collide(sprite_ptr object1, sprite_ptr object2) {
 
    int left1, left2;
    int right1, right2;
    int top1, top2;
    int bottom1, bottom2;

    left1 = object1->x;
    left2 = object2->x;
    right1 = object1->x + object1->width;
    right2 = object2->x + object2->width;
    top1 = object1->y;
    top2 = object2->y;
    bottom1 = object1->y + object1->height;
    bottom2 = object2->y + object2->height;

    if (bottom1 < top2) return(0);
    if (top1 > bottom2) return(0);

    if (right1 < left2) return(0);
    if (left1 > right2) return(0);

    return(1);

};


(Pasted from GameDev.net)

Or read the full article: http://www.gamedev.net/reference/articles/article735.asp

3
Graphics / Strange Collision
« on: November 23, 2008, 06:33:59 pm »
Code: [Select]
if(Player.GetPosition().x + Player.GetSize().x <= Wall.GetPosition().x)
      {
//not the important part...
         if(Player.GetPosition().x <= 1024-Player.GetSize().x)   Player.Move( 400*Window.GetFrameTime(), 0);
      }


Here you are checking X position for a possible collision...and the Y ?

4
Graphics / Image::CopyScreen
« on: November 22, 2008, 03:57:21 pm »
Hi all, I would like to know if there is some particular reason for the function Image::CopyScreen to use a RenderWindow pointer instead of a more generic RenderTarget.

I'm asking that because PostFX uses CopyScreen and this limits the use of PostFX to RenderWindow (I cannot use PostFX with my RenderImage class  :wink: ).

5
Graphics / just draw a image, not a sprite
« on: November 21, 2008, 09:25:42 pm »
According to the NVIDIA article:

Quote


Methods of data movement:

....
- glBegin() / glEnd(): easy to use but bad performance, spoon feeding, multiple layers per call, only a few words of data per API call, function calls are expensive.
....



My personal thought is that glBegin / glEnd is more than good for general purposes and it is easy to use. I think that only with a big amount of vertexes to render each frame these API calls could slow down the rendering time and it also depends on the hardware.

One thing that I learned that can improve the performance is to group your primitive rendering calls first by primitive type, then by texture, then by blending mode.

If we talk about SFML I think there is already in the roadmap a way to " Optimize rendering of huge amounts of drawables".

6
Graphics / svn: Image.LoadFromFile and Image.Create crashes
« on: November 21, 2008, 09:31:18 am »
Very happy to have been helpful :)

7
Graphics / just draw a image, not a sprite
« on: November 21, 2008, 09:27:24 am »
Quote
It isn't the drawing that is the bottleneck, it's the lines that are being generated each frame. You're computing a normal 12 times per asteroid every frame.


True, but Draw() function calls glBegin/glEnd each time and this could have an impact on the performance in some situations.

If we talk about performance when whe have a huge amount of vertexes:

1) Worse: glBegin/glEnd
2) Better: Vertex arrays
3) Best: VBOs / Display List

This is an interesting article by NVIDIA about performance:
http://www.nvidia.com/content/nvision2008/tech_presentations/Professional_Visualization/NVISION08-Double_Your_Graphics_Performance.pdf

8
Graphics / svn: Image.LoadFromFile and Image.Create crashes
« on: November 18, 2008, 10:47:58 am »
I'm very happy if I could help you  :)

9
Graphics / svn: Image.LoadFromFile and Image.Create crashes
« on: November 18, 2008, 10:10:21 am »
Last news:

I tried to update the image buffer with the new power of 2 sizes before calling glTexImage2D and the code now runs ON ALL PCs without problems .

So this sort of bug can crash your program with non-power-of-2 images and even with fonts (because they are loaded into textures).

10
Graphics / svn: Image.LoadFromFile and Image.Create crashes
« on: November 18, 2008, 09:50:11 am »
Surely I'm wrong but after some investigations I've discovered a similiar thing.
I tested normal SFML code in differents PC with NVIDIA and ATI cards with the last drivers installed:

On some PC SFML code doesn't work and crashes.

I built a simple logging system for every line of code and I discovered that the problem was in the loading of images that haven't power-of-2 dimensions.

I examined the source code of CreateTexture() function, I'm far from an expert but:


If non-power-of-2-dimensions aren't supported SFML calculates new power-of-2 bigger image sizes with the function GetValidTextureSize(unsigned int Size)
but the buffer of the image just loaded is not updated with the new size.
So when we call:...


Code: [Select]
GLCheck(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, myTextureWidth, myTextureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, GetPixelsPtr()));


myTextureWidth and myTextureHeight are bigger than the real buffer dimension retrieved with GetPixelPtr().

Could be this the reasons of these crashes? If not I'm sorry...

11
Graphics / FlipX and FlipY for sfml strings
« on: November 17, 2008, 03:06:02 pm »
Quote
Would you be so kind as to post your code. Thanx.


The image I have posted refers to a my add-on code that is not part of the official SFML library.
Please refer to http://www.sfml-dev.org/forum/viewtopic.php?t=740 post for more informations.

12
Feature requests / Render to texture implementation question
« on: November 17, 2008, 02:59:26 pm »
Quote
I guess you're passing a local variable

Sure! Thanks, yesterday I was tired.. I solved with this two lines:

Code: [Select]

// Inverts Y-Axis
GetDefaultView().SetFromRect(FloatRect(0,static_cast<float>(myBufferWidth),static_cast<float>(myBufferHeight),0));
SetView(GetDefaultView());


Quote
I'd be glad to see your code. I'm especially interested because you're using PBuffers and not FBOs, so you need a high amount of non-portable code.


We focus only on Win32 platforms and I'm not a professional programmer so my RenderImage class has been tested only on Windows XP and Windows Vista.

I made some changes to my RenderImage class today so it should work without any SFML code modification, simply by adding RenderImage.hpp and RenderImage.cpp to the Graphics Project of SFML Solution.

-----------------------------

Here is my code, please feel free to throw it away, modify or use it. I hope it could be of little help.

Quote
I'm especially interested because you're using PBuffers and not FBOs

Have PBuffers a better compatibility than FBO?
 ( http://lwjgl.org/wiki/doku.php/lwjgl/tutorials/opengl/pbuffervsfbo )

My RenderImage references: http://ati.amd.com/developer/ATIpbuffer.pdf

-----------------------------

I also made an example to show RenderImage use, it's included in the rar file.



RenderImage and Example sources here:
http://www.megaupload.com/?d=9C19OO5R

-----------------------------

TODO:

Add checking to control that we haven't lost our pbuffer due to a display mode change with:
Code: [Select]
wglQueryPbufferARB(hPBuffer, WGL_PBUFFER_LOST_ARB, &flag);

13
Graphics / FlipX and FlipY for sfml strings
« on: November 16, 2008, 03:03:37 pm »

14
Feature requests / Render to texture implementation question
« on: November 16, 2008, 10:37:24 am »
I "potentially" solved the problem:

SetView(View(FloatRect(0,myBufferWidth,myBufferHeight,0)));

This simple line inverts y-axis and all works but...

But in the original code this line breaks the program because myCurrentView is a constant:
const View* myCurrentView;


So if I use SetView(), this function generates weirds values and corrupts the program.

I had to modify:
const View * myCurrentView;
to
View myCurrentView;

and so SetView() works without any problem.

I was happy because I succeded to implement RenderImage without changing any single line of the original SFML code (except for CreateTexture() that I had to make it virtual).

Now I had to change a core part of SFML that is myCurrentView member of RenderTarget class so I don't think my RenderImage class could be useful for you..

But if you find a solution I will post my RenderImage class if it can be of any help..

Best regards.

15
Graphics / FlipX and FlipY for sfml strings
« on: November 16, 2008, 09:39:10 am »
When render to texture will be avaiable you could render text to a texture and display it flipped or rotated.

Pages: [1] 2
anything