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

Pages: [1] 2 3 4
1
General / Re: Integrating SFML with Modern OpenGL
« on: July 28, 2016, 07:43:41 pm »
#define GLEW_STATIC
#include <GL/glew.h>
#include <SFML/Graphics.hpp>
#include <SFML/OpenGL.hpp>
#include <iostream>

int main() {
    sf::RenderWindow app(sf::VideoMode(640, 480), "OpenGL");
    glewExperimental = GL_TRUE;
    if (glewInit() != GLEW_OK) {
        std::cout << "Failed to initialize GLEW!";
        return -1;
    }

    while (app.isOpen()) {
        sf::Event e;
        while (app.pollEvent(e)) {
            if (e.type == sf::Event::Closed) {
                app.close();
            }
        }

        static const GLfloat red[] = {1.0f, 0.0f, 0.0f, 1.0f};
        glClearBufferfv(GL_COLOR, 0, red);
        app.display();
    }

    return 0;
}
 

The code is basically the same as before, but with your proposed changes and the GLEW_STATIC stuff. This example does work perfectly well on my Windows machine; the glClearBufferfv is a newer function than glClear and glClearColor. Those two I'm already familiar with, and they work on my Mac without the GLEW stuff.

2
General / Re: Integrating SFML with Modern OpenGL
« on: July 28, 2016, 03:10:31 pm »
Ah whoops yes, you're totally right; forgot that important detail, which I did remember to do on Windows before; thanks! However, the window is white instead of red; know why?

3
General / Re: Integrating SFML with Modern OpenGL
« on: July 28, 2016, 05:05:07 am »
Okay, I got it compiling and working fine on Windows, which I realized I needed GLEW for. The changes I made were adding the following two lines to the very top of the C++ file, after I had installed GLEW:

#define GLEW_STATIC
#include <GL/glew.h>

This stuff's probably old hat to some of you, but it was tough for me to glean the information in a straightforward way from forum posts.

Now, the unfortunate thing is I did exact same on Mac, the only difference being the command string I used, which was the following:

Code: [Select]
g++ test.cpp -I/usr/local/include -F/Library/Frameworks -L/usr/local/lib -L/opt/X11/lib -lglew -framework sfml-window -framework sfml-graphics -framework sfml-system -framework opengl -o test

and installing GLEW via Homebrew, whereas on Windows I'm compiling with the static version of the library (glew32s.lib) supplied from the website and not needing framework flags, just the regular -l flags.

It compiles! ... and then it seg faults right after a white window shows up (no red from the glClearBufferfv call). :[ Anyone know why it would do so?

4
General / Re: Integrating SFML with Modern OpenGL
« on: July 27, 2016, 04:19:37 pm »
I do have the function defined in two header files located in the OpenGL framework headers:

Code: [Select]
CGLMacro.h:#define glClearBufferfv(buffer, drawbuffer, value) \
gl3.h:GLAPI void APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value);

5
General / Integrating SFML with Modern OpenGL
« on: July 27, 2016, 07:39:07 am »
Hey all,

I'm coding on a Macbook, trying to run the following program:

#include <SFML/Graphics.hpp>
#include <SFML/OpenGL.hpp>

int main() {
    sf::RenderWindow app(sf::VideoMode(640, 480), "OpenGL");

    while (app.isOpen()) {
        sf::Event e;
        while (app.pollEvent(e)) {
            if (e.type == sf::Event::Closed) {
                app.close();
            }
        }

        static const GLfloat red[] = {1.0f, 0.0f, 0.0f, 1.0f};
        glClearBufferfv(GL_COLOR, 0, red);
        app.display();
    }

    return 0;
}
 

However, I get the following error:

sb2-1.cpp:25:9: error: use of undeclared identifier 'glClearBufferfv'
        glClearBufferfv(GL_COLOR, 0, red);
        ^
1 error generated.
 

Using glClear() instead of glClearBufferfv() works perfectly well.

Is there something I need to do to make SFML play nice with newer OpenGL besides what's listed in the docs? Thanks!

6
General / Re: XCode Default Project Fails
« on: March 28, 2015, 08:51:29 pm »
lol.... yes, that was it! Thank you Hiura. I did a search but clearly not well enough! :]

Colton

7
General / XCode Default Project Fails (Solved)
« on: March 28, 2015, 12:05:35 am »
Hey all,

Decided to get SFML up and running again and seem to be having an issue getting the default project up and running; I'm getting an EXC_BAD_ACCESS error on line 81 (window.draw(sprite)), with the particular assembly line throwing the error being

0x100075b15:  callq  *16(%r9)

