Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
naalaa opengl GL_QUADS dosnt work [solved]
#1
Question 
I was trying to play with naalaa opengl and ran into a wall fast. didn't even pass the first nehe tut code.

hers the code. its supposed to show a triangle and a rectangle side by side.

Code:
import "OpenGL.lib"
rem header will be in OpenGL.lib later.
import "gl_h.lib"
import "Keycodes.lib"
import "Speed.lib"


if not glInit("OpenGL Next", 64, 64, 800, 600, true) then end


do
    rem The window is not the NaaLaa window, so we need to let it
    rem deal with its messages and stuff.
    proc glUpdate

    rem clear screen and depth buffer
    _glClear GL_COLOR_BUFFER_BIT OR GL_DEPTH_BUFFER_BIT

    rem reset view
    _glLoadIdentity


    rem set xyz poz
    _glTranslatef -1.5,0.0,-6.0
    rem set color blue
    _glColor3f 0.0,0.0,1.0

    rem draw triangle
    _glBegin GL_TRIANGLES
        _glVertex3f 0.0,1.0,0.0
        _glVertex3f -1.0,-1.0,0.0
        _glVertex3f 1.0,-1.0,0.0
    _glEnd
    rem finish drawing

    _glTranslatef 3.0,0.0,0.0

    rem draw squer
    _glBegin GL_QUADS
        _glVertex3f -1.0,1.0,0.0
        _glVertex3f 1.0,1.0,0.0
        _glVertex3f 1.0,-1.0,0.0
        _glVertex3f -1.0,-1.0,0.0
    _glEnd
    rem finish drawing

    _glRender

_SPD_HoldFrame 60

loop
Reply
#2
Sorry for being slow with the responses, busy times. I'll have a look at your code tomorrow. I will also see if I can find and post the TD extension and tools that I wrote some years ago. Those can be of help if you want to make 3D games:

https://youtu.be/wM3mGohetfw
https://youtu.be/X0R0Pbn-dn0
https://youtu.be/ajJz3BfDX8U
Reply
#3
thank you Marcus

its ok I didn't expect a fast response, I'm aware people/programmers are busy with work and life.

Robowack is awesome.

I await to see the solution for this problem, btw this opengl code did work on a different platform(c++). I was surprised it didn't work and didn't produce an error. I'm kinda getting into opengl at the moment.
Reply
#4
I found this on my computer. It may or may not help.


Attached Files
.zip   OpenGL.zip (Size: 549.92 KB / Downloads: 3)
Reply
#5
(01-29-2019, 10:21 PM)Rick3137 Wrote: I found this on my computer. It may or may not help.

perfect I found a solution inside your code. the code works now. I can move on to port the rest of my opengl code.

thank you rick. its the second time your code helps me figure things out.

Code:
import "OpenGL.lib"
rem header will be in OpenGL.lib later.
import "gl_h.lib"
import "Keycodes.lib"
import "Speed.lib"


if not glInit("OpenGL Next", 64, 64, 800, 600, true) then end


do
    rem The window is not the NaaLaa window, so we need to let it
    rem deal with its messages and stuff.
    proc glUpdate

    rem clear screen and depth buffer
    _glClear GL_COLOR_BUFFER_BIT OR GL_DEPTH_BUFFER_BIT

    rem reset view
    _glLoadIdentity


    rem set xyz poz
    _glTranslatef -1.5,0.0,-6.0
    rem set color blue
    _glColor3f 0.0,0.0,1.0

    rem draw triangle
    _glBegin GL_TRIANGLES
        _glVertex3f 0.0,1.0,0.0
        _glVertex3f -1.0,-1.0,0.0
        _glVertex3f 1.0,-1.0,0.0
    _glEnd
    rem finish drawing

    _glTranslatef 3.0,0.0,0.0

    rem draw squer
    _glBegin GL_QUADS
        _glVertex3f 1.0,1.0,1.0
        _glVertex3f -1.0,1.0,1.0
        _glVertex3f -1.0,-1.0,1.0
        _glVertex3f 1.0,-1.0,1.0
    _glEnd
    rem finish drawing

    _glRender

_SPD_HoldFrame 60

loop
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)