shawk08033

Members
  • Content count

    17
  • Joined

  • Last visited

Community Reputation

96 Neutral

About shawk08033

  • Rank
    Member
  1. Opengl qt

    I am trying to display a 64x64 in opengl. The texture loads but I cant get it to display in a square and on the top left corner of the screen. Heres my code for the GLWidget in qt  #include "glwidget.h" GLWidget::GLWidget(QWidget *parent) : QGLWidget(parent) { } void GLWidget::initializeGL(){ glClearColor(1, 1, 1 , 0); gluPerspective(45, 640/480, 1, 500); glEnable(GL_MULTISAMPLE); glEnable(GL_AMD_performance_monitor); glEnable(GL_TEXTURE_2D); GLWidget::loadTexture2(":/images/Block.bmp", GLWidget::backgroundimage); } void GLWidget::paintGL(){ glClearColor(0.4f, 0.1f, 0.1f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glBindTexture(GL_TEXTURE_2D, backgroundimage); glBegin(GL_QUADS); glTexCoord2f(0,1); glVertex2f(0, 0); glTexCoord2f(0,0); glVertex2f(0, 64); glTexCoord2f(1,0); glVertex2f(64, 0); glTexCoord2f(1,1); glVertex2f(64, 64); glEnd(); glFlush(); } void GLWidget::resizeGL(int w, int h){ } QImage GLWidget::loadTexture2(char *filename, GLuint &textureID){ glEnable(GL_TEXTURE_2D); // Enable texturing glGenTextures(1, &textureID); // Obtain an id for the texture glBindTexture(GL_TEXTURE_2D, textureID); // Set as the current texture glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); QImage im(filename); QImage tex = QGLWidget::convertToGLFormat(im); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex.width(), tex.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, tex.bits()); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glDisable(GL_TEXTURE_2D); return tex; }
  2. Read text as a map in c++

    So the output it gives me when I do that is: Sprites are loaded 1Currently in 0 is 0,0 0Currently in 0 is 128,0 0Currently in 1 is 64,0 0Currently in 0 is 192,0 0Currently in 1 is 64,0 0Currently in 2 is 192,0 1Currently in 0 is 192,0 1Currently in 1 is 256,0 1Currently in 2 is 192,0 1Currently in 3 is 192,0 1Currently in 0 is 192,0 1Currently in 1 is 0,64 1Currently in 2 is 192,0 1Currently in 3 is 192,0 1Currently in 4 is 0,64 0Currently in 0 is 64,64 0Currently in 1 is 0,64 0Currently in 2 is 64,64 0Currently in 3 is 64,64 0Currently in 4 is 0,64 0Currently in 5 is 0,64 0Currently in 0 is 128,64 0Currently in 1 is 0,64 0Currently in 2 is 128,64 0Currently in 3 is 128,64 0Currently in 4 is 0,64 0Currently in 5 is 0,64 0Currently in 6 is 128,64 0Currently in 0 is 192,64 0Currently in 1 is 0,64 0Currently in 2 is 192,64 0Currently in 3 is 192,64 0Currently in 4 is 0,64 0Currently in 5 is 0,64 0Currently in 6 is 192,64 0Currently in 7 is 192,64 1Currently in 0 is 192,64 1Currently in 1 is 256,64 1Currently in 2 is 192,64 1Currently in 3 is 192,64 1Currently in 4 is 256,64 1Currently in 5 is 256,64 1Currently in 6 is 192,64 1Currently in 7 is 192,64 1Currently in 8 is 192,64 1Currently in 0 is 192,64 1Currently in 1 is 0,128 1Currently in 2 is 192,64 1Currently in 3 is 192,64 1Currently in 4 is 0,128 1Currently in 5 is 0,128 1Currently in 6 is 192,64 1Currently in 7 is 192,64 1Currently in 8 is 192,64 1Currently in 9 is 0,128 1Currently in 0 is 192,64 1Currently in 1 is 64,128 1Currently in 2 is 192,64 1Currently in 3 is 192,64 1Currently in 4 is 64,128 1Currently in 5 is 64,128 1Currently in 6 is 192,64 1Currently in 7 is 192,64 1Currently in 8 is 192,64 1Currently in 9 is 64,128 1Currently in 10 is 64,128 1Currently in 0 is 192,64 1Currently in 1 is 128,128 1Currently in 2 is 192,64 1Currently in 3 is 192,64 1Currently in 4 is 128,128 1Currently in 5 is 128,128 1Currently in 6 is 192,64 1Currently in 7 is 192,64 1Currently in 8 is 192,64 1Currently in 9 is 128,128 1Currently in 10 is 128,128 1Currently in 11 is 128,128 1Currently in 0 is 192,64 1Currently in 1 is 192,128 1Currently in 2 is 192,64 1Currently in 3 is 192,64 1Currently in 4 is 192,128 1Currently in 5 is 192,128 1Currently in 6 is 192,64 1Currently in 7 is 192,64 1Currently in 8 is 192,64 1Currently in 9 is 192,128 1Currently in 10 is 192,128 1Currently in 11 is 192,128 1Currently in 12 is 192,128 1Currently in 0 is 192,64 1Currently in 1 is 256,128 1Currently in 2 is 192,64 1Currently in 3 is 192,64 1Currently in 4 is 256,128 1Currently in 5 is 256,128 1Currently in 6 is 192,64 1Currently in 7 is 192,64 1Currently in 8 is 192,64 1Currently in 9 is 256,128 1Currently in 10 is 256,128 1Currently in 11 is 256,128 1Currently in 12 is 256,128 1Currently in 13 is 256,128 0Currently in 0 is 0,192 0Currently in 1 is 256,128 0Currently in 2 is 0,192 0Currently in 3 is 0,192 0Currently in 4 is 256,128 0Currently in 5 is 256,128 0Currently in 6 is 0,192 0Currently in 7 is 0,192 0Currently in 8 is 0,192 0Currently in 9 is 256,128 0Currently in 10 is 256,128 0Currently in 11 is 256,128 0Currently in 12 is 256,128 0Currently in 13 is 256,128 0Currently in 14 is 256,128 0Currently in 0 is 64,192 0Currently in 1 is 256,128 0Currently in 2 is 64,192 0Currently in 3 is 64,192 0Currently in 4 is 256,128 0Currently in 5 is 256,128 0Currently in 6 is 64,192 0Currently in 7 is 64,192 0Currently in 8 is 64,192 0Currently in 9 is 256,128 0Currently in 10 is 256,128 0Currently in 11 is 256,128 0Currently in 12 is 256,128 0Currently in 13 is 256,128 0Currently in 14 is 256,128 0Currently in 15 is 64,192 0Currently in 0 is 128,192 0Currently in 1 is 256,128 0Currently in 2 is 128,192 0Currently in 3 is 128,192 0Currently in 4 is 256,128 0Currently in 5 is 256,128 0Currently in 6 is 128,192 0Currently in 7 is 128,192 0Currently in 8 is 128,192 0Currently in 9 is 256,128 0Currently in 10 is 256,128 0Currently in 11 is 256,128 0Currently in 12 is 256,128 0Currently in 13 is 256,128 0Currently in 14 is 256,128 0Currently in 15 is 128,192 0Currently in 16 is 128,192 0Currently in 0 is 192,192 0Currently in 1 is 256,128 0Currently in 2 is 192,192 0Currently in 3 is 192,192 0Currently in 4 is 256,128 0Currently in 5 is 256,128 0Currently in 6 is 192,192 0Currently in 7 is 192,192 0Currently in 8 is 192,192 0Currently in 9 is 256,128 0Currently in 10 is 256,128 0Currently in 11 is 256,128 0Currently in 12 is 256,128 0Currently in 13 is 256,128 0Currently in 14 is 256,128 0Currently in 15 is 192,192 0Currently in 16 is 192,192 0Currently in 17 is 192,192 0Currently in 0 is 256,192 0Currently in 1 is 256,128 0Currently in 2 is 256,192 0Currently in 3 is 256,192 0Currently in 4 is 256,128 0Currently in 5 is 256,128 0Currently in 6 is 256,192 0Currently in 7 is 256,192 0Currently in 8 is 256,192 0Currently in 9 is 256,128 0Currently in 10 is 256,128 0Currently in 11 is 256,128 0Currently in 12 is 256,128 0Currently in 13 is 256,128 0Currently in 14 is 256,128 0Currently in 15 is 256,192 0Currently in 16 is 256,192 0Currently in 17 is 256,192 0Currently in 18 is 256,192 what does this mean?
  3. Hi I have a class call map.  #include "Map.h" #include <fstream> #include <ostream> #include <istream> Log spritelog("spritedebug.txt", false); Map::Map() { Load(); spritelog << "Sprites are loaded" << std::endl; } void Map::Load() { ifstream resources("resources.txt"); std::string str; int i = 0; while (std::getline(resources, str)) { UsedSprites[i] = new Sprite(0, 0, str); i++; } resources.close(); delete resources; str = ""; ifstream maptext("map.txt"); i = 0; int y = 0; int x = 0; while(std::getline(maptext, str)) { stringstream stream(str); string c = ""; while(std::getline(stream,c, ',')) { int n = atoi(c.c_str()); MapSprite[x] = UsedSprites[n]; MapSprite[x]->X = i*64; MapSprite[x]->Y = y*64; spritelog << n << "Loading into " << x << " at " << i*64 << "," << y*64 << std::endl; i++; x++; } y++; i = 0; } maptext.close(); spritelog << "Loading " << x << " Sprites Into Map at " << y << " lines" << std::endl; delete UsedSprites; delete maptext; } void Map::Render() { for(int i = 0; i < 34; i++) { MapSprite[i]->Render(); spritelog << "Rended: " << i << "X: " << MapSprite[i]->X << " Y: " << MapSprite[i]->Y << std::endl; } } When I load this text file: 0,1,0,0,1 1,0,0,0,1 1,1,1,1,1 0,0,0,0,0 1,1,1,1,1 1,0,0,0,1 1,1,1,1,1   0 = green 1= grey   See attachments for debug info and screen shot.[attachment=19569:helpc++.PNG][attachment=19570:spritedebug.txt]   When is the x and y not the same as what I set it in Load() to what it renders at.
  4. I have been told about how hard mmo are but right I am just trying to make a demo because I have a friend who owns a marketing firm whos interested in the game. Right now i am just creating simple code structure so I can show off the concept.  
  5. I don't consider myself a beginner, I have over 3 years of c++, c# and game programming behind me but I have not programmed a game with optimized graphics.
  6. Is Direct x portable to mac??
  7. I currently starting to make a mmorpg in c++ using opengl. How could I optimized it to run the best it can on integrated graphics but also take full advantage of top of line graphics card like a GTX 660 or higher.Would it been done directly in the way I code opengl or would it been done by changing the quality of the texture images?? 
  8. Representing player classes in c++

    I have a player class like in c++ class i need a player class like witch or warrior [source lang="cpp"]#ifndef PLAYER_H #define PLAYER_H #include "gameobject.h" #include "gameobject_component.h" #include <QString> class Player : public GameObject { public: Player(QString name, int maxlevel, PlayerClass classtype); Player(QString name, int level, int xp, int maxlevel, PlayerClass classtype); void Update(); void Checklevel(); void Attack(); virtual ~Player(); bool isactive; int Level; int Maxlevel; int Xp; float Money; QString Name; float Mana; float Maxmana; float Health; float Maxhealth; float Speed; float Strenght; float Intelect; float Hitrate; GameObject backpack[30]; GameObject_Component Componets[100]; protected: private: }; #endif // PLAYER_H [/source]
  9. What is the best way to represent player classes for an rpg game in c++
  10. Rendering Engine For QT

    Is there any open source cross platform rendering/graphics engine for qt
  11. Rendering Engine For QT

    Is there any open source cross platform 3d rendering/graphics for qt.
  12. Qt C++ MMORPG

    Its a 3d game so i want to use opengl
  13. Qt C++ MMORPG

    I want to use qt because of it network classes and its portability.
  14. Qt C++ MMORPG

    I'm a very good programmer and have programmed many other games including android and xna game so I'm not worried that my project to big i just need to how to get started.
  15. Qt C++ MMORPG

    I am starting making a mmorpg game using qt and c++ does if anyone can point my in the right direction such as books, tutorials, website anything to help me get started.