Anyone have an idea as to why this would be? I've changed literally nothing about any of the source code and followed all of the instructions per the Tutorial in setting up my project. I'm also running Yosemite atm. Thank you for your help!

Best,
Colton

8
General / Re: Trouble with Self-Compiled Static Libs
« on: July 15, 2014, 05:30:04 am »
Okay, so I actually got it to work; the issue was that I was linking in window before graphics and in reading other posts about linking, that seems to be a common mistake.

However..... now the executable just stops working as soon as the program starts. Any idea what that might be caused by? For what it's worth, I also removed the redundant #define SFML_STATIC. If this is of any help, here's what the dialog spits out in Additional Details:

Code: [Select]
Problem Event Name: APPCRASH
  Application Name: main.exe
  Application Version: 0.0.0.0
  Application Timestamp: 0326f0d0
  Fault Module Name: main.exe
  Fault Module Version: 0.0.0.0
  Fault Module Timestamp: 0326f0d0
  Exception Code: c0000005
  Exception Offset: 0005c57f
  OS Version: 6.1.7600.2.0.0.256.1
  Locale ID: 1033
  Additional Information 1: 0a9e
  Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
  Additional Information 3: 0a9e
  Additional Information 4: 0a9e372d3b4ad19135b953a78882e789


EDIT (7/17/14):

So I went ahead and tried running it through gdb to see what the issue was; it spat out this for me:

Code: [Select]
Starting program: Z:\sfml_dev/main.exe
[New Thread 6384.0xff8]

Program received signal SIGSEGV, Segmentation fault.
0x0045c56b in sf::String::String(char const*, std::locale const&) ()

It appears (based also on my research into similar issues with related threads) that the issue is with the string that's being passed into the RenderWindow constructor; I tried adjusting the above code to have a declared sf::String that's initialized as sf::String title("My window"); that's then passed into the constructor based on someone who said that had fixed it for them, but I still get the same crash with similar gdb output. My GCC version is 4.8.1, and I'm running static libraries that I have compiled myself from SFML with that compiler. Hope this may be prove useful in determining the problem a bit more.

Thanks so much for your time and help!

Best,
Colton

9
General / Trouble with Self-Compiled Static Libs
« on: July 15, 2014, 05:24:08 am »
Hi all!

Thought I'd give SFML another go (it's been a while!). However, I'm running into a stumbling block; whereas I've gotten it to work fine on my Mac, it's been troublesome on Windows. My issue for a long time was that I was just using the wrong compiler version of GCC, so I couldn't compile with the distributed binaries; after tinkering and switching to using CMake to make my own static libraries, I'm finding that I'm still having difficulties getting things to work; here is the simple example I've been trying to compile:

#define SFML_STATIC
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "My window");

    while (window.isOpen())
    {
        sf::Event event;

        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
            {
                window.close();
            }
        }

        window.clear(sf::Color::Black);

        window.display();
    }

    return 0;
}
 

And here is the output of my CMake-made static library compilation trial:

Code: [Select]
Z:\sfml_dev>g++ > error.log main.cpp -o main.exe -Ic:/sfml/include -Lc:/sfml/lib
 -lsfml-window-s -lsfml-graphics-s -lsfml-system-s -DSFML_STATIC
main.cpp:1:0: warning: "SFML_STATIC" redefined [enabled by default]
 #define SFML_STATIC
 ^
