• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About thorpe

  • Rank
  1. I've heard that different processors have different ways of representing floats and doubles (besides from the endian issue)? Is this true? I though everybody followed the IEEE-standard. How do I best send doubles and floats over a network connection?
  2. DirectInput 8

    Thanks a billion :)
  3. I get a linker error when trying to compile my DirectInput 8 code. LINK : error LNK2020: unresolved token (0A0000B4) IID_IDirectInput8A LINK : error LNK2020: unresolved token (0A0000B6) GUID_SysKeyboard LINK : error LNK2020: unresolved token (0A0000BA) GUID_SysMouse I've found some old posts on the subjects which tells me to include dinput8.h. However I do not have such a file (not in any SDK I have, not even the latest december 2004 release). This is how I include the file: #define DIRECTINPUT_VERSION 0x0800 #include <dinput.h> I link with dinput8.lib. What could be wrong?
  4. Display lists crash

    Yes, the bug appears after, on average, 15 hours of intense testing. During that time, everything runs smoothly. Tricky tricky...
  5. Display lists crash

    Note: I think the display list displayed itself ok 2 times, and crashed when it was called the third time. I'm not sure if you need to check through all the code, I'm mainly interested in all reasons which could cause a displaylist to crash (since I think there shouldn't be any). The displaylist in question calls some other displaylists internally. For those of you who still want to :) : PileView, which draws a pile of chips. #include "PileView.hpp" #include "PileModel.hpp" #include "ChipDrawer.hpp" #include "View.hpp" namespace roulette{ int PileView::IDGenerator = 0; PileView::PileView(double x, double y, PositionedDrawable * parent, const PileModel& pileModel, float maxDisorderFactor, float rotationDisorderFactor, float rotation): PositionedDrawable((int)x,(int)y,0,parent), TimeDependent(), mPileModel(pileModel), mMaxDisorderFactor(maxDisorderFactor), mRotationDisorderFactor(rotationDisorderFactor), mRotation(rotation), mPileViewID(IDGenerator++), mLastFingerPrint(-1), mDisplayList(0) { } PileView::~PileView(){ dbop("X Deleting Pile View"); if(mDisplayList!=0){ glDeleteLists(mDisplayList,1); } } void PileView::setMaxDisorderFactor(float maxDisorderFactor){ mMaxDisorderFactor=maxDisorderFactor; mLastFingerPrint = -1; } void PileView::InternalDraw(bool mClickableObjectsOnly) const{ dbop("Calling list "+TO_STR(mDisplayList)); glCallList(mDisplayList); } void PileView::Update(int msPassed){ if(mPileModel.GetContentFingerPrint() != mLastFingerPrint){ dbop(">> Compiling new list!"); mLastFingerPrint = mPileModel.GetContentFingerPrint(); if(mDisplayList != 0){ dbop(">> Deleting old list "+TO_STR(mDisplayList)); glDeleteLists(mDisplayList,1); } mDisplayList=glGenLists(1); dbop(">> Generating new list "+TO_STR(mDisplayList)); glNewList(mDisplayList, GL_COMPILE); RenderPile(); glEndList(); dbop(">> Done generating list"); } } void PileView::RenderPile() const{ const ChipPile& cp = mPileModel.GetChipPileC(); dbop(" List contains pile of size "+TO_STR(cp.size())); glPushMatrix(); glTranslatef(0,0, View::Instance().GetChipDrawer()->GetHeight()*(double)cp.size()); int i=0; for(ChipPile::const_iterator it = cp.begin();it!=cp.end();it++, i++){ dbop(" Drawing a chip"); glPushMatrix(); unsigned int seed = rand(); //srand((*it).GetChipID()); // Old solution // New solution. 100 can be changed to any number. // This will affect the actual look of the piles srand(mPileViewID+100*(mPileModel.Size()-i)); // Fulhack 2000 double r = mMaxDisorderFactor* View::Instance().GetChipDrawer()->GetRadius()*rand_01(); double a = rand_0x(2.0*M_PI); double dx = r*cos(a); double dy = r*sin(a); glTranslatef(dx, dy, 0); dbop(" - Translating "+TO_STR(dx)+" "+TO_STR(dy)); double rotation = mRotation + mRotationDisorderFactor/2-rand_0x(mRotationDisorderFactor); glRotatef(rotation, 0.0, 0.0, 1.0); dbop(" - Rotating "+TO_STR(rotation)); if (mMaxDisorderFactor == 0.0 && it != cp.begin()) { // Draw topless chips in ordered piles (if not top chip) dbop(" - Topless chip"); View::Instance().GetChipDrawer()->DrawChip((*it), true); } else { dbop(" - Chip has top"); View::Instance().GetChipDrawer()->DrawChip((*it)); } srand(seed); glPopMatrix(); dbop(" - Translating z "+TO_STR(-View::Instance().GetChipDrawer()->GetHeight())); glTranslatef(0,0,-View::Instance().GetChipDrawer()->GetHeight()); } glPopMatrix(); } } ChipDrawer, which draws a chip #include "ChipDrawer.hpp" #include "TextureManager.hpp" #include "PlayerColor.hpp" #include "GetTextureEnum.hpp" namespace roulette{ const double CHIP_DEFAULT_HEIGHT = BP_CHIP_RADIUS/3.5; const int SBL_SLICES = 16; const int SBL_LOOPS = 1; const int SBL_STACKS = 1; ChipDrawer::ChipDrawer():mHeight(CHIP_DEFAULT_HEIGHT), mRadius(BP_CHIP_RADIUS){ mDiskQuadric = gluNewQuadric(); mCylinderQuadric = gluNewQuadric(); gluQuadricNormals(mDiskQuadric, GLU_FLAT); gluQuadricTexture(mDiskQuadric, GL_TRUE); gluQuadricNormals(mCylinderQuadric, GLU_SMOOTH); gluQuadricTexture(mCylinderQuadric, GL_TRUE); } ChipDrawer::~ChipDrawer(){ gluDeleteQuadric(mCylinderQuadric); gluDeleteQuadric(mDiskQuadric); dbop("X Deleting chip drawer"); for(int c=0;c<CH_NUMBER;c++){ for(int pl=0;pl<MAX_PLAYERS;pl++){ for(int b=0;b<2;b++){ glDeleteLists(mChipDisplayLists[c][pl][b],1); } } } } void ChipDrawer::InitializeAfterTexturesAreCreated() { for(int c=0;c<CH_NUMBER;c++){ for(int pl=0;pl<MAX_PLAYERS;pl++){ for(int b=0;b<2;b++){ mChipDisplayLists[c][pl][b]=glGenLists(1); glNewList(mChipDisplayLists[c][pl][b], GL_COMPILE); RenderChip((ChipType)c,pl,(bool)b); glEndList(); } } } } void ChipDrawer::DrawChip(const ChipModel c, bool topless) const{ DrawChip(c.GetChipType(),c.GetPlayerID(),topless); } void ChipDrawer::DrawChip(ChipType c, int playerID, bool topless) const{ dbop(" -- Calling list "+TO_STR(c)+" "+TO_STR(playerID)+" "+TO_STR(topless)); glCallList(mChipDisplayLists[c][playerID][topless]); } void ChipDrawer::RenderChip(ChipType c, int playerID, bool topless) const{ if (c == CH_100 || c == CH_1000) { float sizeX; float sizeY; if (c == CH_100) { sizeX = BP_100_CHIP_SIZE_X; sizeY = BP_100_CHIP_SIZE_Y; } else { sizeX = BP_1000_CHIP_SIZE_X; sizeY = BP_1000_CHIP_SIZE_Y; } float perimeter = sizeX*2+sizeY*2; glPushMatrix(); GLuint chipTexture = TextureManager::Instance(). GetTexture(GetChipTexEnum(c, playerID))->GetName(); GLuint chipSideTexture = TextureManager::Instance(). GetTexture(GetChipSideTexEnum(c, playerID))->GetName(); glBindTexture(GL_TEXTURE_2D, chipTexture); glRotatef(180.0*(playerID/2), 0.0, 0.0, 1.0); glTranslatef(0.0f,0.0f,mHeight); //if(!topless){ // Draw top glBegin(GL_QUADS); glNormal3f(0.0f, 0.0f, 1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-sizeX/2.0, -sizeY/2.0, 0.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f( sizeX/2.0, -sizeY/2.0, 0.0f); glTexCoord2f(1.0f,1.0f); glVertex3f( sizeX/2.0, sizeY/2.0, 0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-sizeX/2.0, sizeY/2.0, 0.0f); glEnd(); //} glTranslatef(0.0f,0.0f, -mHeight); glBindTexture(GL_TEXTURE_2D, chipSideTexture); //glBindTexture(GL_TEXTURE_2D, 0); // Draw left side glBegin(GL_QUADS); glNormal3f(0.0f, -1.0f, 0.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-sizeX/2.0, sizeY/2.0, 0.0f); glTexCoord2f(sizeY/perimeter, 0.0f); glVertex3f(-sizeX/2.0, -sizeY/2.0, 0.0f); glTexCoord2f(sizeY/perimeter,1.0f); glVertex3f(-sizeX/2.0, -sizeY/2.0, mHeight); glTexCoord2f(0.0f, 1.0f); glVertex3f(-sizeX/2.0, sizeY/2.0, mHeight); glEnd(); // Draw bottom side glBegin(GL_QUADS); glNormal3f(0.0f, -1.0f, 0.0f); glTexCoord2f(sizeY/perimeter, 0.0f); glVertex3f(sizeX/2.0, -sizeY/2.0, 0.0f); glTexCoord2f((sizeY+sizeX)/perimeter, 0.0f); glVertex3f(-sizeX/2.0, -sizeY/2.0, 0.0f); glTexCoord2f((sizeY+sizeX)/perimeter,1.0f); glVertex3f(-sizeX/2.0, -sizeY/2.0, mHeight); glTexCoord2f(sizeY/perimeter, 1.0f); glVertex3f(sizeX/2.0, -sizeY/2.0, mHeight); glEnd(); // Draw right side glBegin(GL_QUADS); glNormal3f(1.0f, 0.0f, 0.0f); glTexCoord2f((sizeY+sizeX)/perimeter, 0.0f); glVertex3f(sizeX/2.0, -sizeY/2.0, 0.0f); glTexCoord2f((sizeY+sizeX+sizeY)/perimeter, 0.0f); glVertex3f(sizeX/2.0, sizeY/2.0, 0.0f); glTexCoord2f((sizeY+sizeX+sizeY)/perimeter,1.0f); glVertex3f(sizeX/2.0, sizeY/2.0, mHeight); glTexCoord2f((sizeY+sizeX)/perimeter, 1.0f); glVertex3f(sizeX/2.0, -sizeY/2.0, mHeight); glEnd(); // Draw top side glBegin(GL_QUADS); glNormal3f(0.0f, 1.0f, 0.0f); glTexCoord2f((sizeY+sizeX+sizeY)/perimeter, 0.0f); glVertex3f(sizeX/2.0, sizeY/2.0, 0.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(-sizeX/2.0, sizeY/2.0, 0.0f); glTexCoord2f(1.0f,1.0f); glVertex3f(-sizeX/2.0, sizeY/2.0, mHeight); glTexCoord2f((sizeY+sizeX+sizeY)/perimeter, 1.0f); glVertex3f(sizeX/2.0, sizeY/2.0, mHeight); glEnd(); //glColor3dv(PL2COLOR[playerID][1]); // Fulhack: Added 0.5 to height to avoid a strange // transparent effect glPopMatrix(); } else { glPushMatrix(); //GLint currentBoundTexture; //glGetIntegerv(GL_TEXTURE_BINDING_2D, &currentBoundTexture); GLuint chipTexture = TextureManager::Instance(). GetTexture(GetChipTexEnum(c, playerID))->GetName(); GLuint chipSideTexture = TextureManager::Instance(). GetTexture(GetChipSideTexEnum(c, playerID))->GetName(); //if(chipTexture!=(GLuint)currentBoundTexture){ glBindTexture(GL_TEXTURE_2D, chipTexture); //} glRotatef(-45+90.0*playerID, 0.0, 0.0, 1.0); glTranslatef(0.0f,0.0f,mHeight); if(!topless){ // Draw top gluDisk(mDiskQuadric,0.0f,mRadius,SBL_SLICES,SBL_LOOPS); } glTranslatef(0.0f,0.0f, -mHeight); /* if(!topless){ gluQuadricOrientation(mDiskQuadric, GLU_INSIDE); gluDisk(mDiskQuadric,0.0f,mRadius,SBL_SLICES,SBL_LOOPS); gluQuadricOrientation(mDiskQuadric, GLU_OUTSIDE); } */ glBindTexture(GL_TEXTURE_2D, chipSideTexture); //glColor3dv(PL2COLOR[playerID][1]); // Fulhack: Added 0.5 to height to avoid a strange // transparent effect gluCylinder(mCylinderQuadric, mRadius, mRadius, mHeight+0.5 , SBL_SLICES, SBL_STACKS ); glPopMatrix(); } } double ChipDrawer::GetHeight() const {return mHeight;} double ChipDrawer::GetRadius() const {return mRadius;} void ChipDrawer::SetHeight(double height){mHeight=height;} void ChipDrawer::SetRadius(double radius){mRadius=radius;} } What crashes is PileView::InternalDraw(bool mClickableObjectsOnly) when it calls glCallDisplayList(mDisplayList). The display list is 111 and was deleted and recreated 3 frames before the crash. What on earth could possibly cause a compiled display list to crash? I don't get it =/ Thanks for your time.
  6. When I call my displaylist, it crashes =( I generate it with GL_COMPILE and then display it later (some displaylist might not always be displayed). My question is: What could possibly be crash (seg.fault) inside a compile list which compiled ok?
  7. Transparent textures

    Lighting is enabled, thanks a billion!! And the first hour we tested different setups, we had also forgot to enable GL_BLEND =/ Thanks a lot.. I'll re-post if it doesn't work
  8. I have a texture with alpha value 1.0 everywhere. I want to render this texture transparent with a given alpha value. How do I do it? I've tried with: GLfloat alpha = 0.5; GLfloat color[4] = {1,1,1,alpha}; glTexEnvfv(GL_TEXTURE_ENV,GL_TEXTURE_ENV_COLOR, color); glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE, GL_BLEND); glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE); // draw the texture and lots of other different setup but nothing works =( The GL reference is really cryptical... Thanks in advance
  9. We have a model coordinate system which is 1366x768 at z=0 with a camera angle of 40 degrees. Not a ortoghonal projection that is. This is then rendered to 1024x768 pixels (We have a plasma-screen with non-square pixels). All the textures are drawn as if they were supposed to be shown in 1366x768 so that things look properly when we work with them. We've tried experimenting with different mipmapping and mag-filtersw but it doesn't solve the problem. =(
  10. OK, I have the code at work and I'll post it here tomorrow. I have mipmapping enabled, linear_nearest I think, and a linear magfilter. I'll look in to changing mipmapping function tomorrow thouch I think we might already have done it. Thanks...
  11. The text "Purple" is supposed to look exactly as the text "Player". There is no purple color anywhere :) When you cut and paste the "Purple" texture onto the "Player" texture (which has green background) in Photoshop, everything looks good. When I do it in OpenGL, it looks horrible. Please, please, please help. It is very important for out project and we've got a really tight dead-line. Thanks in advance!
  12. I have lots of pre-antialiased text which is generated in Photoshop, saved as png with a transparent background and then drawn, as textures on top of other textures. Blending is enabled with glBlendFunc(GL_SRC_ALPHA, GL_SRC_ONE_MINUS_ALPHA) The text "Purple" is supposed to look exactly as the text "Player". Purple is it's own textures which is blitted on to a green texture with the word Player already written on it. This is the result: http://design200.id.gu.se/~oscar/example.jpg What could possibly be wrong? How come Photoshop can load this texture as a layer and merge it down properly onto another layer while OpenGL screws everything up? Very grateful for replies.... [Edited by - thorpe on September 12, 2004 4:50:04 PM]
  13. Is it easy to import maya-models (in whatever format is the easiest) into OpenGL? Which format is easiest btw? :) I'm deciding whether I should import a fairly simple model in OpenGL or try to code it in.
  14. Multisampling artifact

    It could have something to do with z-fighting. I figure that Radeons hardware probably uses 32-bit zbuffer, but I can only initialize my screen with a depth buffer bit of 24. Could this cause the problem? Also, my GL server is SGI 1.2 while my GL client is FireGL 1.3. Is this really healthy? Thanks a lot for any response!
  15. Multisampling artifact

    Sample image available at: http://onsight.id.gu.se/opengl/artifact.bmp Look closely at the lower left corner of the red polygon and you will be able to see a few dots. This is absolutely insane. Radeons hardware antialiasing can't possibly be supposed to behave like this.
  • Advertisement