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.


Topics - kipbits

Pages: [1]
1
Graphics / [SOLVED]OpenGL Colored Cube Render Issue SFML 2.3.2
« on: August 13, 2016, 05:06:04 pm »
Hey all, I'm trying to get into some OpenGL with SFML, and am having some trouble with some example code for drawing a colored cube. I am still using 2.3.2 and was hoping to keep my current setup for a little while before updating to 2.4. I've read somewhere about some bugs with 2.3.2's OpenGL implementation. Is that an issue here or is there some dumb thing I'm missing in my code? Also I'm on mac; Could this be a mac problem?
here is my code:
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>

#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <GLUT/glut.h>

int main(int, char const**)
{
    // Create the main window
    sf::RenderWindow window(sf::VideoMode(800, 600, 32), "SFML OpenGL");
     
    // Set color and depth clear value
    glClearDepth(1.f);
    glClearColor(0.f, 0.f, 0.f, 0.f);
   
    // Enable Z-buffer read and write
    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);
    //glDepthFunc(GL_LESS);
   
    // Setup a perspective projection
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    //gluPerspective(90.f, 1.f, 1.f, 500.f);
    gluPerspective(70.f, 1.f, 1.f, 500.f);

    sf::Clock Clock;
   
    // Start the game loop
    while (window.isOpen())
    {
        // Process events
        sf::Event event;
        while (window.pollEvent(event))
        {
            // Close window: exit
            if (event.type == sf::Event::Closed) {
                window.close();
            }

            // Escape pressed: exit
            if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape) {
                window.close();
            }
           
            if (event.type == sf::Event::Resized)
                glViewport(0, 0, event.size.width, event.size.height);
        }
       
        // Clear screen
        window.clear();
       
        sf::Time myTime = Clock.getElapsedTime();
        float myftime = myTime.asSeconds();

        window.setActive();
       
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
       
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        glTranslatef(0.f, 0.f, -200.f);
        glRotatef(myftime * 50, 1.f, 0.f, 0.f);
        glRotatef(myftime * 30, 0.f, 1.f, 0.f);
        glRotatef(myftime * 90, 0.f, 0.f, 1.f);
       
        glBegin(GL_QUADS);
       
        glColor3f(1.f, 0.f, 0.f);//red
        glVertex3f(-50.f, -50.f, -50.f);
        glVertex3f(-50.f,  50.f, -50.f);
        glVertex3f( 50.f,  50.f, -50.f);
        glVertex3f( 50.f, -50.f, -50.f);
       
        //glColor3f(1.f, 0.f, 0.f);//red
        glColor3f(0.f, 1.f, 1.f);//cyan
        glVertex3f(-50.f, -50.f, 50.f);
        glVertex3f(-50.f,  50.f, 50.f);
        glVertex3f( 50.f,  50.f, 50.f);
        glVertex3f( 50.f, -50.f, 50.f);
       
        glColor3f(0.f, 1.f, 0.f);//green
        glVertex3f(-50.f, -50.f, -50.f);
        glVertex3f(-50.f,  50.f, -50.f);
        glVertex3f(-50.f,  50.f,  50.f);
        glVertex3f(-50.f, -50.f,  50.f);
       
        //glColor3f(0.f, 1.f, 0.f);//green
        glColor3f(1.f, 0.f, 1.f);//magenta
        glVertex3f(50.f, -50.f, -50.f);
        glVertex3f(50.f,  50.f, -50.f);
        glVertex3f(50.f,  50.f,  50.f);
        glVertex3f(50.f, -50.f,  50.f);
       
        glColor3f(0.f, 0.f, 1.f);//blue
        glVertex3f(-50.f, -50.f,  50.f);
        glVertex3f(-50.f, -50.f, -50.f);
        glVertex3f( 50.f, -50.f, -50.f);
        glVertex3f( 50.f, -50.f,  50.f);
       
        //glColor3f(0.f, 0.f, 1.f);//blue
        glColor3f(1.f, 1.f, 0.f);//yellow
        glVertex3f(-50.f, 50.f,  50.f);
        glVertex3f(-50.f, 50.f, -50.f);
        glVertex3f( 50.f, 50.f, -50.f);
        glVertex3f( 50.f, 50.f,  50.f);
       
        glEnd();
       
        // Update the window
        window.display();
    }
   
    return EXIT_SUCCESS;
}
 

