• Advertisement

Zeophlite

Member
  • Content count

    135
  • Joined

  • Last visited

Community Reputation

144 Neutral

About Zeophlite

  • Rank
    Member
  1. Help with Platforming game?

    I'd recommend this [url="http://wiki.allegro.cc/index.php?title=Pixelate:Issue_13/jnrdev"]http://wiki.allegro.cc/index.php?title=Pixelate:Issue_13/jnrdev[/url]
  2. I can get Immediate Mode & Vertex Arrays to work, but not VBOs. #include <stdlib.h> #define GLEW_STATIC #include <GL/glew.h> #include <stdio.h> #include "sdl.h" const int NODRAW = 0; const int IMMEDIATE = 1; const int VERTEX_ARRAY = 2; const int VBO = 3; extern int method; extern int print, delay; GLfloat vertices[] = { -0.2f, -0.2f, 0.0f, -0.2f, 0.2f, 0.0f, 0.2f, 0.2f, 0.0f, 0.2f, -0.2f, 0.0f }; GLfloat colors[] = { 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f }; int numverts = sizeof(vertices) / (3*sizeof(GLfloat)); GLuint vboId = 0; static int make_resources(void) { /* glGenBuffers(1, &vboId); glBindBuffer(GL_ARRAY_BUFFER, vboId); glBufferData(GL_ARRAY_BUFFER, sizeof(vertices) + sizeof(colors), NULL, GL_STATIC_DRAW); glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices); glBufferSubData(GL_ARRAY_BUFFER, sizeof(vertices), sizeof(colors), colors); */ return 1; } static int clean_resources(void) { // glDeleteBuffers(1, &vboId); } static void render(void) { glClearColor(1.0f, 1.0f, 1.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); if (method == IMMEDIATE) { glBegin(GL_POLYGON); int i; for(i = 0; i < numverts; i++) { glColor3fv(&colors[i*3]); glVertex3fv(&vertices[i*3]); } glEnd(); } else if (method == VERTEX_ARRAY) { glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_COLOR_ARRAY); glVertexPointer(3, GL_FLOAT, 0, vertices); glColorPointer(3, GL_FLOAT, 0, colors); glDrawArrays(GL_POLYGON, 0, numverts); glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_VERTEX_ARRAY); } else if (method == VBO) { // glBindBuffer(GL_ARRAY_BUFFER, vboId); // glEnableClientState(GL_VERTEX_ARRAY); // glEnableClientState(GL_COLOR_ARRAY); // glVertexPointer(3, GL_FLOAT, 0, 0); // glColorPointer(3, GL_FLOAT, 0, (GLvoid*)(numverts * 3 * sizeof(GLfloat))); // glDrawArrays(GL_LINE_LOOP, 0, numverts); // glDisableClientState(GL_COLOR_ARRAY); // glDisableClientState(GL_VERTEX_ARRAY); // glBindBuffer(GL_ARRAY_BUFFER, 0); } SDL_GL_SwapBuffers(); } extern int done; int main(int argc, char** argv) { initSDL(); glewInit(); if (!glewIsSupported("GL_VERSION_2_0")) { fprintf(stderr, "OpenGL 2.0 not available\n"); return 1; } if (!make_resources()) { fprintf(stderr, "Failed to load resources\n"); return 1; } while (!done) { handleInput(); render(); } clean_resources(); SDL_Quit(); return 0; } I won't bother you with initSDL() or handleInput(), but they are both in a seperate file, sdl.c, along with some ints & have a header, sdl.h. (I realise that that's a bad name, could interfer with SDL.h!) I'm linking with: glew32.lib libopengl32.a libglu32.a libmingw32.a libSDLmain.a libSDL.dll.a Now If I uncomment the code in render(), make_resources() & clean_resources(), I get these errors: build/main.o: In function `make_resources': src/main.c:35: undefined reference to `__glewGenBuffers' src/main.c:36: undefined reference to `__glewBindBuffer' src/main.c:37: undefined reference to `__glewBufferData' src/main.c:39: undefined reference to `__glewBufferSubData' src/main.c:40: undefined reference to `__glewBufferSubData' build/main.o: In function `clean_resources': src/main.c:49: undefined reference to `__glewDeleteBuffers' build/main.o: In function `render': src/main.c:86: undefined reference to `__glewBindBuffer' src/main.c:99: undefined reference to `__glewBindBuffer' So what do I have to do to get glew to fix it? Cheers
  3. Seamless hexagon textures

    So I'm making a game with a regular hexagon map. Now the difficulty is in creating seamless tiles. With square tiles, I can make the tile in Photoshop, then use Offset to correct the edges, but I can't do the same with hexagons. I was wondering what method you guys use to make hexagon tiles? Cheers
  4. Source Code Control

    GIT: http://git-scm.com/ Its distributed (so you don't have to worry about not having an internet connection to some server)
  5. How to statically link GLEW using MinGW?

    The above works for NetBeans, using MinGW. Someone else with more experience on Code:Blocks will have to help you out.
  6. How to statically link GLEW using MinGW?

    Something like this: [SOURCE] #include <stdlib.h> #define GLEW_STATIC #include <GL/glew.h> int main(int argc, char** argv) { glewInit(); if (!glewIsSupported("GL_VERSION_2_0")) { fprintf(stderr, "OpenGL 2.0 not available\n"); return 1; } return 0; } [/SOURCE] Link to glew32s.lib then libopengl32.a
  7. Planning to Write an AI Article But-

    Don't be discouraged, Its hard to garner support before you've written anything. My suggestion is to write a short article (part 1), and see how people respond to it. They can give you writing advice that can improve your further work. What you've written so far sounds impressive, I'd like to see how it's implemented.
  8. Planning to Write an AI Article But-

    I'd like to put my thumbs up. Look forward to reading it.
  9. Okay so the below code compiles nicely, but when I uncomment the first line, then it doesn't. I'm using glut-3.7.6-bin.zip from http://www.xmission.com/~nate/glut.html and glew-1.5.5-win32.zip (Windows 32-bit) from http://glew.sourceforge.net/ and for my C toolchain, I'm using TDM-GCC (http://tdm-gcc.tdragon.net/), with Netbeans. All the linker commands are in the 2nd and 3rd listings below I've tried similar toolkits (SDL, freeglut, glfw) and they all work with and without glew. So I want to know why glut doesn't work with glew. //#include <GL/glew.h> #include <GL/gl.h> #include <GL/glu.h> #define GLUT_DISABLE_ATEXIT_HACK #include "glut.h" #include <stdio.h> #include <unistd.h> #define ESCAPE 27 int window; float angle = 0.0f; void render() { angle += 0.05f; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glTranslatef(-1.5f, 0.0f, -6.0f); glBegin(GL_TRIANGLES); glColor3f(1.0f, 0.0f, 0.0f); glVertex3f(0.0f, 1.0f, 0.0f); glColor3f(0.0f, 1.0f, 0.0f); glVertex3f(1.0f, -1.0f, 0.0f); glColor3f(0.0f, 0.0f, 1.0f); glVertex3f(-1.0f, -1.0f, 0.0f); glEnd(); glTranslatef(3.0f, 0.0f, 0.0f); glRotatef(angle,0.0f,0.0f,1.0f); glColor3f(0.5f, 0.5f, 1.0f); glBegin(GL_QUADS); glVertex3f(-1.0f, 1.0f, 0.0f); glVertex3f(1.0f, 1.0f, 0.0f); glVertex3f(1.0f, -1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 0.0f); glEnd(); } void InitGL(int Width, int Height) { glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClearDepth(1.0); glDepthFunc(GL_LESS); glEnable(GL_DEPTH_TEST); glShadeModel(GL_SMOOTH); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f, (GLfloat) Width / (GLfloat) Height, 0.1f, 100.0f); glMatrixMode(GL_MODELVIEW); } void ReSizeGLScene(int Width, int Height) { if (Height == 0) Height = 1; glViewport(0, 0, Width, Height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f, (GLfloat) Width / (GLfloat) Height, 0.1f, 100.0f); glMatrixMode(GL_MODELVIEW); } void DrawGLScene() { render(); glutSwapBuffers(); } void keyPressed(unsigned char key, int x, int y) { usleep(100); if (key == ESCAPE) { glutDestroyWindow(window); exit(0); } } int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH); glutInitWindowSize(640, 480); glutInitWindowPosition(0, 0); window = glutCreateWindow("Jeff Molofee's GL Code Tutorial ... NeHe '99"); /* GLenum err = glewInit(); if (GLEW_OK != err) { fprintf(stderr, "Error: %s\n", glewGetErrorString(err)); } fprintf(stdout, "Status: Using GLEW %s\n", glewGetString(GLEW_VERSION)); if (glewIsSupported("GL_VERSION_1_4 GL_ARB_point_sprite")) { fprintf(stderr, "Safe to use GL1.4 & Point Sprites\n"); } else { fprintf(stderr, "Not safe to use GL1.4 & Point Sprites\n"); }*/ glutDisplayFunc(&DrawGLScene); glutFullScreen(); glutIdleFunc(&DrawGLScene); glutReshapeFunc(&ReSizeGLScene); glutKeyboardFunc(&keyPressed); InitGL(640, 480); glutMainLoop(); return 1; } This is my output normally. "/usr/bin/make" -f nbproject/Makefile-GLUT.mk QMAKE= SUBPROJECTS= .clean-conf make[1]: Entering directory `/c/Users/Daniel/Documents/NetBeansProjects/OpenGL' rm -f -r build/GLUT rm -f dist/GLUT/MinGW_TDM-Windows/opengl.exe make[1]: Leaving directory `/c/Users/Daniel/Documents/NetBeansProjects/OpenGL' CLEAN SUCCESSFUL (total time: 1s) "/usr/bin/make" -f nbproject/Makefile-GLUT.mk QMAKE= SUBPROJECTS= .build-conf make[1]: Entering directory `/c/Users/Daniel/Documents/NetBeansProjects/OpenGL' "/usr/bin/make" -f nbproject/Makefile-GLUT.mk dist/GLUT/MinGW_TDM-Windows/opengl.exe make[2]: Entering directory `/c/Users/Daniel/Documents/NetBeansProjects/OpenGL' mkdir -p build/GLUT/MinGW_TDM-Windows/_ext/360110485 rm -f build/GLUT/MinGW_TDM-Windows/_ext/360110485/glut.o.d gcc -c -g -I/C/Users/Daniel/Downloads/glut-3.7.6-bin -I/C/Users/Daniel/Downloads/glew-1.5.5/include -MMD -MP -MF build/GLUT/MinGW_TDM-Windows/_ext/360110485/glut.o.d -o build/GLUT/MinGW_TDM-Windows/_ext/360110485/glut.o /C/Users/Daniel/Documents/NetBeansProjects/OpenGL/src/glut.c mkdir -p build/GLUT/MinGW_TDM-Windows/_ext/360110485 rm -f build/GLUT/MinGW_TDM-Windows/_ext/360110485/common.o.d gcc -c -g -I/C/Users/Daniel/Downloads/glut-3.7.6-bin -I/C/Users/Daniel/Downloads/glew-1.5.5/include -MMD -MP -MF build/GLUT/MinGW_TDM-Windows/_ext/360110485/common.o.d -o build/GLUT/MinGW_TDM-Windows/_ext/360110485/common.o /C/Users/Daniel/Documents/NetBeansProjects/OpenGL/src/common.c mkdir -p dist/GLUT/MinGW_TDM-Windows gcc -o dist/GLUT/MinGW_TDM-Windows/opengl build/GLUT/MinGW_TDM-Windows/_ext/360110485/glut.o build/GLUT/MinGW_TDM-Windows/_ext/360110485/common.o /C/Users/Daniel/Downloads/glut-3.7.6-bin/glut32.lib /C/TDM-GCC/lib/libopengl32.a /C/TDM-GCC/lib/libglu32.a make[2]: Leaving directory `/c/Users/Daniel/Documents/NetBeansProjects/OpenGL' make[1]: Leaving directory `/c/Users/Daniel/Documents/NetBeansProjects/OpenGL' BUILD SUCCESSFUL (total time: 2s) And then when I remove the first // from my code above (so it includes glew) "/usr/bin/make" -f nbproject/Makefile-GLUT.mk QMAKE= SUBPROJECTS= .clean-conf make[1]: Entering directory `/c/Users/Daniel/Documents/NetBeansProjects/OpenGL' rm -f -r build/GLUT rm -f dist/GLUT/MinGW_TDM-Windows/opengl.exe make[1]: Leaving directory `/c/Users/Daniel/Documents/NetBeansProjects/OpenGL' CLEAN SUCCESSFUL (total time: 1s) "/usr/bin/make" -f nbproject/Makefile-GLUT.mk QMAKE= SUBPROJECTS= .build-conf make[1]: Entering directory `/c/Users/Daniel/Documents/NetBeansProjects/OpenGL' "/usr/bin/make" -f nbproject/Makefile-GLUT.mk dist/GLUT/MinGW_TDM-Windows/opengl.exe make[2]: Entering directory `/c/Users/Daniel/Documents/NetBeansProjects/OpenGL' mkdir -p build/GLUT/MinGW_TDM-Windows/_ext/360110485 rm -f build/GLUT/MinGW_TDM-Windows/_ext/360110485/glut.o.d gcc -c -g -I/C/Users/Daniel/Downloads/glut-3.7.6-bin -I/C/Users/Daniel/Downloads/glew-1.5.5/include -MMD -MP -MF build/GLUT/MinGW_TDM-Windows/_ext/360110485/glut.o.d -o build/GLUT/MinGW_TDM-Windows/_ext/360110485/glut.o /C/Users/Daniel/Documents/NetBeansProjects/OpenGL/src/glut.c mkdir -p build/GLUT/MinGW_TDM-Windows/_ext/360110485 rm -f build/GLUT/MinGW_TDM-Windows/_ext/360110485/common.o.d gcc -c -g -I/C/Users/Daniel/Downloads/glut-3.7.6-bin -I/C/Users/Daniel/Downloads/glew-1.5.5/include -MMD -MP -MF build/GLUT/MinGW_TDM-Windows/_ext/360110485/common.o.d -o build/GLUT/MinGW_TDM-Windows/_ext/360110485/common.o /C/Users/Daniel/Documents/NetBeansProjects/OpenGL/src/common.c mkdir -p dist/GLUT/MinGW_TDM-Windows gcc -o dist/GLUT/MinGW_TDM-Windows/opengl build/GLUT/MinGW_TDM-Windows/_ext/360110485/glut.o build/GLUT/MinGW_TDM-Windows/_ext/360110485/common.o /C/Users/Daniel/Downloads/glut-3.7.6-bin/glut32.lib /C/TDM-GCC/lib/libopengl32.a /C/TDM-GCC/lib/libglu32.a build/GLUT/MinGW_TDM-Windows/_ext/360110485/glut.o: In function `DrawGLScene': c:/Users/Daniel/Documents/NetBeansProjects/OpenGL/src/glut.c:44: undefined reference to `glutSwapBuffers' build/GLUT/MinGW_TDM-Windows/_ext/360110485/glut.o: In function `keyPressed': c:/Users/Daniel/Documents/NetBeansProjects/OpenGL/src/glut.c:51: undefined reference to `glutDestroyWindow' build/GLUT/MinGW_TDM-Windows/_ext/360110485/glut.o: In function `main': c:/Users/Daniel/Documents/NetBeansProjects/OpenGL/src/glut.c:58: undefined reference to `glutInit' c:/Users/Daniel/Documents/NetBeansProjects/OpenGL/src/glut.c:59: undefined reference to `glutInitDisplayMode' c:/Users/Daniel/Documents/NetBeansProjects/OpenGL/src/glut.c:60: undefined reference to `glutInitWindowSize' c:/Users/Daniel/Documents/NetBeansProjects/OpenGL/src/glut.c:61: undefined reference to `glutInitWindowPosition' c:/Users/Daniel/Documents/NetBeansProjects/OpenGL/src/glut.c:62: undefined reference to `glutCreateWindow' c:/Users/Daniel/Documents/NetBeansProjects/OpenGL/src/glut.c:76: undefined reference to `glutDisplayFunc' c:/Users/Daniel/Documents/NetBeansProjects/OpenGL/src/glut.c:77: undefined reference to `glutFullScreen' c:/Users/Daniel/Documents/NetBeansProjects/OpenGL/src/glut.c:78: undefined reference to `glutIdleFunc' c:/Users/Daniel/Documents/NetBeansProjects/OpenGL/src/glut.c:79: undefined reference to `glutReshapeFunc' c:/Users/Daniel/Documents/NetBeansProjects/OpenGL/src/glut.c:80: undefined reference to `glutKeyboardFunc' c:/Users/Daniel/Documents/NetBeansProjects/OpenGL/src/glut.c:82: undefined reference to `glutMainLoopmake[2]: Leaving directory `/c/Users/Daniel/Documents/NetBeansProjects/OpenGL' make[1]: Leaving directory `/c/Users/Daniel/Documents/NetBeansProjects/OpenGL' ' collect2: ld returned 1 exit status make[2]: *** [dist/GLUT/MinGW_TDM-Windows/opengl.exe] Error 1 make[1]: *** [.build-conf] Error 2 make: *** [.build-impl] Error 2 BUILD FAILED (exit value 2, total time: 2s)
  10. C++ for game development?

    @ApochPiQ Could you suggest a resource for learning these sorts of things? Preferably not experience or university. Most books I've found on the subject really don't cover the things you've mentioned.
  11. Arbitary Rule Changing

    Thanks for the ideas Atrix256. I was actually taking more from a code design point of view. So you're suggesting something like this, Konfusius: [SOURCE] class Action { Execute(); } class Buff { Modify(Action); } class Actor { void AddBuff(Buff); list<Buff> buffs; void Attack() { Action act; for(Buff b : buffs) { b.Modify(act); } act.Execute(); } } [/SOURCE] It would work for certain specific gameplay ideas, but I don't think it can for others. Sorry, I can't think of any examples right now, but just looking at it makes me weary...
  12. In many games, the rules are changed mid game. The best example of this is Magic: The Gathering - the golden rule is if there's a conflict, then the card is right. I'm wondering how to program this into a game. Consider an RPG where you have equipment. The rules as originally concieved state that your armour score is your dexterity + the value of the armour you wear. Now say I pick up a pair of Shielding Gauntlets of +2 Awesomeness, that give you +2 to your armour, and that of your adjacent allies. The bonus to yourself seems simple enough, but how about for your allies? My instinct tells me to use some form of Aura system... The above example is simple enough, but what about more complex rule changes? Such as the boss having an Axe of Disabling, that instead of doing damage, prevents one of your equipment from working? Or a Bow that shoots flaming bolts, or a cloak that prevents 30% of ice damage?
  13. Programming Music

    What do you listen to when your programming? I find myself listening to stuff from rpgmp3.com, The Nerdy Show and LoadingReadyRun podcasts. Also I seem to like remixes. Does music help you program, or does it hinder you. I know if I have to think about the words, then I can't concentrate.
  14. Fluid Interactions with Rigid Bodies

    Thanks for your reply Relfos. I'm working in 2d now, but I'm interested in how you'd make it work in 3d. Should I just model the fluid as heaps of rigid circles? That doesn't feel right... I saw this (http://www.youtube.com/watch?v=V1xiVyJ3EOM) and it seems to work. I'm looking for something a little less computationally expensive. What other options are there?
  • Advertisement