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

Pages: 1 ... 9 10 [11] 12 13
151
Graphics / Textures and RenderTextures broken
« on: August 25, 2011, 09:58:23 pm »
Well I made that up as I went so might not be exactly it but more or less


Here is code I have tried out: http://pastebin.com/B81PJ4uG
And gives me the broken image, it also just blocks the window input so I cant close it and need to stop it via the IDE

It seems to not be happening all the time with that code, however when it doesnt happen the image still doesnt display

152
Graphics / Textures and RenderTextures broken
« on: August 25, 2011, 07:45:59 pm »
This is my current code, I currently am not using a render Texture as I thought I coud get rid of it by just using different Views

http://pastebin.com/Mk3jjdiV

A simple example of how I use the texture would be:
Code: [Select]


int main( int argc, const char* argv[] )
{
   sf::RenderWindow App;
   sf::Texture titleImage;
titleImage.LoadFromFile("./data/Title.png");

sf::ContextSettings Settings;
Settings.DepthBits         = 24; // Request a 24 bits depth buffer
Settings.StencilBits       = 8;  // Request a 8 bits stencil buffer
Settings.AntialiasingLevel = GlobalSettings::globalSettings.AntiAliasing;  // Request 2 levels of antialiasing
Settings.MajorVersion = 2;
Settings.MinorVersion = 1;



if(GlobalSettings::globalSettings.FullScreen)
App.Create(sf::VideoMode(800, 600, sf::VideoMode::GetDesktopMode().BitsPerPixel), GlobalSettings::globalSettings.getWindowName(), sf::Style::Fullscreen ,Settings);
else
App.Create(sf::VideoMode(800, 600, sf::VideoMode::GetDesktopMode().BitsPerPixel), GlobalSettings::globalSettings.getWindowName(), sf::Style::Default ,Settings);


App.EnableVerticalSync(false);



try{
std::cout << "Using OpenGL " << App.GetSettings().MajorVersion << "." << App.GetSettings().MinorVersion << std::endl;

if ((App.GetSettings().MajorVersion < Settings.MajorVersion) || (App.GetSettings().MajorVersion == Settings.MajorVersion && App.GetSettings().MinorVersion < Settings.MinorVersion))
{
std::cout << "Sorry but a minimum of OpenGL "<< Settings.MajorVersion <<"."<< Settings.MinorVersion <<" is required"<<std::endl;
std::cout << "Try updating your drivers." << std::endl;
return false;
}

}
catch(int e){
std::cout << "Failed to get OpenGL version. " << e << std::endl;

return false;
}

GLenum err = glewInit();
if (GLEW_OK != err)
{
/* Problem: glewInit failed, something is seriously wrong. */
std::cout << "Error: " << glewGetErrorString(err) << std::endl;
return false;
}
else
{
std::cout << "Using GLEW " << glewGetString(GLEW_VERSION) << std::endl;
}



   App.SetFramerateLimit(60 );
App.ShowMouseCursor(false);


while (App.IsOpened())
{
// Process events
sf::Event Event;
while (App.PollEvent(Event))
{
   // Close window
                if (Event.Type == sf::Event::Closed)
                    App.Close();

                // Escape key pressed
                if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Keyboard::Escape))
                    App.Close();

                if (Event.Type == sf::Event::Resized)
                    glViewport(0, 0, Event.Size.Width, Event.Size.Height);
            }



            App.SetActive();
            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
                    // Dark blue background
                    glClearColor(0.392156863f, 0.584313725f, 0.929411765f, 0.0f);


            switch(gameStage)
            {
                case intro:
                {
                    App.SaveGLStates();
                    App.RestoreGLStates();
                    break;
                }
                case menu:
                {
                    App.SaveGLStates();
                   App.Draw(sf::Sprite(titleImage ));
                    App.RestoreGLStates();
                    break;
                }
                case game:
                {


                    break;
                }
                case options:
                {
                    break;
                }
                case quit:
                {
                    break;
                }
            }




#ifdef  THIS_DEBUG
    App.SaveGLStates();
    std::stringstream ss;
ss << App.GetFrameTime();
sf::Text string(ss.str() + " ms",sf::Font::GetDefaultFont(), 14);
string.SetPosition(5,5);
App.Draw(string);
    App.RestoreGLStates();