<command-line>:0:0: note: this is the location of the previous definition
c:/sfml/lib/libsfml-graphics-s.a(RenderWindow.cpp.obj):RenderWindow.cpp:(.text+0
x304): undefined reference to `glReadPixels@28'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x10e): undefined reference to `glClearColor@16'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x11d): undefined reference to `glClear@4'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x3f0): undefined reference to `glMatrixMode@4'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x3f6): undefined reference to `glPopMatrix@0'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x402): undefined reference to `glMatrixMode@4'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x408): undefined reference to `glPopMatrix@0'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x414): undefined reference to `glMatrixMode@4'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x41a): undefined reference to `glPopMatrix@0'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x41f): undefined reference to `glPopClientAttrib@0'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x4ff): undefined reference to `glViewport@16'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x50e): undefined reference to `glMatrixMode@4'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x527): undefined reference to `glLoadMatrixf@4'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x534): undefined reference to `glMatrixMode@4'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x600): undefined reference to `glBlendFunc@8'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x628): undefined reference to `glBlendFunc@8'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x650): undefined reference to `glBlendFunc@8'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x678): undefined reference to `glBlendFunc@8'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x6a5): undefined reference to `glDisable@4'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x6b2): undefined reference to `glDisable@4'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x6bf): undefined reference to `glDisable@4'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x6cc): undefined reference to `glDisable@4'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x6f3): undefined reference to `glMatrixMode@4'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x700): undefined reference to `glEnableClientState@4'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x70d): undefined reference to `glEnableClientState@4'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x71a): undefined reference to `glEnableClientState@4'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x746): undefined reference to `glLoadMatrixf@4'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x808): undefined reference to `glPushClientAttrib@4'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x815): undefined reference to `glPushAttrib@4'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x822): undefined reference to `glMatrixMode@4'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x828): undefined reference to `glPushMatrix@0'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x834): undefined reference to `glMatrixMode@4'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x83a): undefined reference to `glPushMatrix@0'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x846): undefined reference to `glMatrixMode@4'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x84c): undefined reference to `glPushMatrix@0'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
xa0c): undefined reference to `glVertexPointer@16'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
xa36): undefined reference to `glColorPointer@16'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
xa60): undefined reference to `glTexCoordPointer@16'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
xa86): undefined reference to `glDrawArrays@12'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
xaf7): undefined reference to `glLoadMatrixf@4'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
xb4b): undefined reference to `glLoadMatrixf@4'
c:/sfml/lib/libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0
x427): undefined reference to `glPopAttrib@0'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: c:/sfml/li
b/libsfml-graphics-s.a(RenderTarget.cpp.obj): bad reloc address 0x6 in section `
.text.startup'
collect2.exe: error: ld returned 1 exit status

I appreciate your time and look forward to getting this finally resolved! :]

Best,
Colton

10
Audio / SFML and 8/16-Bit Music?
« on: December 26, 2010, 05:00:19 am »
I see. I have a bunch of tools to make music.... I have Ableton Live, Aria Maestosa, Audacity... so making .wavs isn't a problem at all. And Aria Maestosa exports from its native MIDI format to .wav, and the files are quite small. So this suits my needs for now, I suppose, though it would be nice to have a MIDI extension to read them and play them.... seems like it would help take memory management to the hole nubba level. ;]

Thank you for the information :] I hope MIDI functionality gets added to SFML in the future.

11
Feature requests / Drawing an Ellipse
« on: December 21, 2010, 09:51:45 am »
When setting the center of the circle, it's relative to the top left coordinates of the circle, not the whole window. I was trying to figure this out and made the mistake of assuming otherwise, but I was able to figure out, in case anyone else looks at this thread in the future and wonders the same thing.

Code: [Select]

sf::Shape myEllipse = sf::Shape::Circle(200, 200, 60, sf::Color(255, 0, 0));
myEllipse.SetCenter(30, 30);
myEllipse.SetScale(2, 1);


Instead of writing the SetCenter function like...
Code: [Select]

myEllipse.SetCenter(230, 230);


Solves the problem for me when scaling the circle.

12
Graphics / Pointer to Rectangle
« on: December 21, 2010, 08:52:28 am »
All righty, Laurent, sounds like a plan :] Thank you for the advice. The way I'm learning now is simply translating what I can from books and sources that teach using SDL, Allegro, etc. into SFML. Minus some discrepancies, it seems to be a valid means of learning.

13
Graphics / Pointer to Rectangle
« on: December 21, 2010, 08:42:54 am »
Quote

No, really... that depends on your graphics card, GPU, window resolution, etc. Don't expect global statements such as "OpenGL can render N million points per second".


That's very true. I should have known better :p Would you recommend I work on learning OpenGL now or keep working with SFML and developing graphical applications? My goal is to become adept at programming in 2D and 3D, but I understand that you must learn to walk before you can run, unlike many people who come to the table believing there's an easy way to start making MMORPG's right off the bat :p And I do very much desire understanding how graphical applications work on as low a level as OpenGL at some point.

14
Graphics / Pointer to Rectangle
« on: December 20, 2010, 11:21:23 pm »
Quote

You can basically fill the entire screen with individual points at decent framerates.


Do you have an estimate as to what that would equate to points per second?

15
Graphics / Pointer to Rectangle
« on: December 20, 2010, 11:07:33 pm »
Quote

This code looks ok. But you shouldn't focus on such details, write a real application an optimize real problems -- sample codes are often far from real life Wink


Of course... and I intend to :] But I was just reading through a book and going back to Allegro programs and trying to do some comparisons. How fast is rendering points with OpenGL?

Quote

By the way, sf::Shape is clearly overkill for drawing points. There's no easy way to draw points efficiently in SFML 1; using an image would probably be faster beyond a certain amount of points.


It ain't too big a deal.... just experimenting and having fun while trying to learn is all :] I probably realistically wouldn't use this in a real program, anyways. Thank you for the assistance :]

Pages: [1] 2 3 4
anything