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

Pages: 1 [2] 3 4 ... 9
16
go here

https://www.packtpub.com/packt/offers/free-learning

make an account

download free pdf of book


17
the quote is from https://github.com/SFML/SFML/pull/1235

so what does it mean that 3.0 has breaking changes ?

code samples in existing books will now need "minor" / "major" changes ?

the tutorials and wiki will need significant changes ?

sfml will no longer work on OpenGL < 3.1 ? 

or something inconsequential like "existing programs will need to be recompiled due to changes in sfml dependencies"

18
General / Re: OpenGL basic program triangle isn't visible
« on: September 08, 2017, 06:38:09 am »
try this


// Link statically with GLEW
#define GLEW_STATIC
#include <GL/glew.h>

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

#include <iostream>

GLenum glCheckError_(const char *file, int line)
{
    GLenum errorCode;
    while ((errorCode = glGetError()) != GL_NO_ERROR)
    {
        std::string error;
        switch (errorCode)
        {
            case GL_INVALID_ENUM:                  error = "INVALID_ENUM"; break;
            case GL_INVALID_VALUE:                 error = "INVALID_VALUE"; break;
            case GL_INVALID_OPERATION:             error = "INVALID_OPERATION"; break;
            case GL_STACK_OVERFLOW:                error = "STACK_OVERFLOW"; break;
            case GL_STACK_UNDERFLOW:               error = "STACK_UNDERFLOW"; break;
            case GL_OUT_OF_MEMORY:                 error = "OUT_OF_MEMORY"; break;
            case GL_INVALID_FRAMEBUFFER_OPERATION: error = "INVALID_FRAMEBUFFER_OPERATION"; break;
        }
        std::cout << error << " | " << file << " (" << line << ")" << std::endl;
    }
    return errorCode;
}
#define glCheckError() glCheckError_(__FILE__, __LINE__)

int main()
{
    sf::ContextSettings settings;

    settings.majorVersion = 3;
    settings.minorVersion = 2;
    settings.attributeFlags = 1;

    settings.depthBits = 24;
    settings.stencilBits = 8;
    settings.antialiasingLevel = 2;

    sf::Window window(sf::VideoMode(800, 600), "OpenGL", sf::Style::Titlebar | sf::Style::Close, settings);
    window.setActive();

    settings = window.getSettings();

    std::cout << "version: " << settings.majorVersion << "." << settings.minorVersion << std::endl;
    std::cout << "attributeFlags: " << settings.attributeFlags << std::endl;
    std::cout << "depth bits: " << settings.depthBits << std::endl;
    std::cout << "stencil bits: " << settings.stencilBits << std::endl;
    std::cout << "antialiasing level: " << settings.antialiasingLevel << std::endl;

    // Initialize GLEW
    glewExperimental = GL_TRUE;
    glewInit();

    const GLchar* vertexSource = R"glsl(
        #version 150 core
        in vec2 position;
        void main()
        {
            gl_Position = vec4(position, 0.0, 1.0);
        }
    )glsl"
;

    const GLchar* fragmentSource = R"glsl(
        #version 150 core
        out vec4 outColor;
        uniform vec3 triangleColor;
        void main()
        {
            //outColor = vec4(triangleColor, 1.0);
            outColor = vec4(1.0, 1.0, 1.0, 1.0);
        }
    )glsl"
;

    GLfloat vertices[] = {
         0.0f,  0.5f,
         0.5f, -0.5f,
        -0.5f, -0.5f
    };

    GLuint vao;
    glGenVertexArrays(1, &vao);
    glBindVertexArray(vao);

    glCheckError();

    GLuint vbo;
    glGenBuffers(1, &vbo);
    glBindBuffer(GL_ARRAY_BUFFER, vbo);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);

    glCheckError();

    GLuint vertexShader{glCreateShader(GL_VERTEX_SHADER)};
    glShaderSource(vertexShader, 1, &vertexSource, nullptr);
    glCompileShader(vertexShader);

    glCheckError();

    GLuint fragmentShader{glCreateShader(GL_FRAGMENT_SHADER)};
    glShaderSource(fragmentShader, 1, &fragmentSource, nullptr);
    glCompileShader(fragmentShader);

    glCheckError();

    GLuint shaderProgram{glCreateProgram()};
    glAttachShader(shaderProgram, vertexShader);
    glAttachShader(shaderProgram, fragmentShader);
    glBindFragDataLocation(shaderProgram, 0, "outColor");
    glLinkProgram(shaderProgram);
    glUseProgram(shaderProgram);

    glCheckError();

    GLint posAttrib{glGetAttribLocation(shaderProgram, "position")};
    glEnableVertexAttribArray(posAttrib);
    glVertexAttribPointer(posAttrib, 2, GL_FLOAT, GL_FALSE, 0, 0);

    glCheckError();

    bool running{true};

    while (running)
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                running = false;
            else if (event.type == sf::Event::KeyPressed)
                if (event.key.code == sf::Keyboard::Return)
                    running = false;
        }

        glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        glDrawArrays(GL_TRIANGLES, 0, 3);

        glCheckError();

        window.display();
    }

    glDeleteProgram(shaderProgram);
    glDeleteShader(fragmentShader);
    glDeleteShader(vertexShader);
    glDeleteBuffers(1, &vbo);
    glDeleteVertexArrays(1, &vao);
    window.close();
}

 