and here is a gif:


2
SFML projects / [MAC][Linux?]I published an SFML applet: ToneBoards
« on: May 09, 2016, 04:27:27 pm »
------------------------------------------------------------------------------
Update: Happy 2020!
------------------------------------------------------------------------------
I recently found some time, in 3.5 years since first publishing my app on the Mac Appstore, to fix the sound files for ToneBoards. For those interested, you can now download the new tones on github. Install by dragging and dropping the contents of the TONESv15 into your toneboards app package TONESv10 folder (sorry, I'm on limited time, and can't make it fancy).

...I still plan to port to linux(recently been playing with MX Linux) although stuff just keeps getting in the way. Anyway, I thought I'd share these before I forgot about them. These new sounds are designed to play better on small laptop speakers, especially the base notes! Maybe I'll provide an explanation of how I made them later...

Update the Update

I posted some demos along with my notes and code for the update

...still planning to port to linux some time. ....must find my lost code...

------------------------------------------------------------------------------
Update: Happy New Years 2018!
------------------------------------------------------------------------------
I decided to publish the source for ToneBoards. I just haven't had as much time to work on it as I would have liked this past year. Perhaps someone will find it useful. Also I'm kind of thinking about letting my Apple developer account lapse. It's just another expense for me right now, and was sort of a hassle to set up. I'm becoming more interested in other ways to assure users of quality/integrity of a piece of software. I've recently discovered a makeshift alternative to apple developer certificates(i think). I mean what is the point of code signing when you can just compare digests using openSSL?

Below are some Github links, and I'm also posting digests and filesizes. I think this should provide a way for users to gain 99% of the assurances provided by the Appstore(with a couple added steps on the user's part).

https://github.com/kipbits/ToneBoards/releases
xxd ToneBoards.app.zip
size(hex):0db4330

openssl dgst -sha512 ToneBoards.app.zip
SHA512(ToneBoards.app.zip)= ef8c3a1e54301c8a6ad0e53706e4e5e5c9f0fc85ee4d8d1aee6faf195801494a1b919b02be1de4455f005d04308270b8e8c3c06c254849a7a4c0b74ed6a2881c

https://github.com/kipbits/SFML-2.3.2-Updated-plist_altered-keyboard/releases
xxd Frameworks.tar.gz
size(hex):0367110

openssl dgst -sha512 Frameworks.tar.gz
SHA512(Frameworks.tar.gz)= 3524096384e6337b654a85286f91bebdd86534d0719e735f4e29b40687efb36d4de9add983d56a12c78cf2f58aba3876104f2f3b851d39dbb8df5131070448c9
------------------------------------------------------------------------------


Someone with an international keyboard please test this for functionality with non-US-English keyboards.

Thanks, and Enjoy

3
Hey all, I'm having some trouble compiling some sfml in the terminal. I have compiled and run sfml in the terminal before, although that was a few months ago, and before i upgraded to El Capitan. I still seem to be able to run Xcode projects just fine; It is nice thought to be able to run small test directly in the terminal.

I'm getting the following error:

     mycomputer:sfmltest me$ g++ sfmltest2.cpp -lsfml-system
     sfmltest2.cpp:1:10: fatal error: 'SFML/System.hpp' file not found
     #include <SFML/System.hpp>
              ^
     1 error generated.


I think i have SFML installed correctly:
  • lib is in usr/local/lib
  • include is in usr/local/include
  • the contents of frameworks and extlibs are in Library/Frameworks

I got info on g++

    mycomputer:sfmltest me$ g++ -v
    Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1
    Apple LLVM version 7.0.2 (clang-700.1.81)
    Target: x86_64-apple-darwin15.2.0
    Thread model: posix

