• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Graphic_Programmer

Members
  • Content count

    13
  • Joined

  • Last visited

Community Reputation

107 Neutral

About Graphic_Programmer

  • Rank
    Member
  1. OKEEEEYY !!! I got it ! I understood why it dont draw.The reason of problem is a index.I used the index from 1 to end value but i might use from 0 to end-1.
  2. Is there nobody to help?
  3. Hi, I wrote my own obj loader codes and printed values of vertex,texture,normal and face to screen.The values in console screen was correct values but i cant draw the model properly.It looked distorted. [url="http://imageshack.us/photo/my-images/444/kamyons.png/"][img]http://img444.imageshack.us/img444/7067/kamyons.png[/img][/url] These are my codes about to load obj model: [CODE] #include <stdio.h> #include <math.h> int i,a,b,isaret,bb; int chartoint(char chr) { if(chr=='0') return 0; else if(chr=='1') return 1; else if(chr=='2') return 2; else if(chr=='3') return 3; else if(chr=='4') return 4; else if(chr=='5') return 5; else if(chr=='6') return 6; else if(chr=='7') return 7; else if(chr=='8') return 8; else if(chr=='9') return 9; else return 0; } char satir_atla(FILE * dosya_gostergesi) { char ww; while(! feof(dosya_gostergesi)) { ww=getc(dosya_gostergesi); if(ww=='\n') break; } ww=getc(dosya_gostergesi); return ww; } mtn_kopyala(char ydizi[],char hdizi[]) { for(i=0; ydizi[i]!='\0'; i++) { ydizi[i+1]; hdizi[i]=ydizi[i]; } hdizi[i]='\0'; } char satir_kopyala(FILE * dosya_gostergesi,char hdizi[]) { char ww; i=0; while(1) { ww=getc(dosya_gostergesi); hdizi[i+1]; hdizi[i]=ww; if(ww=='\n') { hdizi[i]='\0'; break; } i++; } ww=getc(dosya_gostergesi); return ww; } main() { FILE * gosterge; int yedek,sayiin,xxx,yyy,tip,atla,asama,nokta[3],j,ucgen_sayisi=0,vrtx=0,textu=0,nrml=0,ucgennn[10000][9]; char aaaa,satir[100],deneme[]="Aptal",deneme2[]="akilli"; double sayiif=0,texture[10000][3],vertex[10000][3],normal[10000][3]; gosterge=fopen("ucgen2.obj","r"); aaaa=getc(gosterge); while(! feof(gosterge)) { if(aaaa=='#') { aaaa=satir_atla(gosterge); } else if(aaaa=='v') { aaaa=getc(gosterge); if(aaaa==' ') {tip=0;} else if(aaaa=='t') {tip=1;} else if(aaaa=='n') {tip=2;} //sat?r? çözümlemeye ba?la { atla=1; asama=0; aaaa=satir_kopyala(gosterge,satir); for(i=0; 1; i++) { if((satir[i]=='0' || satir[i]=='1' || satir[i]=='2' || satir[i]=='3' || satir[i]=='4' || satir[i]=='5' || satir[i]=='6' || satir[i]=='7' || satir[i]=='8' || satir[i]=='9' || satir[i]=='.') && asama%2==0) { nokta[asama%2]=i; asama++; } else if ((satir[i]!='0' && satir[i]!='1' && satir[i]!='2' && satir[i]!='3' && satir[i]!='4' && satir[i]!='5' && satir[i]!='6' && satir[i]!='7' && satir[i]!='8' && satir[i]!='9' && satir[i]!='.')&& asama%2==1 ) { nokta[asama%2]=i-1; asama++; atla=0; } if(!atla) { if((asama%2)==0) { sayiif=0; if(satir[nokta[0]-1]=='-') isaret=-1; else isaret=1; for(yyy=0, j=nokta[1]; j>=nokta[0]; j--) { sayiif+=(chartoint(satir[j])*pow(10,(double)yyy)); if(satir[j]=='.') nokta[2]=j; else yyy++; } sayiif/=pow(10,(double)(nokta[1]-nokta[2])); sayiif*=isaret; //printf("%f\n",sayiif);//sayiif/=1;//(float)pow(10,(double)(nokta[2]-j)); switch(tip) { case 0: vertex[vrtx][asama/2-1]=sayiif; atla=1; case 1: texture[textu][asama/2-1]=sayiif; atla=1; default: normal[nrml][asama/2-1]=sayiif; atla=1; break; } } } if(tip==2) { if(asama==6) { nrml++; break; } } else if(tip==1) { if(asama==4) { textu++; break; } } else if(tip==0) { if(asama==6) { vrtx++; break; } } } } } else if(aaaa=='f') { //sat?r? çözümlemeye ba?la { atla=1; asama=0; aaaa=satir_kopyala(gosterge,satir); for(i=0; 1; i++) { if((satir[i]=='0' || satir[i]=='1' || satir[i]=='2' || satir[i]=='3' || satir[i]=='4' || satir[i]=='5' || satir[i]=='6' || satir[i]=='7' || satir[i]=='8' || satir[i]=='9' || satir[i]=='.') && asama%2==0) { nokta[asama%2]=i; asama++; } else if ((satir[i]!='0' && satir[i]!='1' && satir[i]!='2' && satir[i]!='3' && satir[i]!='4' && satir[i]!='5' && satir[i]!='6' && satir[i]!='7' && satir[i]!='8' && satir[i]!='9' && satir[i]!='.')&& asama%2==1 ) { nokta[asama%2]=i-1; asama++; atla=0; } if(!atla) { if((asama%2)==0) { sayiin=0; yedek=0; for(yyy=0, j=nokta[1]; j>=nokta[0]; j--,yyy++) { yedek=(int)(chartoint(satir[j])); for(b=0; b<yyy; b++) { yedek*=10; } sayiin+=yedek; } ucgennn[ucgen_sayisi][asama/2-1]=(int)sayiin; atla=1; } } if(asama==18) { ucgen_sayisi++; break; } } } } else { aaaa=getc(gosterge); } } fclose(gosterge); //printf("%d %d %d %f\n",nokta[0],nokta[1],t, sayiif); for(i=0; i<vrtx; i++) { printf("v "); for(j=0; j<3; j++) { printf("%f ",vertex[i][j]); if(j==2) printf("\n"); } } printf("\n"); for(i=0; i<textu; i++) { printf("vt "); for(j=0; j<2; j++) { printf("%f ",texture[i][j]); if(j==1) printf("\n"); } } printf("\n"); for(i=0; i<nrml; i++) { printf("vn "); for(j=0; j<3; j++) { printf("%f ",normal[i][j]); if(j==2) printf("\n"); } } printf("\n"); for(i=0; i<ucgen_sayisi; i++) { printf("f "); for(j=0; j<9; j++) { if((j%3)!=0) printf("/"); else printf(" "); printf("%i",ucgennn[i][j]); if(j==8) printf("\n"); } } while(1) { } } [/CODE] I tried the codes in Dev C++. You can try it to see values.For now, no problem but i couldnt draw properly when i tried these codes in Visual C++ with fist codes. [CODE] glPushMatrix(); glScaled(1,1,1); glRotated(0,0,0,0); glTranslated(0,0,0); glBegin(GL_TRIANGLES); for(i=0; i<ucgen_sayisi; i++) { for(j=0; j<3; j++) { glNormal3d(normal[ucgennn[i][j*3+2]][0],normal[ucgennn[i][j*3+2]][1],normal[ucgennn[i][j*3+2]][2]); glVertex3d(vertex[ucgennn[i][j*3]][0],vertex[ucgennn[i][j*3]][1],vertex[ucgennn[i][j*3]][2]); } } glEnd(); glPopMatrix(); [/CODE] Thanks.
  4. [quote name='dilyan_rusev' timestamp='1344706588' post='4968451'] For starters, get rid of the "ekran" variable and use screen or temp in its place. Look at this thread: [url="http://www.gamedev.net/topic/351860-taking-screenshots-using-glreadpixels/"]http://www.gamedev.n...g-glreadpixels/[/url] Check what is the value of gluErrorString(glGetError()) after the call to glReadBuffer. Overall, the code seems legit, but I'm not an OpenGL expert by any means. Do you draw something in OpenGL? When do you call this Screenshot function? Edit: GL_FRONT_AND_BACK seems to be illegal value for glReadBuffer. Try with GL_FRONT_LEFT instead. Quoting the [url="http://www.opengl.org/sdk/docs/man/xhtml/glReadBuffer.xml"]documentation[/url]: [quote]mode Specifies a color buffer. Accepted values are GL_FRONT_LEFT, GL_FRONT_RIGHT, GL_BACK_LEFT, GL_BACK_RIGHT, GL_FRONT, GL_BACK, GL_LEFT, GL_RIGHT, and GL_AUXi, where i is between 0 and the value of GL_AUX_BUFFERS minus 1. ... Nonstereo double-buffered configurations have only a front left and a back left buffer[/quote] [/quote] Thank you very much for your help! Me too not a expert of OpenGL but sure, you know it better than me becuse i am new in OpenGL and my English isn't very good to understand everything. Oh, i am an idiot [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img] First, I might say thats: Already, I called Screenshot function with screen surface and drew something to screen.The problem weren't them. When i tried GL_FRONT_LEFT, i made it just and i have a question: why doesn't it be when i tried GL_FRONT_RIGHT instead? What is different between LEFT and RIGHT? Does it mean front face and back face. I will try all of them.
  5. Isn't there nobody? Help! Pleasee
  6. You spoke to a interesting point about old games. Why the old games work less quality on newer computers? I think, maybe the reason is developers's a premeditation or mismatchs between old versions and new versions. I don't know which one but me too wonder.
  7. This is as my own cylinder texture mapping but i did't use GL_QUAD_STRIP, used GL_QUADS. This topic can help in need of someone. Thanks.
  8. Hi, I wanted to write screen saver function for my mother OpenGL Suface yesterday. First, i thinked this is very easy! I wrote SDL_SaveBMP(screen,"deneme.bmp"); The End.. That can be comic for you but unluckily it did not be. [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] The program showed an error message me and it was grotesque for me. Then, I found a function from a web site but does not work correctly.When it saved a bmp file, it only showed a color on all surface.The color was color of glClearColor function. The Screenshot Code: [CODE] int Screenshot(char *filename, SDL_Surface *screen) { SDL_Surface *temp; unsigned char *pixels; int i; if (!(screen->flags & SDL_OPENGL)) { SDL_SaveBMP(temp, filename); return 0; } temp = SDL_CreateRGBSurface(SDL_SWSURFACE, screen->w, screen->h, 24, #if SDL_BYTEORDER == SDL_LIL_ENDIAN 0x000000FF, 0x0000FF00, 0x00FF0000, 0 #else 0x00FF0000, 0x0000FF00, 0x000000FF, 0 #endif ); if (temp == NULL) return -1; pixels = malloc(3 * screen->w * screen->h); if (pixels == NULL) { SDL_FreeSurface(temp); return -1; } glReadBuffer(GL_FRONT_AND_BACK); glReadPixels(0, 0,screen->w, screen->h,GL_RGB , GL_UNSIGNED_BYTE, pixels); for (i=0; i<ekran->h; i++) memcpy(((char *) temp->pixels) + temp->pitch * i, pixels + 3*screen->w * (ekran->h-i-1), screen->w*3); free(pixels); SDL_SaveBMP(temp, filename); SDL_FreeSurface(temp); return 0; } [/CODE] Not : For first error the reason is not different between screen,"filename" and "filename",screen.SDL_SaveBMP and Screenshot are different fuctions. Thanks.
  9. Yes, me too, i want to make my own game engine.Mine will be with SDL and OpenGL in C.Now, if i want, i can use them to draw nice 3D/2D graphics but i still haven't got enough knowledge about them for advanced drawing so i must learn things more than them.At the moment, i am working on sound system.So far i tried a function to load and play a sound file(.wav) from a folder.I am very happy now becuse it played !
  10. OpenGL

    I made it. Thank you very much!
  11. OpenGL

    [quote name='Lazy Foo' timestamp='1344515647' post='4967755'] In that case you want to 1) Draw your 3D scene first with depth buffer enabled. 2) Clear/Disable the depth buffer and enable blending. 3) Draw the text over the 3D scene. 4) Swap buffers to update the screen. [/quote] Do you think i must change 2-3 and 1? OK i will try
  12. OpenGL

    [quote name='Lazy Foo' timestamp='1344512789' post='4967735'] You need to enable blending, set your blending calculation, and you should probably disable depth testing as it doesn't mix will with alpha blending. You probably want this somewhere in your initialization code: [source lang="cpp"]glEnable( GL_BLEND ); glDisable( GL_DEPTH_TEST ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );[/source] I got a tutorial on [url="http://lazyfoo.net/tutorials/OpenGL/10_color_keying_and_blending/index.php"]blending and transparency with OpenGL[/url] [/quote] Yes, i know but when i put glDisable(GL_DEPTH_TEST) to initialization, the red box looked on the transparent letter "A"(my 2D Ortho graphic).I think, the box must be under the 2D letter. This is screenshot when i put glDisable(GL_DEPTH_TEST); [URL=http://imageshack.us/photo/my-images/266/adszteo.png/][IMG]http://img266.imageshack.us/img266/7171/adszteo.png[/IMG][/URL]
  13. First, my English isn't very good, i can say wrong words so sorry. I am beginner to making 2D/3D Graphics in Opengl and i have a problem about drawing 3D shapes under 2D ortho graphics with alpha transparent. The ScreenShot [url="http://imageshack.us/photo/my-images/859/adszihx.png/"][img]http://img859.imageshack.us/img859/7598/adszihx.png[/img][/url] I don't know could i tell. I think you understood my problem from the picture. These are my drawing codes; [CODE] ciz() { glViewport(0,0,ewidth,eheight); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glPushMatrix(); glOrtho(-1,1,-1,1,-20,20); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glColor4f(1,1,0,1); glDisable(GL_TEXTURE_2D); glPushMatrix(); glTranslatef(((float)mouse_x-(ewidth/2))/(ewidth/2),-((float)mouse_y-(eheight/2))/(eheight/2),0.1); glBindTexture(GL_TEXTURE_2D,NULL); glBegin(GL_POLYGON); for(i=0; i<20; i++) { glVertex3f(cos(18*i*pi/180)/32,sin(18*i*pi/180)/32,0); } glEnd(); glColor4f(1,1,1,1); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D,tex[0]); glPopMatrix(); /* glBegin(GL_QUADS); glTexCoord2i(0,0); glVertex3f(-0.9,0.9,0); glTexCoord2i(1,0); glVertex3f(-0.6,0.9,0); glTexCoord2i(1,1); glVertex3f(-0.6,0.6,0); glTexCoord2i(0,1); glVertex3f(-0.9,0.6,0); glEnd(); glBegin(GL_QUADS); glTexCoord2i(0,0); glVertex3f(-0.6,0.9,0); glTexCoord2i(1,0); glVertex3f(-0.3,0.9,0); glTexCoord2i(1,1); glVertex3f(-0.3,0.6,0); glTexCoord2i(0,1); glVertex3f(-0.6,0.6,0); glEnd();*/ //glDisable(GL_BLEND); //glDisable(GL_DEPTH_TEST); glBindTexture(GL_TEXTURE_2D,tex[1]); glBegin(GL_QUADS); for(i=0,j=0; i<=yazi_uz; i++) { if(yazi[i]=='A') { ii=0; jj=0; glTexCoord2f((1+(float)ii+(float)ii*13)/512,(1+(float)jj+(float)jj*18)/256); glVertex3f(((0+(float)i*50 )/640)*2-1,-(((0+(float)j*80 )/480)*2-1),0); glTexCoord2f((1+(float)ii+((float)ii+1)*13)/512,(1+(float)jj+(float)jj*18)/256); glVertex3f(((0+((float)i+1)*50 )/640)*2-1,-(((0+(float)j*80 )/480)*2-1),0); glTexCoord2f((1+(float)ii+((float)ii+1)*13)/512,(1+(float)jj+((float)jj+1)*18)/256); glVertex3f(((0+((float)i+1)*50 )/640)*2-1,-(((0+((float)j+1)*80 )/480)*2-1),0); glTexCoord2f((1+(float)ii+(float)ii*13)/512,(1+(float)jj+((float)jj+1)*18)/256); glVertex3f(((0+(float)i*50 )/640)*2-1,-(((0+((float)j+1)*80 )/480)*2-1),0); } } glEnd(); glEnable(GL_DEPTH_TEST); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glPopMatrix(); gluPerspective(45,(float)(ewidth/eheight),.1,1000); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(c_x+cos((dir+180)*pi/180)*cos(-der*pi/180)*uz,c_y+sin((dir+180)*pi/180)*cos(-der*pi/180)*uz,c_z+sin(-der*pi/180)*uz,c_x,c_y,c_z, 0,1,0); glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); glColor3f(1,1,1); //glDisable(GL_TEXTURE_2D); /* glBegin(GL_POLYGON); glTexCoord2i(0,0); glVertex3f(-15,15,0); glTexCoord2i(1,0); glVertex3f(15,15,0); glTexCoord2i(1,1); glVertex3f(15,-15,0); glTexCoord2i(0,1); glVertex3f(-15,-15,0); glEnd();*/ //glEnable(GL_TEXTURE_2D); /*glBegin(GL_TRIANGLES); for(i=0; i<10; i++) { glNormal3f(cos((i+0.5)*36*pi/180)*cos(90-atan(10/7)*pi/180),sin((i+0.5)*36*pi/180)*cos(90-atan(10/7)*pi/180),sin(90-atan(10/7)*pi/180)); glVertex3f(0,0,5); glVertex3f(cos(36*i*pi/180)*7,sin(36*i*pi/180)*7,-5); glVertex3f(cos(36*(i+1)*pi/180)*7,sin(36*(i+1)*pi/180)*7,-5); } glEnd();*/ glColor4f(1,1,1, 1); //glDisable(GL_DEPTH_TEST); //glDepthMask(GL_TRUE); //glEnable(GL_ALPHA_TEST); glBindTexture(GL_TEXTURE_2D, tex[2]); glPushMatrix(); glTranslatef(obj[0].x,obj[0].y,obj[0].z); glScalef(0.5,0.5,0.5); glRotatef(der2*5,0.7,0.3,0.5); //glBindTexture(GL_TEXTURE_2D,tex[1]); glBegin(GL_QUADS); //alt glNormal3f(0,0,-1); glTexCoord2i(0,0); glVertex3f(-8,8,-8); glTexCoord2i(1,0); glVertex3f(8,8,-8); glTexCoord2i(1,1); glVertex3f(8,-8,-8); glTexCoord2i(0,1); glVertex3f(-8,-8,-8); //üst glNormal3f(0,0,1); glTexCoord2i(0,0); glVertex3f(-8,8,8); glTexCoord2i(1,0); glVertex3f(8,8,8); glTexCoord2i(1,1); glVertex3f(8,-8,8); glTexCoord2i(0,1); glVertex3f(-8,-8,8); //sa? glNormal3f(1,0,0); glTexCoord2i(0,0); glVertex3f(8,8,-8); glTexCoord2i(1,0); glVertex3f(8,8,8); glTexCoord2i(1,1); glVertex3f(8,-8,8); glTexCoord2i(0,1); glVertex3f(8,-8,-8); //sol glNormal3f(-1,0,0); glTexCoord2i(0,0); glVertex3f(-8,8,-8); glTexCoord2i(1,0); glVertex3f(-8,8,8); glTexCoord2i(1,1); glVertex3f(-8,-8,8); glTexCoord2i(0,1); glVertex3f(-8,-8,-8); //yukar? glNormal3f(0,1,0); glTexCoord2i(0,0); glVertex3f(-8,8,8); glTexCoord2i(1,0); glVertex3f(8,8,8); glTexCoord2i(1,1); glVertex3f(8,8,-8); glTexCoord2i(0,1); glVertex3f(-8,8,-8); //a?a?? glNormal3f(0,-1,0); glTexCoord2i(0,0); glVertex3f(-8,-8,8); glTexCoord2i(1,0); glVertex3f(8,-8,8); glTexCoord2i(1,1); glVertex3f(8,-8,-8); glTexCoord2i(0,1); glVertex3f(-8,-8,-8); glEnd(); glPopMatrix(); glEnable(GL_DEPTH_TEST); /* glClearColor(1,0,0,1); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);*/ //resim_yukle("font.bmp"); SDL_GL_SwapBuffers(); } [/CODE] Help please, Thanks for your helps.