19
General / Re: OpenGL basic program triangle isn't visible
« on: September 07, 2017, 12:33:18 pm »

    /*
    std::vector<float> vertices
    {
        0.0f, 0.5f,
        0.5f, -0.5f,
        -0.5f, -0.5f
    };
    */

   GLfloat vertices[] = {
         0.0f,  0.5f,
         0.5f, -0.5f,
        -0.5f, -0.5f
    };

    //glBufferData(GL_ARRAY_BUFFER, vertices.size(), &vertices[0], GL_STATIC_DRAW);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);

 

I changed those lines
that seems to make it work

20
General / Re: Compiling in terminal- Mac
« on: July 22, 2017, 12:03:25 am »
try
-I instead of -L

-I /users/Erica/Desktop/SFML/include -lsfml-graphics -lsfml-window -lsfml-system

https://courses.cs.washington.edu/courses/cse373/99au/unix/g++.html

http://web.engr.oregonstate.edu/~rubinma/Mines_274/Content/Slides/05_compilation.pdf

21
Sadly, even for free I wouldn't recommend this book.  :-\

"I still don't understand why the author/editor decided to use colored images in a black and white book"

because they look great in the pdf version
probably look good in the kindle version too

"too many code snippets are either badly formatted and don't fit properly on the page"

boo freaking hoo 
so the code takes up more than one page
get over it

"on the other he sticks with std::rand, ... no notion of gaussian or any other *actual* distribution."

who cares ?

in 99% of games it will not matter 

that criticism is like putting down an SFML book because it doesn't show fixed delta time and integration

its a fine book for a beginner
especially considering its free

22
I think that would be a pain in the butt to maintain

are they supposed to do an installation for
Visual Studio 2015
and
Visual Studio 2017   ?

static and dynamic set up ?

debug and release ?

and also codeblocks on windows ?
and codeblocks on linux ?



23
Feature requests / Re: addColor method
« on: June 12, 2017, 08:33:07 am »
And then? ...  addPosition, subPosition ...? And this big mess in all SFML drawable classes?

isn't that what move is ?

https://www.sfml-dev.org/documentation/2.4.2/classsf_1_1Transformable.php#ab9ca691522f6ddc1a40406849b87c469

26
SFML website / Shapes tutorial - bad link
« on: May 08, 2017, 11:21:54 pm »
on this page

https://www.sfml-dev.org/tutorials/2.4/graphics-shape.php

the menu says
Home»Learn»2.4 Tutorials»Shapes

but if you click on Shapes
you get "Page not found"
that's because its points to
https://www.sfml-dev.org/tutorials/2.4/graphics-shapes.php 

notice its shapes.php instead of shape.php

27
General discussions / Re: Just starting out with SFML
« on: April 12, 2017, 09:32:50 am »
https://www.youtube.com/playlist?list=PLB_ibvUSN7mzUffhiay5g5GUHyJRO4DYr

these will give you an idea how sfml works

these are just basic examples, they aren't split into proper classes or asset management or anything

28
No.
As of now, there is no VS2017 build on the download page. Building SFML by oneself w/ VS 2017 is necessary, if one wants to use VS2017.

so this is incorrect ?

The VS2015 libs should be compatible with VS2017. ...

29
just download from here

https://www.sfml-dev.org/download/sfml/2.4.2/

no need to bother with cmake or send binaries


30
General discussions / Re: SFML Game Development review
« on: April 05, 2017, 04:59:45 am »
they may be horrible publishers, but everyone should sign up for the "FREE LEARNING FOREVER"

https://www.packtpub.com/

I have gotten so much good stuff for free

just this month I've got

Learning C# by Developing Games with Unity 5.x - Second Edition [eBook]

Learning Data Mining with Python [eBook]

Raspberry Pi Projects for Kids [eBook]

C# 6 and .NET Core 1.0: Modern Cross-Platform Development [eBook]


Pages: 1 [2] 3 4 ... 9