#endif


            // Display window contents on screen
App.Display();
}
}



    return 0;
}


153
Graphics / Textures and RenderTextures broken
« on: August 25, 2011, 07:23:49 pm »
I tried using a renderTexture earlier but the program would just close straight away.
I am also using a Texture like this:

Code: [Select]
#include "TitleScreen.hpp"

TitleScreen::TitleScreen()
{

}

TitleScreen::TitleScreen(sf::RenderWindow &App)
{
    app = &App;
    titleImage.LoadFromFile("./data/Title.png");
    titleImage.Bind();
}

TitleScreen::~TitleScreen(){}

void TitleScreen::Update()
{

}

void TitleScreen::Draw()
{
    app->Draw(sf::Sprite(titleImage ));
}


but I just et this image

154
DotNet / SFML.Net 2 for linux download?
« on: August 25, 2011, 04:07:09 pm »
Still not working :/

Code: [Select]
[richy@fedoraLt Debug]$ dir
libcsfml-audio.so  libcsfml-window.so.2.0   libsfml-window.so.2
libcsfml-audio.so.2  libsfml-audio.so   libsfml-window.so.2.0
libcsfml-audio.so.2.0  libsfml-audio.so.2   libsndfile-1.dll
libcsfml-graphics.so  libsfml-audio.so.2.0   openal32.dll
libcsfml-graphics.so.2  libsfml-graphics.so   SFML\ Game.exe
libcsfml-graphics.so.2.0  libsfml-graphics.so.2    SFML\ Game.exe.mdb
libcsfml-system.so  libsfml-graphics.so.2.0  sfmlnet-audio-2.dll
libcsfml-system.so.2  libsfml-system.so   sfmlnet-graphics-2.dll
libcsfml-system.so.2.0  libsfml-system.so.2   sfmlnet-window-2.dll
libcsfml-window.so  libsfml-system.so.2.0
libcsfml-window.so.2  libsfml-window.so
[richy@fedoraLt Debug]$ LD_LIBRARY_PATH='.' mono SFML\ Game.exe

Unhandled Exception: System.DllNotFoundException: csfml-graphics-2
  at (wrapper managed-to-native) SFML.Graphics.RenderWindow:sfRenderWindow_Create (SFML.Window.VideoMode,string,SFML.Window.Styles,SFML.Window.ContextSettings&)
  at SFML.Graphics.RenderWindow..ctor (VideoMode mode, System.String title, Styles style, ContextSettings settings) [0x00000] in <filename unknown>:0
  at SFML.Graphics.RenderWindow..ctor (VideoMode mode, System.String title) [0x00000] in <filename unknown>:0
  at SFMLGame.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0

155
DotNet / SFML.Net 2 for linux download?
« on: August 25, 2011, 03:08:19 pm »
yea I have done that but I just get this

Code: [Select]
Unhandled Exception: System.DllNotFoundException: csfml-graphics-2
  at (wrapper managed-to-native) SFML.Graphics.RenderWindow:sfRenderWindow_Create (SFML.Window.VideoMode,string,SFML.Window.Styles,SFML.Window.ContextSettings&)
  at SFML.Graphics.RenderWindow..ctor (VideoMode mode, System.String title, Styles style, ContextSettings settings) [0x00000] in <filename unknown>:0
  at SFML.Graphics.RenderWindow..ctor (VideoMode mode, System.String title) [0x00000] in <filename unknown>:0
  at SFMLGame.MainClass.Main (System.String[] args) [0x00000] in /home/richy/Projects/SFML Game/SFML Game/Main.cs:10

156
DotNet / SFML.Net 2 for linux download?
« on: August 25, 2011, 12:38:13 am »
I wanted to use SFML.Net on linux but everytime I try using it I get the "cant open csfml..." error, I tried some solutions on here but I couldnt fix it so I wanted to know if anyone on here has some recent libraries built that I could get a copy of?

157
SFML projects / [Released] libMy - Datapackaging library
« on: August 24, 2011, 05:41:20 pm »
Is this available for download yet?

158
SFML projects / Gore Factor SFML
« on: August 24, 2011, 03:10:01 am »
Where can the code be found?

159
Graphics / Batch drawing?
« on: August 23, 2011, 11:41:02 pm »
I wanted to know if there was anyway to load up everything you want to draw and then draw it all at once, instead of making a draw call for each object.

