Tsumuji

Members
  • Content count

    118
  • Joined

  • Last visited

Community Reputation

144 Neutral

About Tsumuji

  • Rank
    Member
  1. Failures in my scene.

    There no gaps. initialization code: ... glEnable( GL_DEPTH_TEST ); glDepthFunc( GL_LEQUAL ); glEnable( GL_CULL_FACE ); glCullFace(GL_BACK); glPolygonMode( GL_FRONT, GL_FILL ); //default glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST ); glClearColor( 0.0, 1.0, 0.0, 1.0 ); glClearDepth( 1.0 ); glViewport( 0, 0, this->window.w, this->window.h ); glEnable( GL_BLEND ); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_TEXTURE_2D); ... The code: ... int slotgame::render(){ float centerposw = this->window.w/2.0; float centerposh = this->window.h/2.0; glDisable( GL_CULL_FACE ); setOrthographicMode( this->window.w, this->window.h ); // glTranslatef( 250.0, 0.0, 0.0 ); // glRotatef( 85, 0.0, 1.0, 0.0 ); // glRotatef( 15, 0.0, 0.0, 1.0 ); /* glBegin( GL_TRIANGLES ); glVertex3f( 0.0, 0.0, 0.0 ); glVertex3f( 1.0, 0.0, 0.0 ); glVertex3f( 0.0, 1.0, 0.0 ); glEnd();*/ //Fundo glPushMatrix(); glTranslatef( centerposw, centerposh, 0.0 ); _fundo.render(); glPopMatrix(); //Fundo // unsetOrthographicMode(); // return 0; //linhas for ( unsigned int j=0; j<8; j++ ){ //colunas for ( unsigned int i=0; i<5; i++ ){ glPushMatrix(); glTranslatef( centerposw - _sprts.at(i+5*j).width()*2 + _sprts.at(i+5*j).width()*i, centerposh /*+ _sprts.at(i+5*j).width() - _sprts.at(i+5*j).width()*j*/, 0.0 ); if ( not _paraRoda.at(i) ) _sprts.at(i+5*j).rotate( (45.0*j)-45.0 + rdtsc()/10000000, 1.0, 0.0, 0.0 ); else{ _sprts.at(i+5*j).rotate(); _sprts.at(i+5*j).render( 120.0 ); glPopMatrix(); } } unsetOrthographicMode(); return 0; } ... ... int slotsprite::render(){ return this->render( 0.0 ); } int slotsprite::render( float zMod ){ //_lastxRotDegree -= glBindTexture( GL_TEXTURE_2D, _myTexture.id() ); glColor3f(1.0,1.0,1.0); glBegin( GL_QUADS ); /* glTexCoord2f( 0.0, 0.0 ); glVertex3f( 0.0, 0.0, 0.0 ); glTexCoord2f( 1.0, 0.0 ); glVertex3f( (1.0 * _mySize), 0.0, 0.0 ); glTexCoord2f( 1.0, 1.0 ); glVertex3f( (1.0 * _mySize), (1.0 * _mySize), 0.0 ); glTexCoord2f( 0.0, 1.0 ); glVertex3f( 0.0, (1.0 * _mySize), 0.0 );*/ glTexCoord2f( 0.0, 0.0 ); glVertex3f( (-0.5 * _mySizeW), (-0.5 * _mySizeH), 0.0 + zMod ); glTexCoord2f( 1.0, 0.0 ); glVertex3f( (0.5 * _mySizeW), (-0.5 * _mySizeH), 0.0 + zMod ); glTexCoord2f( 1.0, 1.0 ); glVertex3f( (0.5 * _mySizeW), (0.5 * _mySizeH), 0.0 + zMod ); glTexCoord2f( 0.0, 1.0 ); glVertex3f( (-0.5 * _mySizeW), (0.5 * _mySizeH), 0.0 + zMod ); glEnd(); return 0; } ... This is the main code. As you can see, the code is clean and normal. Might be some type of OpenGL initialization? EDIT: Look at this scene. Is more representative for the problem: See the small two green points on the ground? They appear sporadicaly on the ground as I move the camera. [Edited by - Tsumuji on January 23, 2007 5:17:11 PM]
  2. When I render my scenes, I allways observe that failures happen when rendering quads or triangles. This failures are like that, one quad that touch the other, cannot fill correctly the space between them. So if I fill my space with glClearColor( 0.0, 1.0, 0.0, 1.0 ); little squares appear between the primitives. This happen depending on the camera angle. On some angles everything is ok, but others, I can see 3, 4, 5 of this points. How do I solve this? This is a picture of this problem. Is not very descriptive, but give an ideia: normal with failure Note that this numbers rotate in x axys. While they rotate, the spaces appear.
  3. know where can I get precompiled version of boost libraries? Was unable to compile that mess in windows...
  4. Well, this does not work at all. But the funny is that compiles good in a linux system. If I ommit void run(), then yes is unable to make myThread a Thread type: -------------- Build: Release in testegnu2 --------------- mingw32-g++.exe -Wall -O2 -IC:\MinGW\include -IG:\32\Qt\4.2.1\include -c main.cpp -o obj\Release\main.o In file included from C:/MinGW/include/cc++/thread.h:46, from main.cpp:2: C:/MinGW/include/cc++/config.h:58: warning: ignoring #pragma warning C:/MinGW/include/cc++/config.h:59: warning: ignoring #pragma warning main.cpp: In function `int main()': main.cpp:13: error: cannot declare variable `T' to be of type `myThread' main.cpp:13: error: because the following virtual functions are abstract: C:/MinGW/include/cc++/thread.h:1172: error: virtual void ost::Thread::run() Process terminated with status 1 (0 minutes, 0 seconds) 3 errors, 2 warnings What the hell? I think I'll start to use QThreads from QT from now on....
  5. I'm trying to compile the following source in windows using Code Blocks: #include <iostream> #include <cc++/thread.h> using namespace std; class myThread : ost::Thread{ void run(){ } }; int main(){ cout << "DDASD" << endl; myThread T; return 0; } But I get linker errors. Linker can't find the thread class. ???? -------------- Build: Release in testegnu2 --------------- mingw32-g++.exe -Wall -O2 -IC:\MinGW\include -IG:\32\Qt\4.2.1\include -c main.cpp -o obj\Release\main.o In file included from C:/MinGW/include/cc++/thread.h:46, from main.cpp:2: C:/MinGW/include/cc++/config.h:58: warning: ignoring #pragma warning C:/MinGW/include/cc++/config.h:59: warning: ignoring #pragma warning mingw32-g++.exe -LC:\MinGW\lib -LG:\32\Qt\4.2.1\lib -o bin\Release\testegnu2.exe obj\Release\main.o -s -lccgnu2 -lccext2 obj\Release\main.o(.text+0x49):main.cpp: undefined reference to `ost::Thread::Thread(int, unsigned int)' obj\Release\main.o(.text+0x58):main.cpp: undefined reference to `ost::Thread::~Thread()' obj\Release\main.o(.rdata$_ZTV8myThread[vtable for myThread]+0xc):main.cpp: undefined reference to `ost::Thread::final()' obj\Release\main.o(.rdata$_ZTV8myThread[vtable for myThread]+0x10):main.cpp: undefined reference to `ost::Thread::initial()' obj\Release\main.o(.rdata$_ZTV8myThread[vtable for myThread]+0x14):main.cpp: undefined reference to `ost::Thread::getExtended()' obj\Release\main.o(.rdata$_ZTV8myThread[vtable for myThread]+0x18):main.cpp: undefined reference to `ost::Thread::notify(ost::Thread*)' obj\Release\main.o(.text$_ZN8myThreadD1Ev[myThread::~myThread()]+0x13):main.cpp: undefined reference to `ost::Thread::~Thread()' obj\Release\main.o(.text$_ZN8myThreadD0Ev[myThread::~myThread()]+0x14):main.cpp: undefined reference to `ost::Thread::~Thread()' collect2: ld returned 1 exit status Process terminated with status 1 (0 minutes, 1 seconds) 8 errors, 2 warnings How? I'm compiling correctly. What's wrong?
  6. one more doubt: When I call wglShareLists, I pass the first parameter as my current context(the main context), and the second, the one I want to get the textures generated from? I tried here, but get lost with the original image. Only the secondary context can be seen in screen now, not the main context.
  7. Yeah, I discover that yesterday at night. You're right. You need ro pass the parameter at creatin time with glXCreateContext(); Thanks for the replies!
  8. Is possible pass the textures generated in one OpenGL context to another? I have tried here and was sucessfull in creating a multi context in separate threads application. So, I have 2 windows running in parallel each one with own openGL context. And is working. But I want to know if it is possible to pass texturess generated by thread 2, to thread 1, so I can exibit textures loaded from thread 2 in thread 1?
  9. LoL I made a second context here using glX. I create two windows, the first, the one that do the rendering screen, and a dummy window that is not displayed, is only for create the second context. So, in the thread, I call glXMakeCurrent, and everything is loaded and textures generated in that second context. Good. But now, how can I pass the ids of the textures generated in that context, for the main context? I'm actually calling glXCopyContext( this->_GLX_display, w.getGLXContext(), this->_GLX_context, GL_ALL_ATTRIB_BITS );, but I don't know if this is the correct way to pass the ids.
  10. I think I got the point, but I'm using here SDL to create the window. Is possible to switch contexts in SDL? I can't see nothing in documentation about that...
  11. ok, but what I want to avoid here is the choppy thing that hapen when heavy models are loading. See Lineage 2. Even if you have a power computer running in RAID, Lineage continues choppy, no matter what. How avoid this so?
  12. I'm here trying to do a paralleled model loading(load a model mesh and all his data by a thread to accelerate things), to use this in a OpenGL app. There's a good way to do that? A good approach? What I've tryied here, demonstrated that I can only load pure data from model file(ms3d). When I go to generate textures for this model, I must do this in the main thread, wich is the same wich draw things on screen. So I can only do that? Nothing more?
  13. ok guys, thanks for the answers. So I implemented in that way: typedef class vec2{ GLfloat value[2]; public: //GLfloat x; //GLfloat y; vec2( ); vec2( GLfloat ); vec2( GLfloat, GLfloat ); vec2& operator= ( const vec2& ); GLfloat& operator[] ( int ); const GLfloat operator[] ( int ) const; vec2& operator+ ( const vec2& ); vec2& operator- ( const vec2& ); vec2& operator* ( const vec2& ); vec2& operator/ ( const vec2& ); float* raw(); }; vec2::vec2( ){ this->value[0] = 0.0; this->value[1] = 0.0; } vec2::vec2( GLfloat fp ){ this->value[0] = fp; this->value[1] = fp; } vec2::vec2( GLfloat fp1, GLfloat fp2 ){ this->value[0] = fp1; this->value[1] = fp2; } vec2& vec2::operator= ( const vec2& vp ){ this->value[0] = vp.value[0]; this->value[1] = vp.value[1]; return *this; } GLfloat& vec2::operator[] ( int ip ){ return this->value[ip]; } const GLfloat vec2::operator[] ( int ip ) const{ return this->value[ip]; } vec2& vec2::operator+ ( const vec2& vp ){ this->value[0] += vp.value[0]; this->value[1] += vp.value[1]; return *this; } vec2& vec2::operator- ( const vec2& vp ){ this->value[0] -= vp.value[0]; this->value[1] -= vp.value[1]; return *this; } vec2& vec2::operator* ( const vec2& vp ){ this->value[0] *= vp.value[0]; this->value[1] *= vp.value[1]; return *this; } vec2& vec2::operator/ ( const vec2& vp ){ this->value[0] /= vp.value[0]; this->value[1] /= vp.value[1]; return *this; } float* vec2::raw( ){ return this->value; }
  14. oh yeah, I forgeted that I can access the value directly. So wich is the best way to implement? (the fastest) vec2& operator= ( const vec2& vp ){ value[0] = vp.value[0]; value[1] = vp.value[1]; return *this; } float& operator[] ( int idx ){ return value[idx]; } or vec2& operator= ( const vec2& vp ){ value[0] = vp[0]; value[1] = vp1]; return *this; } float operator[] ( int idx ) const{ return value[idx]; } I think is equal. or no?