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 - tiby312

Pages: [1]
1
Graphics / Smoothing lines drawn onto render texture
« on: September 01, 2011, 01:56:42 am »
When I draw polygons onto a renderTexture, and then draw it using a sprite, the edges are not smoothed out even though it is when I just draw the polygons directly in the window. What can I do to make it smooth?

2
Graphics / making custom save/restore OpenGL states
« on: August 30, 2011, 02:39:07 pm »
But I never touched those functions!

I did touch glColor4f which I set back to
Code: [Select]

glColor4f(255, 255,255, 1.0f);

before sfml drawing.


Also sfml correctly draws transparent sprites after the switch. It appears to be just the text. Weird!

3
Graphics / making custom save/restore OpenGL states
« on: August 30, 2011, 01:18:38 am »
I'm getting real close! Here are my custom load/save sates!

Code: [Select]

void Game::OnOpenGL(sf::RenderWindow* a)
{
        // Save a copy of the projection matrix so that we can restore it
        // when it's time to do 3D rendering again.
        glMatrixMode( GL_PROJECTION );
        glPushMatrix();
        glLoadIdentity();

        // Set up the orthographic projection
        glOrtho (0, 800, 600, 0, 0, 1);
        glMatrixMode( GL_MODELVIEW );
        glPushMatrix();
        glLoadIdentity();

        // Make sure depth testing and lighting are disabled for 2D rendering until
        // we are finished rendering in 2D
        glPushAttrib( GL_DEPTH_BUFFER_BIT | GL_LIGHTING_BIT );
        glDisable( GL_DEPTH_TEST );
        glDisable( GL_LIGHTING );
}


Code: [Select]

void Game::OffOpenGL(sf::RenderWindow* a)
{
//a->SaveGLStates();
glPopAttrib();
        glMatrixMode( GL_PROJECTION );
        glPopMatrix();
        glMatrixMode( GL_MODELVIEW );
        glPopMatrix();

}


That works fine except when I try to draw text (after switching to sfml drawing) instead of getting letters I just get squares. The weird thing is that if I use sfml to draw a sprite and then try to draw text it works fine. What could that be?

4
Graphics / making custom save/restore OpenGL states
« on: August 29, 2011, 04:52:31 pm »
So I've been working through the tutorial and it suggested not to use the built in save/restore GL states because they are slow. I got it working fine with those functions, but I don't want to rely on them because they are slow.

These are the opengl settings that I change when I want to draw something with opengl

Code: [Select]

        glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glOrtho (0, 800, 600, 0, 0, 1);
glDisable(GL_DEPTH_TEST);
glMatrixMode (GL_MODELVIEW);


my question is how I can undo these changes so I can also draw things with sfml. How am I supposed to know what the starting values of these were?
[/code]

5
General / Cannot find or open the PDB file
« on: August 23, 2011, 04:24:19 am »
Hi, I got sfml 2 working in visual express 2010.

It works fine, except I get this output.

Code: [Select]

'visualStudioProj.exe': Loaded 'F:\Dropbox\Developer\c++\visualStudioProj\Debug\visualStudioProj.exe', Symbols loaded.
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'F:\Dropbox\Developer\c++\visualStudioProj\Debug\sfml-window-d-2.dll', Symbols loaded.
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'F:\Dropbox\Developer\c++\visualStudioProj\Debug\sfml-system-d-2.dll', Symbols loaded.
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\opengl32.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\glu32.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\ddraw.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\dciman32.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'F:\Dropbox\Developer\c++\visualStudioProj\Debug\sfml-graphics-d-2.dll', Symbols loaded.
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\nvoglv32.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Cannot find or open the PDB file
The thread 'Win32 Thread' (0x1128) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0xc10) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x630) has exited with code 0 (0x0).
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\dinput.dll', Cannot find or open the PDB file
'visualStudioProj.exe': Loaded 'C:\Windows\SysWOW64\hid.dll', Cannot find or open the PDB file
The thread 'Win32 Thread' (0xcd0) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x17f0) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x176c) has exited with code 0 (0x0).
The program '[2396] visualStudioProj.exe: Native' has exited with code 0 (0x0).


Can I just ignore this if everything is working fine?

6
Graphics / ugly outline with overlapping sprites with smoothing on
« on: August 19, 2011, 10:54:25 pm »
Quote
A solution would be to smooth RGB components but not the alpha channel -- but OpenGL doesn't offer this feature.


This must be what I have been used to. The XNA game engine as well as the GameMaker engine and also HTML5 canvas must do it this way because I've used this same exact sprite with the invisible green pixels with those and had smooth sprites with no trouble. It would make sense because they don't use opengl.

Code: [Select]

glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_EQUAL, 1.f);


This appears to work very well if your sprite doesn't have any semi-transparent pixels, but it got rid of all of my semi-transparent pixels in my sprite, so I changed it to this:

Code: [Select]

glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER,0.39f);

I kept raising the limit until the outline was almost invisible. Looks pretty good now, but I feel dirty for using this messy solution and it's still not as perfect as possible, but I guess it's the best possible in opengl. Thanks for your patience and help!

7
Graphics / ugly outline with overlapping sprites with smoothing on
« on: August 19, 2011, 09:28:45 pm »
Ah, yes thank you. I changed the colors of those pixels, and it is not as ugly.

But still, I feel like this only masks the problem as those extra pixels are still there making the border of the sprite bigger and blurrier. I could try to compensate by making the original sprite border thinner, but I cannot give it an opaque border as the edge would always be semi-transparent. Plus the areas that do not overlap do not have this problem so the border of the sprite would thicken and thin depending on how it moves on the sprite under it. Is there any way to get the sprite to display as it is, nothing more, nothing less all the time?

8
Graphics / ugly outline with overlapping sprites with smoothing on
« on: August 19, 2011, 08:39:53 pm »
But there are no green pixels in the image. It's a transparent png image. I mean, if there were green pixels in the image, they would appear even with smoothing off.

9
Graphics / ugly outline with overlapping sprites with smoothing on
« on: August 19, 2011, 08:12:43 pm »


See that green outline where the turret sprite overlaps with the base of the tank? That doesn't look too pretty. How can I get rid of that outline without disabling smoothing?

Why do I want to keep smoothing on? Since this tank moves around a lot pretty slowly, it is not pretty having the sprites snapping to the nearest pixel all the time when I want a nice smooth movement. Basically it's just prettier with it on.

Using sfml 1.6

Pages: [1]
anything