The main performance losses that you have with graphic API's isnt the amount of objects to draw but the amount of draw calls and I wanted to know if there was a way of makingg all my sprite/shape draw calls into one?

If not are there any plans for this in the future?

160
Window / Getting supported resolutions.
« on: August 22, 2011, 08:36:15 pm »
Much easier thanks :D

161
Window / Getting supported resolutions.
« on: August 22, 2011, 07:58:57 pm »
Ahh thanks, just been playing with it but Im having an issue.
Im using this code:

Code: [Select]
void GlobalSettings::setWidthHeight(unsigned short w, unsigned short h)
{
    sf::VideoMode desktopVM = sf::VideoMode::GetDesktopMode();


        sf::VideoMode vMode = sf::VideoMode(w,h,desktopVM.BitsPerPixel);
        if(vMode.IsValid())
        {
            GlobalSettings::WindowWidth = w;
            GlobalSettings::WindowHeight = h;
             return;
        }
       
        std::vector<sf::VideoMode> modes = sf::VideoMode::GetFullscreenModes();
        for (std::size_t i = 0; i < modes.size(); ++i)
        {
             sf::VideoMode mode = modes[i];

             if(desktopVM.BitsPerPixel == mode.BitsPerPixel)
             {
                if( (mode.Width/mode.Height) == (4/3) )
                {
                    w = mode.Width;
                    h = mode.Height;

                    vMode = sf::VideoMode(w,h,desktopVM.BitsPerPixel);
                        if(vMode.IsValid())
                        {
                            GlobalSettings::WindowWidth = w;
                            GlobalSettings::WindowHeight = h;
                            return;
                        }
                 }
             }
         }


}


Which should check if the given width/height are valid for the resolution and make sure that they are 4:3 aspect ratio, but it isnt working it just gives back the highest resolution (which it should do as im passing something like 1600x1200) but it isnt the highest 4:3.
Its giving back 1280x800.

I think its to do with the  if( (mode.Width/mode.Height) == (4/3) ) but I wasnt sure

162
Window / Getting supported resolutions.
« on: August 22, 2011, 06:19:53 pm »
I just wanted to know if SFML2 had any sort of way to get the supported resolutions?

I have done this in windows (to get the maximum supported resolution) by doing:

Code: [Select]
DEVMODE dmode;
dmode.dmSize = sizeof(DEVMODE);
dmode.dmDriverExtra = 0;

unsigned short maxWidthSupported = 0;
unsigned short maxHeightSupported = 0;

unsigned short imode = 0;

while(EnumDisplaySettings(NULL, imode, &dmode ) != 0)
{
if(dmode.dmPelsWidth > maxWidthSupported) maxWidthSupported = (unsigned short)dmode.dmPelsWidth;
if(dmode.dmPelsHeight > maxHeightSupported) maxHeightSupported = (unsigned short)dmode.dmPelsHeight;

imode++;
}

if(w > maxWidthSupported) w = maxWidthSupported;
if(h > maxHeightSupported) h = maxHeightSupported;

GlobalSettings::WindowWidth = w;
GlobalSettings::WindowHeight = h;


but Ideally I would like to have a cross platform solution.[/code]

163
Graphics / Downsizing image without quality loss
« on: August 18, 2011, 10:32:06 pm »
Sorry to bump this but I only just saw that last comment.
Would it be really necessarily to do all of that with the view?

Could it not just be done by creating the images 2,3 or 5 times bigger than needed and then just downsizing the sprite?

164
General / Replacement for GLFW
« on: August 07, 2011, 03:29:42 am »
As for if you can have the window without the need for networks and graphics, yes. You would only need to link with the window library and the system library (the window library depends on the system one AFAIK)

As for oGL3+ you can specify what context version you want by using the ContextSettings class, however when using 3+ it still loads up the compatibility profile

165
Window / sf::Joystick and 360 controllers
« on: August 07, 2011, 03:09:19 am »
Hi I just wondered if sfml can work with 360 controllers as that way I could use it without the need for xInput (and more importantly cross platform)

If so does anyone know of any example code?

And if not are there any lightwaigh and cross platfor libraries that allow you to use 360 controller?

Pages: 1 ... 9 10 [11] 12 13