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

Pages: 1 ... 3 4 [5] 6
61
Window / sf::ContextSettings, opengl version hint
« on: January 31, 2011, 07:31:18 pm »
the way I got around it was to create a dummy context on the stack just before it create the actual context.

Code: [Select]

GlContext* GlContext::New(const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings)
{
    //I added this line
    ContextType dummyContext(&referenceContext);

    ContextType* context = new ContextType(&referenceContext, owner, bitsPerPixel, settings);

    // Enable antialiasing if needed
    if (context->GetSettings().AntialiasingLevel > 0)
        glEnable(GL_MULTISAMPLE_ARB);

    return context;
}


and I also modified the code for selecting the version context to create, because although my card supports 3.3 if I chose 4.0, it would fail and jump to 2.0 instead :(

regards

62
Window / sf::ContextSettings, opengl version hint
« on: January 31, 2011, 07:17:08 pm »
I think the exisiting internal rendering context only apply if you create on the main thread. When I create my window on the main thread, it didn't have any problems. The problem only appear when I change all the window creation to run from a separate thread.

63
Window / sf::ContextSettings, opengl version hint
« on: January 31, 2011, 06:19:14 pm »
Hi, Laurent,

I think the problem is because there is no existing rendering context before the usage wglGetProcAddress. Since I think wglGetProcAddress requires an existing context before it can be used.

regards

64
Window / sf::ContextSettings, opengl version hint
« on: January 31, 2011, 04:47:49 pm »
Hi, Laurent, just wondering, did you update on the context creation part some time while ago??

This is because the current snap shot that I have is about 1-2 week ago, and I was thinking of confirming with you before I tinker around the source.

The link to the 2.0 snap shot seems down, so I can't really check it.

p.s I also found that the Antialiasing settings is not setting right, and I am running SFML on windows 7

regards

65
Window / sf::ContextSettings, opengl version hint
« on: January 30, 2011, 12:06:54 pm »
Yes my driver support it, I am using a nvidia 8600GT which support opengl 3.3. I have use the GPU caps viewer tool and have run their opengl 3.3 demo

http://www.ozone3d.net/gpu_caps_viewer/

66
Window / sf::ContextSettings, opengl version hint
« on: January 29, 2011, 07:09:06 pm »
After creating the window, I use window_.GetSettings() and check the version from there

67
Window / sf::ContextSettings, opengl version hint
« on: January 29, 2011, 04:27:54 pm »
hi, I have a nvidia 8600 which can support opengl 3.3, however no matter what value i put as the value for the major, minor parameters in ContextSettings, it always create a opengl2.0 context instead.

Is there something I am missing out?

regards

68
General / How to draw a sprite to another sprite
« on: January 27, 2011, 05:51:22 am »
To the OP, i think groogy method would be good.  You can create a 2D scene graph to represent your aircraft. So you have something like
Code: [Select]

            Aircraft
            /       \
 Front wing     Back wing
 hardpoint1     hardpoint2


When drawing, you just need to tranverse your aircraft tree and draw respectively.

I do not know how sfml really batch their sprites, but if you are going to batch your sprites, it doesn't really affect if you draw 3 extra sprites or anything. For your record the the amount of vertices being push to the GPU every frame is in the order of mbs. My vertex cache is 32mb big for my game and I push them into the GPU in blocks of 8mb, so your few extra sprite is not going to really impact your game much. Don't worry too much =).

regards

69
General discussions / Using Directx with SFML
« on: January 22, 2011, 06:28:38 pm »
To the OP, if you are still really keen on using Directx and windows. You can just create the Win32 code and read the input via RawInput. If you are targeting only a windows platform, DX is as good as in can get. With DX11 it can automatically scale to user hardware base on D3D_FEATURE_LEVEL. So no worries if user is only have DX9 hardware.

On the other hand. If you want to achieve cross platform, then you should use SFML and Opengl. Since opengl is supported on almost all platform, it would be easy to port code. i.e. you don't have to support 2 renderers. :)

However in my opinion, currently opengl is slightly lagging behind DX in terms of capabilities. e.g HLSL can now allow a certain degree of OO-ness in it which reduce the need of uber shaders, along with other stuff. It is not much a big deal since opengl would eventually catch up :)

