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

Pages: [1]
1
Hey everybody,

currently I'm trying to mix OpenGL and SFML. Used the great OpenGL 3.3 tutorials at learnopengl.com to render a cube with two textures on it. That works without problems, even when using sf::RenderWindow().
The shaders use the texture units GL_TEXTURE0 and GL_TEXTURE1.

The problems arise if I also use a sf::RectangleShape besides the pure gl-calls.

My loop is like:

window.setActive(true);

glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, tex1_id);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, tex2_id);

glUseProgram(shader_id);

model = glm::rotate(glm::mat4(1.0f), clock.getElapsedTime().asSeconds(), glm::vec3(0.5f, 1.0f, 0.0f));
glUniformMatrix4fv(glGetUniformLocation(shader_id, "model"), 1, GL_FALSE, &model[0][0]);

glBindVertexArray(VAO);
glDrawArrays(GL_TRIANGLES, 0, 36);
glBindVertexArray(0);

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, 0);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, 0);

glUseProgram(0);

window.setActive(false);


window.pushGLStates();
window.draw(cell_shape); // sf::RectangleShape cell_shape(sf::Vector2f(15, 15));
window.popGLStates();


window.display();
 

If I order the window to pushGLStates it issues:
An internal OpenGL call failed in rendertarget.cpp(381).
Expression:
   glPushMatrix()
Error description:
   GL_STACK_OVERFLOW
   This command would cause a stack overflow.
 

And at popGLStates:
An internal OpenGL call failed in rendertarget.cpp(398).
Expression:
   glPopMatrix()
Error description:
   GL_STACK_UNDERFLOW
   This command would cause a stack underflow.
 

This only happens if I use both texture units. The error disappears if I don't bind GL_TEXTURE1. Only one currently bound texture seems to be no problem, two simultaneously bound textures are indeed a problem. It doesn't matter which tex units I use (GL_TEXTURE2, GL_TEXTURE3, ...), they all issue the errors.

Most disturbing is that everything is rendered correctly...


Any ideas?
I'm using SFML from repo, cloned five days ago from master, together with VS2017 and Win7-64.
Perhaps it's a problem with my graphics card; I only have the crappy Intel HD 5500. I have no other device for testing.

2
Audio / Implementation of sf::SoundBuffer
« on: December 11, 2008, 12:05:11 pm »
Hi Laurent,

as I studied the source of the audio package of SFML I wondered why you were storing the samples in the vector myBuffer in sf::SoundBuffer. AFAIK OpenAL copies the sample data with alBufferData(..), so you just could use temporary memory and free it after the call to alBufferData(..).

Correct me if I'm wrong! If I'm right, I'd like to know why you did it this way  :wink:


Martin

3
General / [Win32/VS2005] Crash in Release Mode
« on: July 30, 2008, 02:35:58 pm »
Hi everybody,

today I started to make a skeleton for any applications I'm going to create. It's a very simple Application class:

Header:
Code: [Select]

#ifndef H_APPLICATION
#define H_APPLICATION

#include <SFML/Graphics.hpp>

class Application {

public:
int Run();

private:
bool InitApp();
sf::RenderWindow MainWindow;
};
#endif


Implementation:
Code: [Select]

#include "Application.h"

int Application::Run(){
if (!InitApp()){
return -1;
}

while (MainWindow.IsOpened()){
        // Process events
        sf::Event Event;
        while (MainWindow.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                MainWindow.Close();
        }

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

return 0;
};

bool Application::InitApp() {
MainWindow.Create(sf::VideoMode(640, 480), "TheEye");

return true;
};


main.cpp
Code: [Select]

#include "Application.h"

int main() {
Application TheApp;
return TheApp.Run();
}


As you see, I'd like to seperate initialisation, event handling etc in seperate methods of my class Application. Straight OOP.

My Problem now is a exception that occurs just after closing the window in Release mode.

Error message is
Quote
A buffer overrun has occurred in TheEye.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program.

The program breaks at line 298 in the file gs_report.c from Microsoft.

Any ideas how to solve this? CRT is dynamically linked, Unicode enabled, I'm using sfml-main-d.lib, sfml-window-d.lib and sfml-graphics-d.lib in Debug mode and sfml-main.lib, sfml-window.lib and sfml-graphics.lib in Release mode.

greetings
Martin

4
Graphics / "Draw Sprites into a single Image" or "Stress
« on: July 17, 2008, 07:24:15 pm »
Hi there,

just another question:
Is there a way to draw sprites to maybe an Image? Following situation:
My GUI is constructed of many parts. The process of construction (filling in the right numbers for sprite's positions) is only done at startup and window resize. The Sprites of the GUI are then rendered one by one. I'd like to know if it would make sense to render it en bloc (if the requirement of drawing to an Image would be fulfilled) or to render Sprite by Sprite?

I didn't make a stress test yet, thus I'm not sure what number of Sprites is regarded as "normal" or suitable. I know it'd be depending on the used system, just take a normal, 2-3 years old single core with medium 3d capabilities. At which amount of Sprites would the FPS go down under 30fps? Resolution about 1024x768, 32bpp. I know, it is a rather imprecise question depending on multiple values, but I'm just interested in your experiences.


greets
Martin

5
Graphics / Accessing Unicode Codepoints
« on: July 17, 2008, 10:52:56 am »
Hi there,

today I decided to fiddle around with Unicode and to try out if I'm able to bring some cyrillic oder japanese glyphs on the screen.

Tried the following:
Code: [Select]

sf::String UnicodeString;
std::wstring sfmlrocks(L"SFML ROCKS with \u0426!"); // the u0426 should be the cyrillic letter Tse...
UnicodeString.SetText(sfmlrocks);

The font I used with "UnicodeString" knows this letter Tse, proofed in the Windows app "charmap.exe". But when I draw the string, nothing appears, only an additional space before the "!". Has anyone got some hints what to do now?


greets
Martin

PS:
It's a VS2005-Project with Unicode enabled...

Pages: [1]