Jump to content
  • Advertisement
Sign in to follow this  
AverageJoeSSU

OpenGL pBuffer Creation and weird errors.....

This topic is 3936 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey Guys, Im trying to create pBuffers and im running into some wierd compiler errors. I'm using the code from the More OpenGL Programming Book.
#ifndef LETTHEREBELIGHT_H
#define LETTHEREBELIGHT_H

#include<windows.h>
#include<gl/gl.h>
#include<gl/glext.h>
#include<gl/wglext.h>





#endif


#include"Lighting.h"


//Get Current Device and Rendering Contexts
HDC win_dc  = wglGetCurrentDC();
HGLRC win_glrc  = wglGetCurrentContext();
HPBUFFERARB pbuffer;

int pixel_format[] = {
	WGL_DRAW_TO_PBUFFER_ARB, 1,
	WGL_SUPPORT_OPENGL_ARB, 1,
	WGL_PIXEL_TYPE_ARB,		WGL_TYPE_RGBA_ARB,
	WGL_DEPTH_BITS_ARB,		24,
	WGL_STENCIL_BITS_ARB,	8,
	WGL_FLOAT_COMPONENTS_NV, 1,
	WGL_AUX_BUFFERS_ARB,	4,
	WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV, 1,
	WGL_RED_BITS_ARB,		32,
	WGL_GREEN_BITS_ARB,		32,
	WGL_BLUE_BITS_ARB,		32,
	WGL_ALPHA_BITS_ARB,		32,
	0};

int buffer_format[] = {
	WGL_PBUFFER_LARGEST_ARB, 1,
	WGL_TEXTURE_TARGET_ARB,  WGL_TEXTURE_RECTANGLE_NV,
	WGL_TEXTURE_FORMAT_ARB,  WGL_TEXTURE_FLOAT_RGBA_NV,
	0};

int best_format;// = GetPixelFormat(win_dc);
unsigned int num_formats = 0;

wglChoosePixelFormatARB(win_dc, (const int*)pixel_format, NULL, 1, &best_format, &num_formats); //first set of errors for here

pbuffer = wglCreatePbufferARB(win_dc, best_format, width, height, (const int*)buffer_format); //second set of errors here



I know height and width arent declared yet... but im getting the following... error C4430: missing type specifier - int assumed. Note: C++ does not support default-int error C2078: too many initializers error C2440: 'initializing' : cannot convert from 'unsigned int *__w64 ' to 'int' 1> There is no context in which this conversion is possible error C4430: missing type specifier - int assumed. Note: C++ does not support default-int error C2040: 'pbuffer' : 'int' differs in levels of indirection from 'HPBUFFERARB' error C3861: 'wglCreatePbufferARB': identifier not found thanks for the help.

Share this post


Link to post
Share on other sites
Advertisement
No idea. Depends on which lines the errors are refering too.
While your at it, forget pbuffers and move on to FBO. FBO has been around for 3 or 4 years on every card that's popped out. And it's easy to use, more efficient than pbuffers because you don't have to track GL states between the pbuffer and the main context.

Share this post


Link to post
Share on other sites
Quote:
error C3861: 'wglCreatePbufferARB': identifier not found
Here we go...
glext.h does not provide new functions, only constants and types to declare these functions.
You have to do it youself.
Like this:

PFNWGLCREATEPBUFFERARBPROC wglCreatePbufferARB;

wglCreatePbufferARB = (PFNWGLCREATEPBUFFERARBPROC) wglGetProcAddress("wglCreatePbufferARB");

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!