Search found 164 matches

by Nokurn
Sun Aug 14, 2011 4:01 pm
Forum: Programming Discussion
Topic: Segmentation fault with function pointers
Replies: 5
Views: 978

Re: Segmentation fault with function pointers

I renamed the functions in my test program and it ran well, I renamed them back to what they were before and made the function pointers static and it also worked. Thanks! It always seems to be something really small that trips me up :oops: You're welcome! If you don't know what the static keyword d...
by Nokurn
Sat Aug 13, 2011 3:10 pm
Forum: Programming Discussion
Topic: Optimizing several glDrawElements calls
Replies: 7
Views: 1332

Optimizing several glDrawElements calls

I am currently working on the font system for my game's engine, and I've come up with this great design that gives me great frame rates and a shitload of flexibility. However, there is some optimization that I think could be done with my rendering code, and I've come up against a bit of a snag in ge...
by Nokurn
Fri Aug 12, 2011 3:05 pm
Forum: Programming Discussion
Topic: Segmentation fault with function pointers
Replies: 5
Views: 978

Re: Segmentation fault with function pointers

init = initFunc; It would appear that init is a variable somewhere in your library, yes? Like this: void (*init)(void); But you have another symbol in main.c called init... void init() { } I don't use shared libraries all that often myself (I prefer static libraries for a number of reasons), so I m...
by Nokurn
Sun Apr 10, 2011 4:03 pm
Forum: Programming Discussion
Topic: [SOLVED]Setting up OpenGl's projection mode units?
Replies: 12
Views: 1468

Re: Setting up OpenGl's projection mode units to equal pixels?

If I'm understanding the question properly, you want (0,0) to be the top-left corner, and (w,h) to be the bottom-right corner, correct? To do that, you would use this code: glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0, width, height, 0.0, -1.0, 1.0); gl...
by Nokurn
Fri Apr 08, 2011 9:09 am
Forum: Programming Discussion
Topic: [SOLVED]Opengl Alpha Test
Replies: 11
Views: 1257

Re: Opengl Alpha Test

I rewrote some of my code to be like yours and it still had the same issue. I'm thinking it might be an issue with my texture? I don't see how that could be though, I literally just saved a .PNG like I always do... Edit* I tried using the texture you supplied and it's the same deal, NOTHING will di...
by Nokurn
Fri Apr 08, 2011 1:58 am
Forum: Programming Discussion
Topic: [SOLVED]Opengl Alpha Test
Replies: 11
Views: 1257

Re: Opengl Alpha Test

I'm pretty much stumped. The only thing I can think of is perhaps an issue with your texture. I put together a quick test to see if I could replicate the issue, but I could not. Here is the code I used: #include "SDL/SDL.h" #include "SDL/SDL_opengl.h" #ifdef __APPLE__ # include &...
by Nokurn
Fri Apr 08, 2011 1:01 am
Forum: Programming Discussion
Topic: [SOLVED]Opengl Alpha Test
Replies: 11
Views: 1257

Re: Opengl Alpha Test

I've added those lines, and tried your suggestions and it's still the same thing, nothing draws. Also, when I remove the line you said it ends up not loading the textures ( the quads show up as white with no texture ), so that doesn't fix the BGR problem. To be perfectly clear my issue is, that I w...
by Nokurn
Fri Apr 08, 2011 12:31 am
Forum: Programming Discussion
Topic: [SOLVED]Opengl Alpha Test
Replies: 11
Views: 1257

Re: Opengl Alpha Test

My mistake. Add this before your call to SDL_SetVideoMode(): SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); SDL doesn't always set you up with an alpha channel when you create an...
by Nokurn
Thu Apr 07, 2011 11:00 pm
Forum: Programming Discussion
Topic: [SOLVED]Opengl Alpha Test
Replies: 11
Views: 1257

Re: Opengl Alpha Test

Assuming that what you want is for your textures to have translucent pixels, this bit glAlphaFunc( GL_GREATER, 0.1f ); glEnable( GL_ALPHA_TEST ); should be glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); glEnable( GL_BLEND ); See the documentation for glAlphaFunc() and glBlendFunc() if you're i...
by Nokurn
Thu Apr 07, 2011 5:56 pm
Forum: Programming Discussion
Topic: Simple C Error
Replies: 6
Views: 812

Re: Simple C Error

char *cmd = (char *)malloc(sizeof(char) * (strlen("gcc -std=c99 ") + strlen(fileName) + 1)); // The sizeof(char) may look a little redundant, but I have a habit of writing my C-style allocations to be ready to upgrade to wide characters with just a few project-wide find/replaces. sprintf(...
by Nokurn
Thu Apr 07, 2011 3:44 pm
Forum: Programming Discussion
Topic: Simple C Error
Replies: 6
Views: 812

Re: Simple C Error

The problem lies in this line: system(strcat("gcc -std=c99 ", fileName)); I think you're missing some of the basic concepts of C strings, or maybe just C memory management. What's going on here is something like this: When you compile this file, the compiler will create a 14-byte space in ...
by Nokurn
Fri Apr 01, 2011 2:20 am
Forum: General Gaming
Topic: Post every time you beat a game.
Replies: 629
Views: 854697

Re: Post every time you beat a game.

Borderlands.

What an abrupt ending. :(
by Nokurn
Sat Feb 12, 2011 10:53 pm
Forum: Programming Discussion
Topic: 3d models
Replies: 8
Views: 912

Re: 3d models

k1net1k wrote:welcome krolgar :) a first post that's actually informative. i never thought this could be :)
Thanks. :)
by Nokurn
Sat Feb 12, 2011 2:45 pm
Forum: Programming Discussion
Topic: 3d models
Replies: 8
Views: 912

Re: 3d models

It really depends on what you want. Here's a list of some common formats: Direct3D .X - This format is pretty good. It's easy to understand (and therefore easy to load), has both an ASCII and binary format, and has the main features you might want, including animations and materials. X files can be ...