Jump to content

  • Log In with Google      Sign In   
  • Create Account


Dahriel

Member Since 19 Jun 2011
Offline Last Active Aug 11 2011 07:37 PM

Topics I've Started

Glew and function prototype

28 July 2011 - 11:05 AM

I want to see the prototype of the function in Visual Studio 2010.

I am using glew and it seems to show me the # define

thank you
Gabriel


Here you can see a picture

main.c


#pragma comment (lib, "glew32.lib")
#pragma comment (lib, "opengl32.lib")
#pragma comment (lib, "GLFW.lib")
#pragma comment (lib, "glu32.lib")

#include <stdlib.h>
#include <stdio.h>

#include <GL\glew.h>
#include <GL\glext.h>
#include <GL\wglext.h>
#include <GL\glfw.h>

#include "Utilitaires.h"

#define true 1 
#define false 0
typedef int BOOL;

//////////////////////////////////////////
// Variables de porté fichiers
//////////////////////////////////////////
char	*pVertProgram, *vertProgramFile, *pFragProgram, *fragProgramFile;
int 	width, height, frame = 0;
BOOL	running = 1;

//////////////////////////////////////////
// Variables de vertexs
//////////////////////////////////////////
GLuint VAOs[2];

//////////////////////////////////////////
// Prototypes
//////////////////////////////////////////

//App loop
int initShaders(void);
int initData(void);
void preRender(void);
void render(void);
void postRender(void);
void dispose(void);


int main()
{
	GLenum glewError;

	// Initialize GLFW
	if( !glfwInit() )
	{
		exit( EXIT_FAILURE );
	}

	glfwOpenWindowHint(GLFW_WINDOW_NO_RESIZE, GL_TRUE);
	glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
	glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 1);

	if( !glfwOpenWindow( 640, 480, 0, 0, 0, 0, 0, 0, GLFW_WINDOW ) )
	{
		glfwTerminate();
		return 0;
	}

	glewError = glewInit();
	if (GLEW_OK != glewError)
	{
		/* Problem: glewInit failed, something is seriously wrong. */
		fprintf(stderr, "Error: %s\n", glewGetErrorString(glewError));

	}

	
	if(initShaders() != 0){
		exit( EXIT_FAILURE );
	}

	if(initData() != 0){
		exit( EXIT_FAILURE );
	}

	glfwSetWindowTitle("GLFW Application");

	while(running)
	{
		preRender();
		render();
		postRender();
	}

	dispose();
	glfwTerminate();

	return (0);
}


int initData(void){ 
    glGenVertexArrays(2, VAOs); 
	printf("pVAOs : %d", VAOs[1]);
	return 0;
}

int initShaders(void){
	vertProgramFile = "c:\\assets\\shaders\\minimal.vert";
	fragProgramFile = "c:\\assets\\shaders\\minimal.frag";


	pVertProgram = loafFile(vertProgramFile);
	if(pVertProgram == NULL)
		return 1;
	return 0;
}

void preRender(void){
	glfwGetWindowSize( &width, &height );
	height = height > 0 ? height : 1;
	glViewport( 0, 0, width, height );
}

void render(void){
	glClearColor(0.8f, 0.8f, 0.8f, 1.0f);
	glClear( GL_COLOR_BUFFER_BIT );
	glfwSwapBuffers();
}

void postRender(void){
	// exit if ESC was pressed or window was closed
	running = !glfwGetKey(GLFW_KEY_ESC) && glfwGetWindowParam( GLFW_OPENED);
}

void dispose(void){
	free(pVertProgram);
}

PARTNERS