1
Graphics / Re: [SOLVED] OpenGL oddness
« on: January 26, 2022, 02:09:55 am »
Realized I shouldn't be mixing glut with sfml
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.
$ cargo run --example mouse
Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
Running `/home/ed/program/rust/rust-sfml/target/debug/examples/mouse`
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 154 (GLX)
Minor opcode of failed request: 3 (X_GLXCreateContext)
Value in failed request: 0x0
Serial number of failed request: 38
Current serial number in output stream: 39
Android NDK: WARNING: APP_PLATFORM android-14 is larger than android:minSdkVersion 9 in ./AndroidManifest.xml
Gdbserver : [arm-linux-androideabi-4.6] libs/armeabi-v7a/gdbserver
Gdbsetup : libs/armeabi-v7a/gdb.setup
Install : libsfml-activity.so => libs/armeabi-v7a/libsfml-activity.so
Install : libsfml-example.so => libs/armeabi-v7a/libsfml-example.so
Install : libsfml-system.so => libs/armeabi-v7a/libsfml-system.so
Install : libsfml-window.so => libs/armeabi-v7a/libsfml-window.so
Install : libsfml-graphics.so => libs/armeabi-v7a/libsfml-graphics.so
Install : libsfml-audio.so => libs/armeabi-v7a/libsfml-audio.so
Install : libsfml-network.so => libs/armeabi-v7a/libsfml-network.so
Install : libstlport_shared.so => libs/armeabi-v7a/libstlport_shared.so
Install : libopenal.so => libs/armeabi-v7a/libopenal.so
Install : libsndfile.so => libs/armeabi-v7a/libsndfile.so
Here are what I think are the relevant log messages when it crashes:02-02 16:30:52.743: I/ActivityManager(601): Start proc com.example.sfml for activity com.example.sfml/android.app.NativeActivity: pid=22731 uid=10155 gids={50155}
02-02 16:30:52.763: I/SearchController(24544): #onHotwordDetectorStopped
02-02 16:30:52.763: I/MicrophoneInputStream(24544): mic_close
02-02 16:30:52.773: D/dalvikvm(826): GC_CONCURRENT freed 495K, 6% free 9518K/10080K, paused 2ms+1ms, total 15ms
02-02 16:30:52.843: D/dalvikvm(24544): threadid=49: thread exiting, not yet detached (count=0)
02-02 16:30:52.843: D/dalvikvm(24544): threadid=37: thread exiting, not yet detached (count=0)
02-02 16:30:52.893: I/Adreno-EGL(22731): <qeglDrvAPI_eglInitialize:320>: EGL 1.4 QUALCOMM Build: I0404c4692afb8623f95c43aeb6d5e13ed4b30ddbDate: 11/06/13
02-02 16:30:52.914: D/dalvikvm(826): GC_CONCURRENT freed 388K, 6% free 9515K/10080K, paused 1ms+1ms, total 14ms
02-02 16:30:53.084: D/dalvikvm(826): GC_CONCURRENT freed 483K, 6% free 9520K/10080K, paused 2ms+2ms, total 21ms
02-02 16:30:53.444: A/libc(22731): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 22748 (om.example.sfml)
02-02 16:30:53.504: I/DEBUG(171): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
02-02 16:30:53.504: I/DEBUG(171): Build fingerprint: 'google/occam/mako:4.4.2/KOT49H/937116:user/release-keys'
02-02 16:30:53.504: I/DEBUG(171): Revision: '10'
02-02 16:30:53.504: I/DEBUG(171): pid: 22731, tid: 22748, name: om.example.sfml >>> com.example.sfml <<<
02-02 16:30:53.504: I/DEBUG(171): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
and the backtrace:02-02 16:30:53.654: I/DEBUG(171): backtrace:
02-02 16:30:53.664: I/DEBUG(171): #00 pc 00000000 <unknown>
02-02 16:30:53.664: I/DEBUG(171): #01 pc 000417a3 /system/lib/egl/libGLESv2_adreno.so (glGetString+16)
02-02 16:30:53.664: I/DEBUG(171): #02 pc 0001c909 /system/lib/egl/libGLESv1_CM_adreno.so (Load_Gll_2_0+984)
02-02 16:30:53.664: I/DEBUG(171): #03 pc 00021d03 /system/lib/egl/libGLESv1_CM_adreno.so (gliMakeCurrent+18)
02-02 16:30:53.664: I/DEBUG(171): #04 pc 00024d89 /system/lib/egl/libGLESv1_CM_adreno.so (oglSetBuffers+48)
02-02 16:30:53.664: I/DEBUG(171): #05 pc 0001c7f4 /system/lib/egl/libEGL_adreno.so (eglGLUpdateSurfaces+648)
02-02 16:30:53.664: I/DEBUG(171): #06 pc 00010b50 /system/lib/egl/libEGL_adreno.so (qeglDrvAPI_eglMakeCurrent+628)
02-02 16:30:53.664: I/DEBUG(171): #07 pc 00006b0c /system/lib/egl/libEGL_adreno.so (eglMakeCurrent+16)
02-02 16:30:53.664: I/DEBUG(171): #08 pc 0000d3e5 /system/lib/libEGL.so (android::egl_display_t::makeCurrent(android::egl_context_t*, android::egl_context_t*, void*, void*, void*, void*, void*, void*)+84)
I have tried it using API Level 17, 18 and 19 on AVD's.
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/OpenGL.hpp>
#include <iostream>
using namespace std;
int main()
{
sf::Window App(sf::VideoMode(800, 600, 32), "SFML OpenGL");
sf::Clock Clock;
glClearDepth(1.f);
glClearColor(0.f, 0.f, 0.f, 0.f);
sf::Texture Texture;
if( Texture.LoadFromFile( "test.png" ) )
{
cout << "image loaded!" << endl;
}
else
{
cout << "image not found!" << endl;
}
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.f, 1.f, 1.f, 500.f);
double seconds = 0;
while (App.IsOpened())
{
sf::Event Event;
while (App.PollEvent(Event))
{
if (Event.Type == sf::Event::Closed)
App.Close();
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Keyboard::Escape))
App.Close();
if (Event.Type == sf::Event::Resized)
glViewport(0, 0, Event.Size.Width, Event.Size.Height);
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.f, 0.f, -200.f);
seconds = Clock.GetElapsedTime() / 1000.0;
glRotatef( seconds * 50 , 1.f, 0.f, 0.f);
glRotatef( seconds * 30 , 0.f, 1.f, 0.f);
glRotatef( seconds * 90 , 0.f, 0.f, 1.f);
//Uncommenting the next line does not affect the cube at all
//Texture.Bind();
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex3f(-50.f, -50.f, -50.f);
glTexCoord2f(0, 1); glVertex3f(-50.f, 50.f, -50.f);
glTexCoord2f(1, 1); glVertex3f( 50.f, 50.f, -50.f);
glTexCoord2f(1, 0); glVertex3f( 50.f, -50.f, -50.f);
glTexCoord2f(0, 0); glVertex3f(-50.f, -50.f, 50.f);
glTexCoord2f(0, 1); glVertex3f(-50.f, 50.f, 50.f);
glTexCoord2f(1, 1); glVertex3f( 50.f, 50.f, 50.f);
glTexCoord2f(1, 0); glVertex3f( 50.f, -50.f, 50.f);
glTexCoord2f(0, 0); glVertex3f(-50.f, -50.f, -50.f);
glTexCoord2f(0, 1); glVertex3f(-50.f, 50.f, -50.f);
glTexCoord2f(1, 1); glVertex3f(-50.f, 50.f, 50.f);
glTexCoord2f(1, 0); glVertex3f(-50.f, -50.f, 50.f);
glTexCoord2f(0, 0); glVertex3f(50.f, -50.f, -50.f);
glTexCoord2f(0, 1); glVertex3f(50.f, 50.f, -50.f);
glTexCoord2f(1, 1); glVertex3f(50.f, 50.f, 50.f);
glTexCoord2f(1, 0); glVertex3f(50.f, -50.f, 50.f);
glTexCoord2f(0, 1); glVertex3f(-50.f, -50.f, 50.f);
glTexCoord2f(0, 0); glVertex3f(-50.f, -50.f, -50.f);
glTexCoord2f(1, 0); glVertex3f( 50.f, -50.f, -50.f);
glTexCoord2f(1, 1); glVertex3f( 50.f, -50.f, 50.f);
glTexCoord2f(0, 1); glVertex3f(-50.f, 50.f, 50.f);
glTexCoord2f(0, 0); glVertex3f(-50.f, 50.f, -50.f);
glTexCoord2f(1, 0); glVertex3f( 50.f, 50.f, -50.f);
glTexCoord2f(1, 1); glVertex3f( 50.f, 50.f, 50.f);
glEnd();
App.Display();
}
return EXIT_SUCCESS;
}
#include <SFML/Graphics.hpp>
#include <vector>
using namespace std;
class GameObject {
public:
GameObject( sf::RenderWindow &render_window ) : render_window( render_window )
{
};
GameObject( const GameObject& game_object ) : render_window( game_object.render_window )
{
};
GameObject& operator= (const GameObject & game_object )
{
};
private:
sf::RenderWindow& render_window;
};
int main()
{
vector<GameObject> test;
sf::RenderWindow app;
GameObject go (app);
test.push_back(go);
}
[\code]
#include <SFML/Graphics.hpp>
#include <vector>
using namespace std;
class GameObject {
public:
GameObject::GameObject( sf::RenderWindow &render_window ) : render_window( render_window )
{
};
private:
sf::RenderWindow& render_window;
};
int main()
{
vector<GameObject> test;
sf::RenderWindow app;
GameObject go (app);
test.push_back(go);
}
g++ -o game example.cpp -lsfml-graphics -lsfml-window -lsfml-system
example.cpp:8:5: error: extra qualification âGameObject::â on member âGameObjectâ [-fpermissive]
example.cpp: In member function âGameObject& GameObject::operator=(const GameObject&)â:
example.cpp:6:7: instantiated from âvoid std::vector<_Tp, _Alloc>::_M_insert_aux(std::vector<_Tp, _Alloc>::iterator, const _Tp&) [with _Tp = GameObject, _Alloc = std::allocator<GameObject>, std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<GameObject*, std::vector<GameObject> >, typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer = GameObject*]â
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../include/c++/4.6.2/bits/stl_vector.h:834:4: instantiated from âvoid std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = GameObject, _Alloc = std::allocator<GameObject>, std::vector<_Tp, _Alloc>::value_type = GameObject]â
example.cpp:22:20: instantiated from here
example.cpp:6:7: error: non-static reference member âsf::RenderWindow& GameObject::render_windowâ, canât use default assignment operator
In file included from /usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../include/c++/4.6.2/vector:70:0,
from /usr/include/SFML/Window/VideoMode.hpp:32,
from /usr/include/SFML/Window.hpp:39,
from /usr/include/SFML/Graphics.hpp:32,
from example.cpp:1:
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../include/c++/4.6.2/bits/vector.tcc: In member function âvoid std::vector<_Tp, _Alloc>::_M_insert_aux(std::vector<_Tp, _Alloc>::iterator, const _Tp&) [with _Tp = GameObject, _Alloc = std::allocator<GameObject>, std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<GameObject*, std::vector<GameObject> >, typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer = GameObject*]â:
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../include/c++/4.6.2/bits/vector.tcc:317:4: note: synthesized method âGameObject& GameObject::operator=(const GameObject&)â first required here
#include <SFML/Graphics.hpp>
#include <vector>
using namespace std;
class GameObject {
public:
GameObject::GameObject( sf::RenderWindow &render_window ) : render_window( render_window )
{
};
GameObject( const GameObject& game_object ) : render_window( game_object.render_window )
{
};
private:
sf::RenderWindow& render_window;
};
int main()
{
vector<GameObject> test;
sf::RenderWindow app;
GameObject go (app);
test.push_back(go);
}
g++ -o game example2.cpp -lsfml-graphics -lsfml-window -lsfml-system
example2.cpp:7:5: error: extra qualification âGameObject::â on member âGameObjectâ [-fpermissive]
example2.cpp: In member function âGameObject& GameObject::operator=(const GameObject&)â:
example2.cpp:5:7: instantiated from âvoid std::vector<_Tp, _Alloc>::_M_insert_aux(std::vector<_Tp, _Alloc>::iterator, const _Tp&) [with _Tp = GameObject, _Alloc = std::allocator<GameObject>, std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<GameObject*, std::vector<GameObject> >, typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer = GameObject*]â
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../include/c++/4.6.2/bits/stl_vector.h:834:4: instantiated from âvoid std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = GameObject, _Alloc = std::allocator<GameObject>, std::vector<_Tp, _Alloc>::value_type = GameObject]â
example2.cpp:23:20: instantiated from here
example2.cpp:5:7: error: non-static reference member âsf::RenderWindow& GameObject::render_windowâ, canât use default assignment operator
In file included from /usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../include/c++/4.6.2/vector:70:0,
from /usr/include/SFML/Window/VideoMode.hpp:32,
from /usr/include/SFML/Window.hpp:39,
from /usr/include/SFML/Graphics.hpp:32,
from example2.cpp:1:
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../include/c++/4.6.2/bits/vector.tcc: In member function âvoid std::vector<_Tp, _Alloc>::_M_insert_aux(std::vector<_Tp, _Alloc>::iterator, const _Tp&) [with _Tp = GameObject, _Alloc = std::allocator<GameObject>, std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<GameObject*, std::vector<GameObject> >, typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer = GameObject*]â:
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../include/c++/4.6.2/bits/vector.tcc:317:4: note: synthesized method âGameObject& GameObject::operator=(const GameObject&)â first required here