and my $PATH

    mycomputer:sfmltest me$ echo $PATH
    /Users/me/perl5/perlbrew/bin:/Users/me/perl5/perlbrew/perls/perl-5.16.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin


I noticed that my install location wasnt included. Is this a problem? what is the point of the compiler flags -lsfml-system / -framework sfml-system?

I've tried both dylibs and framworks now, and i get the same error. and I'm hoping to get some advice before i go and screw up my default paths.

Thanks,
kipbits

4
Window / sf::Joystick DualShock3 Sixaxis Analogue Triggers
« on: December 28, 2015, 01:06:38 am »
Hey all, Happy Holidays!
I'm playing around here with a Dualshock3 Sixaxis controller. I've gotten the basic info following Joystick API, but something does not look right.
Basically, I'm wondering does SFML recognize Dualshock's analogue R2 & L2 triggers?
SFML reports the connected controller as follows:

Joystick 0 is connected! PLAYSTATION(R)3 Controller vendor:1356 product:616
   J0 has X axis!
   J0 has Y axis!
   J0 has Z axis!
   J0 has R axis!
   J0 has 19 buttons
Joystick 1 is NOT connected!
Joystick 2 is NOT connected!
Joystick 3 is NOT connected!
Joystick 4 is NOT connected!
Joystick 5 is NOT connected!
Joystick 6 is NOT connected!
Joystick 7 is NOT connected!

I seam to have both thumbsticks and all the buttons, plus 3 that i havent been able to identify. I was kindof expecting to have minus 2 buttons, replaced by active U&V axes for the triggers. On Wikipedia, it says that Dualshock3 Sixaxis supports 2 analogue sticks and 2 analogue triggers.

I'm wondering if i can get the full functionality for those triggers in SFML?

Thanks

5
General / [SOLVED]Mac App Upload Error: (freetype)
« on: December 14, 2015, 03:48:24 pm »
I'm wondering if anyone knows how to upload an app to the Mac App Store? I'm trying to upload a game before the holidays. I've had some issues uploading my project thought. First, I had a code-siginig failure for freetype when signing my project. I found a solution using the code-signing flag --deep. But when I go to upload to the App Store i still get a validation error:

Couldn't find platform family in Info.plist CFBundleSupportedPlatforms or Mach-O LC_VERSION_MIN for A

any Ideas?

Thanks

Addition:
   here is the link to the stackexchange question

6
General / THOR[Mac] Compile & Test Examples
« on: October 27, 2015, 08:55:43 pm »
Hi, I'm trying to run some of the example code that comes with Thor 2.0 on Mac OS 10.10.5. I've gone through the Cmake install tutorial, and I'm pretty sure I have it installed correctly.

Problem is when I go to compile a sample program I run into problems.
I've tried g++ and clang++ with different flags, all with no success.

