10 Replies - 7287 Views - Last Post: 23 May 2011 - 07:03 AM Rate Topic: -----

#1 Kain6622  Icon User is offline

  • D.I.C Regular

Reputation: 17
  • View blog
  • Posts: 255
  • Joined: 18-March 10

OpenGL class problem

Posted 22 May 2011 - 02:47 PM

Hi, I'm currently working on learning the new standard of opengl and i'm trying to create a class to deal with opengl initializations, the problem i'm having is concerning the GLTool kit that when ever it tries to initialize the stock shaders it crashes I've tryed debugging it but it just leads me to a hash define created in glew which all it primarily does is return an address to a shader, I don't know what is being done wrong, please could someone help me figure this out, I'm partly thinking it might be something in my code but I cannot find anything that could be causing the issue.

Problem solved: If your using glew make sure that you make a call to glewInit after setting the pixel format to get all the extensions available on the pc your working on.

This post has been edited by Kain6622: 23 May 2011 - 07:05 AM


Is This A Good Question/Topic? 0
  • +

Replies To: OpenGL class problem

#2 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 1011
  • View blog
  • Posts: 4,215
  • Joined: 14-February 08

Re: OpenGL class problem

Posted 22 May 2011 - 03:09 PM

Post the errors please :)
Was This Post Helpful? 1
  • +
  • -

#3 Kain6622  Icon User is offline

  • D.I.C Regular

Reputation: 17
  • View blog
  • Posts: 255
  • Joined: 18-March 10

Re: OpenGL class problem

Posted 22 May 2011 - 03:16 PM

The error it comes up with is a follows:
Unhandled exception at 0x00000000 in Framewirk.exe: 0xC00000005: Access violation.



The Command it point to when this happens is in GLTools.cpp in gltLoadShaderPairSrcWithAttributes on line which is as follow:
  hVertexShader = glCreateShader(GL_VERTEX_SHADER); 

Was This Post Helpful? 0
  • +
  • -

#4 Oler1s  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1395
  • View blog
  • Posts: 3,884
  • Joined: 04-June 09

Re: OpenGL class problem

Posted 22 May 2011 - 03:37 PM

There's no reason a call to glCreateShader itself will cause an access violation.

Can you reproduce the problem with some self contained code?
Was This Post Helpful? 1
  • +
  • -

#5 Kain6622  Icon User is offline

  • D.I.C Regular

Reputation: 17
  • View blog
  • Posts: 255
  • Joined: 18-March 10

Re: OpenGL class problem

Posted 22 May 2011 - 04:09 PM

I've tried to reproduce the error without the use of GLTools but I don't get any errors but when i try to draw anything with the old opengl commands nothing shows apart from the colour i tell it to clear the screen too? I'm not sure but could I maybe be doing something wrong with my pointers??

edit: I missed a break in the window message loop switch statement but unfortunately that does not solve the problem.

This post has been edited by Kain6622: 22 May 2011 - 04:31 PM

Was This Post Helpful? 0
  • +
  • -

#6 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 1011
  • View blog
  • Posts: 4,215
  • Joined: 14-February 08

Re: OpenGL class problem

Posted 22 May 2011 - 04:40 PM

Noticed you are not calling glewInit(). Do you do this anywhere?
Was This Post Helpful? 0
  • +
  • -

#7 Kain6622  Icon User is offline

  • D.I.C Regular

Reputation: 17
  • View blog
  • Posts: 255
  • Joined: 18-March 10

Re: OpenGL class problem

Posted 22 May 2011 - 05:06 PM

I've got the program to render basic opengl ( problem was related to the pointer to the HDC aswell as the resize function needing to be called after the pixel format function), but still have the same issue with the GLTools and the access violation, just for information I'm using a ATI Mobile radeon HD 5870 and have done tests with gpu programs to make sure that my laptop was compatable with the new standard and extension.

This post has been edited by Kain6622: 22 May 2011 - 05:10 PM

Was This Post Helpful? 0
  • +
  • -

#8 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: 1
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: OpenGL class problem

Posted 22 May 2011 - 06:01 PM

You need to use glGetError() (or whatever it's called) to get the error state from the OpenGL pipeline. You normally get access violations when you failed to properly set a previous state.
Was This Post Helpful? 1
  • +
  • -

#9 Kain6622  Icon User is offline

  • D.I.C Regular

Reputation: 17
  • View blog
  • Posts: 255
  • Joined: 18-March 10

Re: OpenGL class problem

Posted 22 May 2011 - 06:37 PM

Ok I've gone through the code a few time and the books and you where right ButchDean I had forgootten to initialize glew before the loading of the shaders :S, thank you everyone for the help, i'll try be more careful next time :).
Was This Post Helpful? 1
  • +
  • -

#10 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 1011
  • View blog
  • Posts: 4,215
  • Joined: 14-February 08

Re: OpenGL class problem

Posted 23 May 2011 - 12:53 AM

Quote

Noticed you are not calling glewInit(). Do you do this anywhere?


I posted this and then hid it as I wasn't sure if you were building with glew, try and give as much information as possible and you will get better answers :)

This post has been edited by stayscrisp: 23 May 2011 - 12:53 AM

Was This Post Helpful? 1
  • +
  • -

#11 Kain6622  Icon User is offline

  • D.I.C Regular

Reputation: 17
  • View blog
  • Posts: 255
  • Joined: 18-March 10

Re: OpenGL class problem

Posted 23 May 2011 - 07:03 AM

Sorry I'll try give you all more information next time, need to also pay more attention to what the book example tell me to do, thank you all again for the help :).
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1