Opengl and DX are basically just playing a game catch up with each other. To date I think DX is at an edge ever since dx10.1 and dx11 came out. Before that opengl was leading =) I am sure this cycle repeats itself. :D

regards

70
Window / SFML2 SetActive() Failed to activate window context
« on: January 18, 2011, 01:28:26 pm »
Here is the code. I took most of the code from the opengl tutorial for sfml1.6

http://www.sfml-dev.org/tutorials/1.6/window-opengl.php

Code: [Select]

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/OpenGL.hpp>


////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
void ThreadFunction()
{
    // Create the main window
    sf::ContextSettings Settings;
    Settings.DepthBits         = 24; // Request a 24 bits depth buffer
    Settings.StencilBits       = 8;  // Request a 8 bits stencil buffer
    Settings.AntialiasingLevel = 0;  // Request 2 levels of antialiasing
    sf::Window App(sf::VideoMode(1024, 768, 32), "SFML OpenGL", sf::Style::Close, Settings);

    // Set color and depth clear value
    glClearDepth(1.f);
    glClearColor(0.176f, 0.196f, 0.667f, 0.0f);

    // Enable Z-buffer read and write
    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);

    // Setup a perspective projection
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(90.f, 1.f, 1.f, 500.f);

    // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();

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

            // Resize event : adjust viewport
            if (Event.Type == sf::Event::Resized)
                glViewport(0, 0, Event.Size.Width, Event.Size.Height);
        }

        // Set the active window before using OpenGL commands
        // It's useless here because active window is always the same,
        // but don't forget it if you use multiple windows or controls
        App.SetActive(true);

        // Clear color and depth buffer
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        // Finally, display rendered frame on screen
        App.Display();

        App.SetActive(false);
    }

    std::cin.get();
}

int main()
{
    sf::Thread thread(&ThreadFunction);

    thread.Launch();

    return EXIT_SUCCESS;
}

71
Window / SFML2 SetActive() Failed to activate window context
« on: January 18, 2011, 12:27:59 pm »
Hi, I create a simple app and in the main loop when i do

App.SetActive(true);

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

App.Display();

App.SetActive(false);

When running, it output on the console "Failed to activate window context". If I comment away App.SetActive(false); everything is normal.

Why is it that calling App.SetActive(false) would produce that error? Is there a change in the proper usage of SetActive() in SFML2.0?

P.S: this problem did not appear in SFML1.6

regards.

72
General discussions / SFML 2.0 cmake installation and VS2010
« on: January 18, 2011, 11:36:46 am »
ahh thanks. :)

73
General discussions / SFML 2.0 cmake installation and VS2010
« on: January 18, 2011, 10:44:57 am »
the code and source compiles fine. However I am having problem with the installation step which moves the files to a specified location as stated in the CMAKE_INSTALL_PREFIX.

after running cmake the VS2010 sln will include a project call "INSTALL" which I assume would install the files to the proper location. However when I compile the project "INSTALL" it gave an error saying "can't find the batch label specified - VCReportError"

Is there something I am missing out?

regards

74
Window / SetPosition and mutex. Anyway inbuilt way to avoid?
« on: January 15, 2011, 06:40:50 am »
Hi, is there anyway inbuilt thread safe flag in sfml which I can specify to allow calls to be thread safe? or do I have to manually wrap every sfml call with a mutex.

for e.g sf::Window::SetPosition which can be access from multiple thread.

Must I have a mutex for every SetPosition call?

regards

75
Window / mulitple sf::window and OpenGL
« on: January 05, 2011, 08:04:01 pm »
hi, sorry for reviving this thread. Recently I have gotten around to write a simple app with multiple windows on different along with opengl and I am facing a problem.

Basically here is the simplified equivalent flow

thread A: Create WindowOne, and poll input, WindowOne.Display()
thread B: Create WindowTwo, and poll input, WindowTwo.Display()
thread C (command thread): calls WindowOne.SetActive(true), Draw Cube using Opengl

However nothing is being drawn in the window. Is there something I am missing out?

As from the previous posts, what I "understood" is that setting SetActive(true) would set the window to the primary window.

Pages: 1 ... 3 4 [5] 6