For example:
clang++ -std=c++11 -stdlib=libc++ Action.cpp -lsfml-window gives a long error message:
  • Undefined symbols for architecture x86_64:
      "sf::String::String(char const*, std::__1::locale const&)", referenced from:
          _main in Action-8f94e3.o
      "thor::Connection::Connection(std::__1::weak_ptr<thor::detail::AbstractConnectionImpl>)", referenced from:
          thor::detail::Listener<thor::ActionContext<MyAction> const&>::shareConnection() const in Action-8f94e3.o
      "thor::Action::Action(sf::Event::EventType)", referenced from:
          _main in Action-8f94e3.o
      "thor::Action::Action(sf::Mouse::Button, thor::Action::ActionType)", referenced from:
          _main in Action-8f94e3.o
      "thor::Action::Action(sf::Keyboard::Key, thor::Action::ActionType)", referenced from:
          _main in Action-8f94e3.o
      "thor::Action::Action(thor::JoystickAxis)", referenced from:
          _main in Action-8f94e3.o
      "thor::Action::Action(thor::JoystickButton, thor::Action::ActionType)", referenced from:
          _main in Action-8f94e3.o
      "thor::Action::Action()", referenced from:
          std::__1::map<MyAction, thor::Action, std::__1::less<MyAction>, std::__1::allocator<std::__1::pair<MyAction const, thor::Action> > >::__construct_node_with_key(MyAction const&) in Action-8f94e3.o
      "thor::detail::EventBuffer::pollEvents(sf::Window&)", referenced from:
          thor::ActionMap<MyAction>::update(sf::Window&) in Action-8f94e3.o
      "thor::detail::EventBuffer::clearEvents()", referenced from:
          thor::ActionMap<MyAction>::update(sf::Window&) in Action-8f94e3.o
      "thor::detail::EventBuffer::EventBuffer()", referenced from:
          thor::ActionMap<MyAction>::ActionMap() in Action-8f94e3.o
      "thor::detail::ActionResult::ActionResult()", referenced from:
          thor::ActionMap<MyAction>::invokeCallbacks(thor::EventSystem<thor::ActionContext<MyAction>, MyAction>&, sf::Window*) const in Action-8f94e3.o
      "thor::detail::JoystickBuilder::Axis::above(float)", referenced from:
          _main in Action-8f94e3.o
      "thor::detail::JoystickBuilder::Axis::below(float)", referenced from:
          _main in Action-8f94e3.o
      "thor::detail::JoystickBuilder::axis(sf::Joystick::Axis)", referenced from:
          _main in Action-8f94e3.o
      "thor::detail::JoystickBuilder::button(unsigned int)", referenced from:
          _main in Action-8f94e3.o
      "thor::joystick(unsigned int)", referenced from:
          _main in Action-8f94e3.o
      "thor::operator&&(thor::Action const&, thor::Action const&)", referenced from:
          _main in Action-8f94e3.o
      "thor::operator||(thor::Action const&, thor::Action const&)", referenced from:
          _main in Action-8f94e3.o
      "thor::Action::isActive(thor::detail::EventBuffer const&) const", referenced from:
          thor::ActionMap<MyAction>::isActive(MyAction const&) const in Action-8f94e3.o
      "thor::Action::isActive(thor::detail::EventBuffer const&, thor::detail::ActionResult&) const", referenced from:
          thor::ActionMap<MyAction>::invokeCallbacks(thor::EventSystem<thor::ActionContext<MyAction>, MyAction>&, sf::Window*) const in Action-8f94e3.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)


I've tried other flags with clang++ and g++, but all combinations I have tried have resulted in some some aspect of C++ Language not beeing found or recognized(e.g. type_traits not found)


Is clang++ -std=c++11 -stdlib=libc++ the proper compile method for mac?
How do I fix this?


Thanks



Oh, and my version of clang:
clang++ -v
Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin14.5.0
Thread model: posix

7
Window / [Mac]sf::Keyboard::isKeyPressed(sf::Keyboard::Dash) not responding
« on: September 22, 2015, 10:28:26 pm »
Hello all, this will be my first post here. I'm trying to get my keyboard input working properly, and I ran into a problem with the dash/underscore key. I've downloaded 2.3.2 and I'm pretty sure I have it installed in the right location, but I'm still getting a problem with the dash/underscore key. I wrote a little test, the "A" and "=" are working, but not dash:

#include <iostream>
#include <SFML/Audio.hpp>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>


int main(){
    while (true){
        if(sf::Keyboard::isKeyPressed(sf::Keyboard::A)){//1
            std::cout << "aA\n";
        }
       
        if(sf::Keyboard::isKeyPressed(sf::Keyboard::Dash)){// error???
            std::cout << "-dash-\n";
        }
       
        if(sf::Keyboard::isKeyPressed(sf::Keyboard::Subtract)){// error???
            std::cout << "-minus-\n";
        }
       
        if(sf::Keyboard::isKeyPressed(sf::Keyboard::Equal)){
            std::cout << "=\n";
        }
    }
    return 0;
}

I'm using a macbook pro with yosemite, and no extended keyboard, I hope that makes it clear.

Pages: [1]